diff options
author | phk <phk@FreeBSD.org> | 1995-05-20 19:12:13 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1995-05-20 19:12:13 +0000 |
commit | 8874835086bd5b4560192f88191aa557a445702b (patch) | |
tree | 6a0a6d72ea95ef176dd4fad790e966dec9a8849e /release | |
parent | 7ee584e87b77288741d4f89ccd93c8cdfd0e6c87 (diff) | |
download | FreeBSD-src-8874835086bd5b4560192f88191aa557a445702b.zip FreeBSD-src-8874835086bd5b4560192f88191aa557a445702b.tar.gz |
Change vsystem to know that the shell is crunched in.
Sanitize a couple of messages.
Diffstat (limited to 'release')
-rw-r--r-- | release/sysinstall/install.c | 8 | ||||
-rw-r--r-- | release/sysinstall/msg.c | 4 | ||||
-rw-r--r-- | release/sysinstall/system.c | 58 |
3 files changed, 62 insertions, 8 deletions
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index 5bd0e7d..3315115 100644 --- a/release/sysinstall/install.c +++ b/release/sysinstall/install.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: install.c,v 1.39 1995/05/20 16:22:42 jkh Exp $ + * $Id: install.c,v 1.40 1995/05/20 18:37:03 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -122,10 +122,12 @@ installInitial(void) msgNotify("Running bad block scan on partition %s", c1->name); ret = vsystem("bad144 -v /dev/r%s 1234", c1->name); if (ret) - msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); + msgConfirm("Bad144 init on %s returned status of %d!", + c1->name, ret); ret = vsystem("bad144 -v -s /dev/r%s", c1->name); if (ret) - msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); + msgConfirm("Bad144 scan on %s returned status of %d!", + c1->name, ret); } } } diff --git a/release/sysinstall/msg.c b/release/sysinstall/msg.c index 31ec20c..c9b3e20 100644 --- a/release/sysinstall/msg.c +++ b/release/sysinstall/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.19 1995/05/20 13:24:34 jkh Exp $ + * $Id: msg.c,v 1.20 1995/05/20 14:05:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -88,7 +88,7 @@ msgInfo(char *fmt, ...) attrset(attrs); refresh(); if (OnVTY) { - msgDebug("Informational message `%s'\n", errstr); + msgDebug("Information: `%s'\n", errstr); msgInfo(NULL); } free(errstr); diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c index 28efd39..b25888f 100644 --- a/release/sysinstall/system.c +++ b/release/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.21 1995/05/20 08:31:43 jkh Exp $ + * $Id: system.c,v 1.22 1995/05/20 13:24:35 jkh Exp $ * * Jordan Hubbard * @@ -276,10 +276,62 @@ systemChangeScreenmap(const u_char newmap[]) dialog_clear(); } } +/* Execute a command that is crunched into the same binary */ +int +vsystem(char *fmt, ...) +{ + va_list args; + union wait pstat; + pid_t pid; + int omask; + sig_t intsave, quitsave; + char *cmd,*argv[100]; + int i; + + cmd = (char *)malloc(FILENAME_MAX); + cmd[0] = '\0'; + va_start(args, fmt); + vsnprintf(cmd, FILENAME_MAX, fmt, args); + va_end(args); + omask = sigblock(sigmask(SIGCHLD)); + msgDebug("Executing command `%s'\n", cmd); + switch(pid = fork()) { + case -1: /* error */ + (void)sigsetmask(omask); + i = 127; + + case 0: /* child */ + (void)sigsetmask(omask); + if (DebugFD != -1) { + if (OnVTY) + msgInfo("Command output is on debugging screen - type ALT-F2 to see it"); + dup2(DebugFD, 0); + dup2(DebugFD, 1); + dup2(DebugFD, 2); + } + i = 0; + argv[i++] = "crunch"; + argv[i++] = "sh"; + argv[i++] = "-c"; + argv[i++] = cmd; + argv[i] = 0; + exit(crunched_main(i,argv)); + } + intsave = signal(SIGINT, SIG_IGN); + quitsave = signal(SIGQUIT, SIG_IGN); + pid = waitpid(pid, (int *)&pstat, 0); + (void)sigsetmask(omask); + (void)signal(SIGINT, intsave); + (void)signal(SIGQUIT, quitsave); + i = (pid == -1) ? -1 : pstat.w_status; + msgDebug("Command `%s' returns status of %d\n", cmd, i); + free(cmd); + return i; +} /* Execute a system command, with varargs */ int -vsystem(char *fmt, ...) +ssystem(char *fmt, ...) { va_list args; union wait pstat; @@ -295,7 +347,7 @@ vsystem(char *fmt, ...) vsnprintf(cmd, FILENAME_MAX, fmt, args); va_end(args); omask = sigblock(sigmask(SIGCHLD)); - msgDebug("Executing command `%s'", cmd); + msgDebug("Executing command `%s'\n", cmd); switch(pid = vfork()) { case -1: /* error */ (void)sigsetmask(omask); |