Project

General

Profile

Actions

C library nxhclib

int nxh_base_dir_filter(const struct dirent *dir);

Basic filter for scandir: filter '.' and '..'.

int nxh_isexecutable(const char *filename);
int nxh_isfifo(const char *filename);
int nxh_fileexists(const char* filename);
int nxh_direxists(const char* dirname);

Exactly what it says on the tin. Return 1 on full succes, 0 on successful test but unmatched condition and -1 on unsuccessful test.

char* nxh_which(const char *cmd);

Hopefully the same as the shell command `which`. Return has to be freed. NULL if not found.

int nxh_has_sysdaemon();

Returns 1 if nxsysdaemon is running, responsive and has a matching protocol version. 0 else.

int nxh_whisper(char *answer, int len, const char *question);

Whispers a `question` to nxsysdaemon, stores the answer (up to `len` characters) in `answer`. Returns number of bytes read on success, -1 else.

int nxh_get_curbright();

Gets the currently set display brightness (see nxsysdaemon for details).

int nxh_get_maxbright();

Gets the maximum display brightness (see nxsysdaemon for details).

int nxh_set_bright();

Sets the current display brightness (see nxsysdaemon for details).

int nxh_is_onac();

Returns 1 if the system is on AC, 0 otherwise (see nxsysdaemon for details).

int nxh_is_save_wifi(const char *save_networks);

Returns 1 if the system is connected to a WiFi network with ESSID `save_networks`. 0 if not. -1 if testing was impossible.

int nxh_is_locked();

Returns 1 if the system is locked with nxulock. 0 if not. -1 if testing was impossible.

int nxh_is_docked(const char *pseudo_dock);

Returns 1 if the system is docked. Either with a classic (kernel supported) dock, or to a USB pseudo dock given by pseudo_dock (VENDOR:DEVICE).

Updated by Stefan Mark over 4 years ago · 1 revisions