libsysutils

view src/sysutils.c @ 1:c1323f9f202d

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 05 May 2015 05:51:56 +0300
parents
children
line source
1 #include <stdlib.h>
2 #include <string.h>
3 #include "sysutils.h"
4 #include "sysu_impl.h"
6 int sysu_init(const char *appname, const char *inst_prefix)
7 {
8 memset(&sysu_state, 0, sizeof sysu_state);
10 if(appname) {
11 if(!(sysu_state.appname = strdup(appname))) {
12 return -1;
13 }
14 }
15 if(inst_prefix) {
16 if(!(sysu_state.prefix = strdup(inst_prefix))) {
17 free(sysu_state.appname);
18 return -1;
19 }
20 }
22 return 0;
23 }
25 void sysu_shutdown(void)
26 {
27 free(sysu_state.appname);
28 free(sysu_state.prefix);
29 }