diff options
Diffstat (limited to 'util2.h')
| -rw-r--r-- | util2.h | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,24 @@ +#include <stdio.h> +#include <fcntl.h> +#include <err.h> +#include <unistd.h> +#include <stdlib.h> + +int +readEnv(FILE *fh) +{ + int ret; + char name[1024], value[8192]; + + while (1) { + if ((ret = fscanf(fh, "%1023[^=]=%8191[^\n]\n", &name, &value)) == EOF) + break; + else if (ret == 0) + break; + + fprintf(stderr, "Setting: '%s' = '%s'\n", name, value); + setenv(name, value, 1); + } + + return 0; +} |
