diff options
author | Thomas Voss <thomasvoss@live.com> | 2022-02-02 18:31:40 +0100 |
---|---|---|
committer | Thomas Voss <thomasvoss@live.com> | 2022-02-02 18:31:40 +0100 |
commit | 60b340ce0cc726dea36fed5488c5042b2a087348 (patch) | |
tree | c6cab5c046a932496075659d7314b53f95efba8d /mstatus.c | |
parent | 8c811d27cad551babc55188f7d969ffc52c111c7 (diff) |
Make use of function prototypes
By making use of function prototypes, the ordering of functions is no
longer relevant.
Diffstat (limited to 'mstatus.c')
-rw-r--r-- | mstatus.c | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -32,14 +32,24 @@ struct { size_t len; } seperator = {.str = " | ", .len = 3}; -static noreturn void +static noreturn void usage(void); +static noreturn void die(const char *); +static void xfork(void); +static void *xrealloc(void *, size_t); +static void xfree(char **); +static void write_status(struct Block); +static bool process(char *, struct Block *); +static void create_fifo(char *); +static void daemonize(void); + +void usage(void) { fprintf(stderr, "Usage: %s [-r] [-s seperator]\n", argv0); exit(EXIT_FAILURE); } -static noreturn void +void die(const char *s) { char *err = strerror(errno); @@ -48,7 +58,7 @@ die(const char *s) exit(EXIT_FAILURE); } -static void +void xfork(void) { pid_t pid = fork(); @@ -58,7 +68,7 @@ xfork(void) exit(EXIT_SUCCESS); } -static void * +void * xrealloc(void *ptr, size_t size) { void *ret; @@ -67,14 +77,14 @@ xrealloc(void *ptr, size_t size) return ret; } -static void +void xfree(char **ptr) { free(*ptr); *ptr = NULL; } -static void +void write_status(struct Block b) { static struct { @@ -160,7 +170,7 @@ update_bar:; (void) XCloseDisplay(dpy); } -static bool +bool process(char *line, struct Block *b) { if (*line == '-') { @@ -184,7 +194,7 @@ process(char *line, struct Block *b) return true; } -static void +void create_fifo(char *fifo_path) { char *runtime_dir = getenv("XDG_RUNTIME_DIR"); @@ -213,7 +223,7 @@ create_fifo: syslog(LOG_INFO, "Created input FIFO '%s'", fifo_path); } -static void +void daemonize(void) { xfork(); |