mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
Allow argv[0] to be a command also.
This commit is contained in:
parent
082257e043
commit
0006fae5d6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16766
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dispatch.c,v 1.1 1996/05/16 11:47:27 jkh Exp $
|
||||
* $Id: dispatch.c,v 1.2 1996/06/08 09:08:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -107,12 +107,16 @@ int
|
||||
dispatchCommand(char *str)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
|
||||
if (!str || !*str) {
|
||||
msgConfirm("Null or zero-length string passed to dispatchCommand");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else if (index(str, '=')) {
|
||||
/* A command might be a pathname if it's encoded in argv[0], as we also support */
|
||||
if ((cp = index(str, '/')) != NULL)
|
||||
str = cp + 1;
|
||||
if (index(str, '=')) {
|
||||
variable_set(str);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.20 1996/05/28 18:30:30 jkh Exp $
|
||||
* $Id: main.c,v 1.21 1996/06/08 07:02:20 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -42,7 +42,10 @@ static void
|
||||
screech(int sig)
|
||||
{
|
||||
fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig);
|
||||
pause();
|
||||
if (RunningAsInit)
|
||||
pause();
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
@ -89,14 +92,21 @@ main(int argc, char **argv)
|
||||
if (!mediaDevice->init(mediaDevice))
|
||||
mediaDevice = NULL;
|
||||
}
|
||||
if (argc > 1 && !RunningAsInit) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
/* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */
|
||||
if (!RunningAsInit) {
|
||||
int i, start_arg;
|
||||
|
||||
if (!strstr(argv[0], "sysinstall"))
|
||||
start_arg = 0;
|
||||
else
|
||||
start_arg = 1;
|
||||
for (i = start_arg; i < argc; i++) {
|
||||
if (DITEM_STATUS(dispatchCommand(argv[i])) != DITEM_SUCCESS)
|
||||
systemShutdown(1);
|
||||
}
|
||||
systemShutdown(0);
|
||||
}
|
||||
if (argc > start_arg)
|
||||
systemShutdown(0);
|
||||
}
|
||||
|
||||
/* Begin user dialog at outer menu */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: menus.c,v 1.70 1996/06/17 19:31:34 jkh Exp $
|
||||
* $Id: menus.c,v 1.71 1996/06/17 19:33:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -240,7 +240,7 @@ DMenu MenuIndex = {
|
||||
{ "Install, Express", "An express system installation.", NULL, installExpress },
|
||||
{ "Install, Custom", "The custom installation menu", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
|
||||
{ "Label", "The disk Label editor", NULL, diskLabelEditor },
|
||||
{ "Media, All", "Top level media selection menu.", NULL, dmenuSubmenu, NULL, &MenuMedia },
|
||||
{ "Media", "Top level media selection menu.", NULL, dmenuSubmenu, NULL, &MenuMedia },
|
||||
{ "Media, Tape", "Select tape installation media.", NULL, mediaSetTape },
|
||||
{ "Media, NFS", "Select NFS installation media.", NULL, mediaSetNFS },
|
||||
{ "Media, Floppy", "Select floppy installation media.", NULL, mediaSetFloppy },
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dispatch.c,v 1.1 1996/05/16 11:47:27 jkh Exp $
|
||||
* $Id: dispatch.c,v 1.2 1996/06/08 09:08:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -107,12 +107,16 @@ int
|
||||
dispatchCommand(char *str)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
|
||||
if (!str || !*str) {
|
||||
msgConfirm("Null or zero-length string passed to dispatchCommand");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else if (index(str, '=')) {
|
||||
/* A command might be a pathname if it's encoded in argv[0], as we also support */
|
||||
if ((cp = index(str, '/')) != NULL)
|
||||
str = cp + 1;
|
||||
if (index(str, '=')) {
|
||||
variable_set(str);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.20 1996/05/28 18:30:30 jkh Exp $
|
||||
* $Id: main.c,v 1.21 1996/06/08 07:02:20 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -42,7 +42,10 @@ static void
|
||||
screech(int sig)
|
||||
{
|
||||
fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig);
|
||||
pause();
|
||||
if (RunningAsInit)
|
||||
pause();
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
@ -89,14 +92,21 @@ main(int argc, char **argv)
|
||||
if (!mediaDevice->init(mediaDevice))
|
||||
mediaDevice = NULL;
|
||||
}
|
||||
if (argc > 1 && !RunningAsInit) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
/* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */
|
||||
if (!RunningAsInit) {
|
||||
int i, start_arg;
|
||||
|
||||
if (!strstr(argv[0], "sysinstall"))
|
||||
start_arg = 0;
|
||||
else
|
||||
start_arg = 1;
|
||||
for (i = start_arg; i < argc; i++) {
|
||||
if (DITEM_STATUS(dispatchCommand(argv[i])) != DITEM_SUCCESS)
|
||||
systemShutdown(1);
|
||||
}
|
||||
systemShutdown(0);
|
||||
}
|
||||
if (argc > start_arg)
|
||||
systemShutdown(0);
|
||||
}
|
||||
|
||||
/* Begin user dialog at outer menu */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: menus.c,v 1.70 1996/06/17 19:31:34 jkh Exp $
|
||||
* $Id: menus.c,v 1.71 1996/06/17 19:33:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -240,7 +240,7 @@ DMenu MenuIndex = {
|
||||
{ "Install, Express", "An express system installation.", NULL, installExpress },
|
||||
{ "Install, Custom", "The custom installation menu", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
|
||||
{ "Label", "The disk Label editor", NULL, diskLabelEditor },
|
||||
{ "Media, All", "Top level media selection menu.", NULL, dmenuSubmenu, NULL, &MenuMedia },
|
||||
{ "Media", "Top level media selection menu.", NULL, dmenuSubmenu, NULL, &MenuMedia },
|
||||
{ "Media, Tape", "Select tape installation media.", NULL, mediaSetTape },
|
||||
{ "Media, NFS", "Select NFS installation media.", NULL, mediaSetNFS },
|
||||
{ "Media, Floppy", "Select floppy installation media.", NULL, mediaSetFloppy },
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dispatch.c,v 1.1 1996/05/16 11:47:27 jkh Exp $
|
||||
* $Id: dispatch.c,v 1.2 1996/06/08 09:08:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -107,12 +107,16 @@ int
|
||||
dispatchCommand(char *str)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
|
||||
if (!str || !*str) {
|
||||
msgConfirm("Null or zero-length string passed to dispatchCommand");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else if (index(str, '=')) {
|
||||
/* A command might be a pathname if it's encoded in argv[0], as we also support */
|
||||
if ((cp = index(str, '/')) != NULL)
|
||||
str = cp + 1;
|
||||
if (index(str, '=')) {
|
||||
variable_set(str);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.20 1996/05/28 18:30:30 jkh Exp $
|
||||
* $Id: main.c,v 1.21 1996/06/08 07:02:20 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -42,7 +42,10 @@ static void
|
||||
screech(int sig)
|
||||
{
|
||||
fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig);
|
||||
pause();
|
||||
if (RunningAsInit)
|
||||
pause();
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
@ -89,14 +92,21 @@ main(int argc, char **argv)
|
||||
if (!mediaDevice->init(mediaDevice))
|
||||
mediaDevice = NULL;
|
||||
}
|
||||
if (argc > 1 && !RunningAsInit) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
/* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */
|
||||
if (!RunningAsInit) {
|
||||
int i, start_arg;
|
||||
|
||||
if (!strstr(argv[0], "sysinstall"))
|
||||
start_arg = 0;
|
||||
else
|
||||
start_arg = 1;
|
||||
for (i = start_arg; i < argc; i++) {
|
||||
if (DITEM_STATUS(dispatchCommand(argv[i])) != DITEM_SUCCESS)
|
||||
systemShutdown(1);
|
||||
}
|
||||
systemShutdown(0);
|
||||
}
|
||||
if (argc > start_arg)
|
||||
systemShutdown(0);
|
||||
}
|
||||
|
||||
/* Begin user dialog at outer menu */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: menus.c,v 1.70 1996/06/17 19:31:34 jkh Exp $
|
||||
* $Id: menus.c,v 1.71 1996/06/17 19:33:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -240,7 +240,7 @@ DMenu MenuIndex = {
|
||||
{ "Install, Express", "An express system installation.", NULL, installExpress },
|
||||
{ "Install, Custom", "The custom installation menu", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
|
||||
{ "Label", "The disk Label editor", NULL, diskLabelEditor },
|
||||
{ "Media, All", "Top level media selection menu.", NULL, dmenuSubmenu, NULL, &MenuMedia },
|
||||
{ "Media", "Top level media selection menu.", NULL, dmenuSubmenu, NULL, &MenuMedia },
|
||||
{ "Media, Tape", "Select tape installation media.", NULL, mediaSetTape },
|
||||
{ "Media, NFS", "Select NFS installation media.", NULL, mediaSetNFS },
|
||||
{ "Media, Floppy", "Select floppy installation media.", NULL, mediaSetFloppy },
|
||||
|
Loading…
Reference in New Issue
Block a user