getconf ay isang programa C na maaaring makuha NAME = VALUE pares mula sa isang configuration file.
Sample:
#include
#include
#include
#include "getconf.h"
int main (int argc, pansamantalang trabaho * argv [])
{
struct config c;
char * vars [MAX_LINES];
char * vals [MAX_LINES];
char * configfile = "getconf_test.conf";
int linya;
count int;
linya = open_file (configfile);
kung (linya <0)
{
fprintf (stderr, "Hindi mabasa config file% sn", configfile);
exit (EXIT_FAILURE);
}
get_config (& c);
para sa (count = 0; count
* (Vars + count) = (char *) malloc (strlen (c.var [count]));
* (Vals + count) = (char *) malloc (strlen (c.val [count]));
strcpy (* (vars + count), c.var [count]);
strcpy (* (vals + count), c.val [count]);
printf ("Variable:% sttValue:% sn", * (vars + count), * (vals + count));
}
/ * Ngayon paglilinis * /
para sa (count = 0; count
free (vars [count]);
free (vals [count]);
}
bumalik 0;
}
Mga detalye ng Software:
Bersyon: 0.1
I-upload ang petsa: 2 Jun 15
Lisensya: Libre
Katanyagan: 37
Mga Komento hindi natagpuan