diff options
author | jkh <jkh@FreeBSD.org> | 2000-02-19 23:22:22 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2000-02-19 23:22:22 +0000 |
commit | cee74ce38920b8f7c2ff067518c0703bb0de870e (patch) | |
tree | 40bd2f2ed649cfae278188f3e8bb2b4bc20ff77a /usr.sbin/sysinstall/config.c | |
parent | 841fc647e82546c5ace4a39b6928db40cb033cc6 (diff) | |
download | FreeBSD-src-cee74ce38920b8f7c2ff067518c0703bb0de870e.zip FreeBSD-src-cee74ce38920b8f7c2ff067518c0703bb0de870e.tar.gz |
If user says they're in the USA, record that fact in /etc/make.conf
Diffstat (limited to 'usr.sbin/sysinstall/config.c')
-rw-r--r-- | usr.sbin/sysinstall/config.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index 9ce954d..de2d4e6 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -364,6 +364,41 @@ configEnvironmentResolv(char *config) } } +/* Set up the make.conf file */ +void +configMake_conf(char *config) +{ + char *lines[MAX_LINES]; + int i, nlines; + FILE *fp; + + if (!file_readable(config)) { + char *line = malloc(21); + sprintf(line, "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO"); + lines[0] = line; + nlines = 1; + } + else { + nlines = readConfig(config, lines, MAX_LINES); + if (nlines == -1) + return; + for (i = 0; i < nlines; i++) { + if (!strncmp(lines[i], "USA_RESIDENT", 12)) { + free(lines[i]); + lines[i] = malloc(21); /* big enough */ + sprintf(lines[i], "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO"); + } + } + } + if ((fp = fopen(config, "w")) != NULL) { + for (i = 0; i < nlines; i++) { + fprintf(fp, "%s", lines[i]); + free(lines[i]); + } + fclose(fp); + } +} + /* Version of below for dispatch routines */ int configRC(dialogMenuItem *unused) |