diff options
Diffstat (limited to 'usr.sbin/sade/config.c')
-rw-r--r-- | usr.sbin/sade/config.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index 2ef56a2..dc601f4 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -301,9 +301,9 @@ readConfig(char *config, char **lines, int max) #define MAX_LINES 2000 /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */ -/* Load the environment from /etc/sysconfig, if it exists */ +/* Load the environment from a sysconfig file */ void -configEnvironment(char *config) +configEnvironmentSysconfig(char *config) { char *lines[MAX_LINES], *cp, *cp2; int i, j, nlines; @@ -332,6 +332,30 @@ configEnvironment(char *config) } } +/* Load the environment from a resolv.conf file */ +void +configEnvironmentResolv(char *config) +{ + char *lines[MAX_LINES]; + int i, nlines; + + nlines = readConfig(config, lines, MAX_LINES); + if (nlines == -1) + return; + for (i = 0; i < nlines; i++) { + Boolean name_set = FALSE; + + if (!strncmp(lines[i], "domain", 6)) + variable_set2(VAR_DOMAINNAME, string_skipwhite(lines[i] + 6)); + else if (!strncmp(lines[i], "nameserver", 10) && !name_set) { + /* Only take the first nameserver setting - we're lame */ + variable_set2(VAR_NAMESERVER, string_skipwhite(lines[i] + 10)); + name_set = TRUE; + } + free(lines[i]); + } +} + /* * This sucks in /etc/sysconfig, substitutes anything needing substitution, then * writes it all back out. It's pretty gross and needs re-writing at some point. @@ -360,7 +384,6 @@ configSysconfig(char *config) free(lines[i]); lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 5); sprintf(lines[i], "%s=\"%s\"\n", v->name, v->value); - msgDebug("Variable substitution on: %s\n", lines[i]); } } } |