util.h (649B)
1 /* See LICENSE for copyright information 2 * 3 * Common functions that may be used for future C utilities 4 */ 5 6 #include <limits.h> 7 8 typedef struct service { 9 char name[NAME_MAX]; 10 char sysdir[PATH_MAX]; 11 char rundir[PATH_MAX]; 12 char pidfile[PATH_MAX]; 13 char svfile[PATH_MAX]; 14 } service; 15 16 /* 17 * Get information about the service. 18 */ 19 service *sv_init(service *sv, char *sv_name); 20 21 /* 22 * Check whether the given pid exists. 23 */ 24 int checkprocess(int pid); 25 26 /* 27 * Get environment variable while setting a fallback 28 */ 29 char *getenv_fallback(char *name, char *fallback); 30 31 /* 32 * Exit program while printing a message 33 */ 34 void die(const char *msg, ...);