Change vsystem to know that the shell is crunched in.

Sanitize a couple of messages.
This commit is contained in:
Poul-Henning Kamp 1995-05-20 19:12:13 +00:00
parent 13da1b0612
commit 9f857b511d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8658
9 changed files with 186 additions and 24 deletions

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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);