diff options
author | jkh <jkh@FreeBSD.org> | 1996-07-08 10:08:22 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-07-08 10:08:22 +0000 |
commit | c296a76edd03a39d9aa3bdb44352a886905e3a29 (patch) | |
tree | c59eaf720ed2ae72da1988782279e197cc24983a /usr.sbin | |
parent | 7e51f09a84728ab85cf82db31aad751f4aca98cb (diff) | |
download | FreeBSD-src-c296a76edd03a39d9aa3bdb44352a886905e3a29.zip FreeBSD-src-c296a76edd03a39d9aa3bdb44352a886905e3a29.tar.gz |
Fix even more lurking bogons - why do I never find these until the last
possible minute? :-)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sade/install.c | 4 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 7 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 6 | ||||
-rw-r--r-- | usr.sbin/sysinstall/ftp.c | 12 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/media.c | 24 | ||||
-rw-r--r-- | usr.sbin/sysinstall/network.c | 28 | ||||
-rw-r--r-- | usr.sbin/sysinstall/options.c | 7 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 7 | ||||
-rw-r--r-- | usr.sbin/sysinstall/tcpip.c | 14 |
10 files changed, 47 insertions, 66 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index b08b905..7995ada 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/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.108 1996/07/05 08:35:56 jkh Exp $ + * $Id: install.c,v 1.109 1996/07/08 08:54:27 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -801,8 +801,6 @@ installVarDefaults(dialogMenuItem *self) variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM"); variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx"); variable_set2(VAR_FTP_STATE, "passive"); - variable_set2(VAR_FTP_ONERROR, "abort"); - variable_set2(VAR_FTP_RETRIES, MAX_FTP_RETRIES); variable_set2(VAR_PKG_TMPDIR, "/usr/tmp"); if (getpid() != 1) variable_set2(SYSTEM_STATE, "update"); diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 1cc22ad..c785fc3 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.71 1996/07/05 08:36:00 jkh Exp $ + * $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -58,7 +58,7 @@ #define DEV_NAME_MAX 64 /* The maximum length of a device name */ #define DEV_MAX 100 /* The maximum number of devices we'll deal with */ #define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */ -#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */ +#define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */ /* * I make some pretty gross assumptions about having a max of 50 chunks @@ -90,11 +90,9 @@ #define VAR_EDITOR "editor" #define VAR_EXTRAS "ifconfig_" #define VAR_FTP_DIR "ftpDirectory" -#define VAR_FTP_ONERROR "ftpOnError" #define VAR_FTP_PASS "ftpPass" #define VAR_FTP_PATH "ftp" #define VAR_FTP_PORT "ftpPort" -#define VAR_FTP_RETRIES "ftpRetryCount" #define VAR_FTP_STATE "ftpState" #define VAR_FTP_USER "ftpUser" #define VAR_FTP_HOST "ftpHost" @@ -507,7 +505,6 @@ extern int mediaSetFTPActive(dialogMenuItem *self); extern int mediaSetFTPPassive(dialogMenuItem *self); extern int mediaSetUFS(dialogMenuItem *self); extern int mediaSetNFS(dialogMenuItem *self); -extern int mediaSetFtpOnError(dialogMenuItem *self); extern int mediaSetFtpUserPass(dialogMenuItem *self); extern int mediaSetCPIOVerbosity(dialogMenuItem *self); extern int mediaGetType(dialogMenuItem *self); diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 71de1d0..c3d3a52 100644 --- a/usr.sbin/sysinstall/dist.c +++ b/usr.sbin/sysinstall/dist.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dist.c,v 1.59 1996/06/13 13:45:16 jkh Exp $ + * $Id: dist.c,v 1.60 1996/07/02 01:03:37 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -379,7 +379,7 @@ distExtract(char *parent, Distribution *me) mediaDevice->close(mediaDevice, fd); goto done; } - else if (fd == -2) { /* Hard error, can't continue */ + else if (fd == IO_ERROR) { /* Hard error, can't continue */ mediaDevice->shutdown(mediaDevice); status = FALSE; goto done; @@ -411,7 +411,7 @@ distExtract(char *parent, Distribution *me) safe_free(dist_attr); mediaDevice->close(mediaDevice, fd); } - else if (fd == -2) { /* Hard error, can't continue */ + else if (fd == IO_ERROR) { /* Hard error, can't continue */ mediaDevice->shutdown(mediaDevice); status = FALSE; goto done; diff --git a/usr.sbin/sysinstall/ftp.c b/usr.sbin/sysinstall/ftp.c index 0668416..242a23f 100644 --- a/usr.sbin/sysinstall/ftp.c +++ b/usr.sbin/sysinstall/ftp.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: ftp.c,v 1.15 1995/12/07 10:33:47 peter Exp $ + * $Id: ftp.c,v 1.16 1996/04/28 20:53:56 jkh Exp $ * * Return values have been sanitized: * -1 error, but you (still) have a session. @@ -65,7 +65,7 @@ writes(int fd, char *s) { int i = strlen(s); if (i != write(fd, s, i)) - return -2; + return IO_ERROR; return 0; } @@ -100,7 +100,7 @@ get_a_number(FTP_t ftp, char **q) while(1) { p = get_a_line(ftp); if (!p) - return -2; + return IO_ERROR; if (!(isdigit(p[0]) && isdigit(p[1]) && isdigit(p[2]))) continue; if (i == -1 && p[3] == '-') { @@ -131,14 +131,14 @@ zap(FTP_t ftp) close(ftp->fd_ctrl); ftp->fd_ctrl = -1; close(ftp->fd_xfer); ftp->fd_xfer = -1; ftp->state = init; - return -2; + return IO_ERROR; } static int botch(FTP_t ftp, char *func, char *state) { debug(ftp, "Botch: %s called outside state %s\n",func,state); - return -2; + return IO_ERROR; } static int @@ -155,7 +155,7 @@ cmd(FTP_t ftp, const char *fmt, ...) debug(ftp, "send <%s>\n", p); strcat(p,"\r\n"); if (writes(ftp->fd_ctrl, p)) - return -2; + return IO_ERROR; i = get_a_number(ftp, 0); return i; } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index b08b905..7995ada 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/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.108 1996/07/05 08:35:56 jkh Exp $ + * $Id: install.c,v 1.109 1996/07/08 08:54:27 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -801,8 +801,6 @@ installVarDefaults(dialogMenuItem *self) variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM"); variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx"); variable_set2(VAR_FTP_STATE, "passive"); - variable_set2(VAR_FTP_ONERROR, "abort"); - variable_set2(VAR_FTP_RETRIES, MAX_FTP_RETRIES); variable_set2(VAR_PKG_TMPDIR, "/usr/tmp"); if (getpid() != 1) variable_set2(SYSTEM_STATE, "update"); diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 1d6ed97..58b0f5a 100644 --- a/usr.sbin/sysinstall/media.c +++ b/usr.sbin/sysinstall/media.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: media.c,v 1.45 1996/07/05 08:35:58 jkh Exp $ + * $Id: media.c,v 1.46 1996/07/08 08:54:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -312,6 +312,7 @@ mediaSetFTP(dialogMenuItem *self) if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) { msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n" "name server, gateway and network interface are correctly configured?", hostname); + mediaDevice->shutdown(mediaDevice); return DITEM_FAILURE | DITEM_RECREATE; } variable_set2(VAR_FTP_HOST, hostname); @@ -579,27 +580,6 @@ mediaVerify(void) return TRUE; } -/* Set FTP error behavior */ -int -mediaSetFtpOnError(dialogMenuItem *self) -{ - char *cp = variable_get(VAR_FTP_ONERROR); - - if (!cp) { - msgConfirm("FTP error handling is not set to anything!"); - return DITEM_FAILURE; - } - else { - if (!strcmp(cp, "abort")) - variable_set2(VAR_FTP_ONERROR, "retry"); - else if (!strcmp(cp, "retry")) - variable_set2(VAR_FTP_ONERROR, "reselect"); - else /* must be "reselect" - wrap around */ - variable_set2(VAR_FTP_ONERROR, "abort"); - } - return DITEM_SUCCESS; -} - /* Set the FTP username and password fields */ int mediaSetFtpUserPass(dialogMenuItem *self) diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c index b8ac7d6..55d301d 100644 --- a/usr.sbin/sysinstall/network.c +++ b/usr.sbin/sysinstall/network.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: network.c,v 1.13 1996/06/12 17:09:34 jkh Exp $ + * $Id: network.c,v 1.14 1996/07/08 08:54:30 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -76,6 +76,7 @@ mediaInitNetwork(Device *dev) char *val; char attach[256]; + dialog_clear(); /* Cheesy slip attach */ snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname); val = msgGetInput(attach, @@ -179,6 +180,7 @@ startPPP(Device *devp) Mkdir("/var/spool/lock"); Mkdir("/etc/ppp"); + dialog_clear(); if (!variable_get(VAR_SERIAL_SPEED)) variable_set2(VAR_SERIAL_SPEED, "115200"); /* Get any important user values */ @@ -199,7 +201,10 @@ startPPP(Device *devp) else strcpy(myaddr, "0"); - fp = fopen("/etc/ppp/ppp.linkup", "w"); + if (!Fake) + fp = fopen("/etc/ppp/ppp.linkup", "w"); + else + fp = fopen("/dev/stderr", "w"); if (fp != NULL) { fprintf(fp, "MYADDR:\n"); fprintf(fp, " delete ALL\n"); @@ -207,12 +212,18 @@ startPPP(Device *devp) fchmod(fileno(fp), 0755); fclose(fp); } - fd2 = open("/etc/ppp/ppp.secret", O_CREAT); + if (!Fake) + fd2 = open("/etc/ppp/ppp.secret", O_CREAT); + else + fd2 = -1; if (fd2 != -1) { fchmod(fd2, 0700); close(fd2); } - fp = fopen("/etc/ppp/ppp.conf", "w"); + if (!Fake) + fp = fopen("/etc/ppp/ppp.conf", "w"); + else + fp = fopen("/dev/stderr", "w"); if (!fp) { msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work"); return 0; @@ -223,7 +234,7 @@ startPPP(Device *devp) fprintf(fp, " set ifaddr %s %s\n", myaddr, provider); fclose(fp); - if (!file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) { + if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) { msgConfirm("Warning: No /dev/tun0 device. PPP will not work!"); return 0; } @@ -256,13 +267,14 @@ startPPP(Device *devp) exit(1); } else { - msgConfirm("The PPP command is now started on VTY3 (type ALT-F3 to\n" + msgConfirm("NOTICE: The PPP command is now started on VTY3 (type ALT-F3 to\n" "interact with it, ALT-F1 to switch back here). The only command\n" "you'll probably want or need to use is the \"term\" command\n" "which starts a terminal emulator you can use to talk to your\n" "modem and dial the service provider. Once you're connected,\n" - "come back to this screen and press return. DO NOT PRESS [ENTER]\n" - "HERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!"); + "come back to this screen and press return.\n\n" + "DO NOT PRESS [ENTER] HERE UNTIL THE CONNECTION IS FULLY\n" + "ESTABLISHED!"); } return pid; } diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c index 3135e17..94933fe 100644 --- a/usr.sbin/sysinstall/options.c +++ b/usr.sbin/sysinstall/options.c @@ -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: options.c,v 1.38 1996/06/08 09:08:45 jkh Exp $ + * $Id: options.c,v 1.39 1996/06/14 14:33:58 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -98,7 +98,6 @@ mediaCheck(Option opt) #define BPKG_PROMPT "Please specify the name of the HTML browser package:" #define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:" #define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:" -#define RETRY_PROMPT "Please specify the number of times to retry an FTP request:" #define PKG_PROMPT "Please specify a temporary directory with lots of free space:" static Option Options[] = { @@ -110,10 +109,6 @@ static Option Options[] = { OPT_IS_VAR, NULL, VAR_DEBUG, varCheck }, { "Yes to All", "Assume \"Yes\" answers to all non-critical dialogs", OPT_IS_VAR, NULL, VAR_NO_CONFIRM, varCheck }, -{ "FTP OnError", "What to do when FTP requests fail: abort, retry, reselect.", - OPT_IS_FUNC, mediaSetFtpOnError, VAR_FTP_ONERROR, varCheck }, -{ "FTP Retries", "If FTP OnError == retry, this is the number of times to try.", - OPT_IS_VAR, RETRY_PROMPT, VAR_FTP_RETRIES, varCheck }, { "FTP username", "Username and password to use instead of anonymous", OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck }, { "Editor", "Which text editor to use during installation", diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 1cc22ad..c785fc3 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.71 1996/07/05 08:36:00 jkh Exp $ + * $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -58,7 +58,7 @@ #define DEV_NAME_MAX 64 /* The maximum length of a device name */ #define DEV_MAX 100 /* The maximum number of devices we'll deal with */ #define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */ -#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */ +#define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */ /* * I make some pretty gross assumptions about having a max of 50 chunks @@ -90,11 +90,9 @@ #define VAR_EDITOR "editor" #define VAR_EXTRAS "ifconfig_" #define VAR_FTP_DIR "ftpDirectory" -#define VAR_FTP_ONERROR "ftpOnError" #define VAR_FTP_PASS "ftpPass" #define VAR_FTP_PATH "ftp" #define VAR_FTP_PORT "ftpPort" -#define VAR_FTP_RETRIES "ftpRetryCount" #define VAR_FTP_STATE "ftpState" #define VAR_FTP_USER "ftpUser" #define VAR_FTP_HOST "ftpHost" @@ -507,7 +505,6 @@ extern int mediaSetFTPActive(dialogMenuItem *self); extern int mediaSetFTPPassive(dialogMenuItem *self); extern int mediaSetUFS(dialogMenuItem *self); extern int mediaSetNFS(dialogMenuItem *self); -extern int mediaSetFtpOnError(dialogMenuItem *self); extern int mediaSetFtpUserPass(dialogMenuItem *self); extern int mediaSetCPIOVerbosity(dialogMenuItem *self); extern int mediaGetType(dialogMenuItem *self); diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c index 8b53324..b84cb30 100644 --- a/usr.sbin/sysinstall/tcpip.c +++ b/usr.sbin/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.42 1996/06/17 23:04:24 jkh Exp $ + * $Id: tcpip.c,v 1.43 1996/07/02 01:03:55 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -522,8 +522,10 @@ netHook(dialogMenuItem *self) devs = deviceFind(self->prompt, DEVICE_TYPE_NETWORK); if (devs) { - tcpOpenDialog(devs[0]); - mediaDevice = devs[0]; + if (DITEM_STATUS(tcpOpenDialog(devs[0])) != DITEM_FAILURE) + mediaDevice = devs[0]; + else + devs = NULL; } return devs ? DITEM_LEAVE_MENU : DITEM_FAILURE; } @@ -545,8 +547,10 @@ tcpDeviceSelect(void) } else if (cnt == 1 || (!RunningAsInit && !Fake)) { /* If we're running in user mode, assume network already up */ - if (RunningAsInit) - tcpOpenDialog(devs[0]); + if (RunningAsInit) { + if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_FAILURE)) + return FALSE; + } else msgDebug("Running multi-user, assuming that the network is already up\n"); mediaDevice = devs[0]; |