diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-06-13 17:07:41 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-06-13 17:07:41 +0000 |
| commit | 0447d04bb09af56e143cc97cf2024e62a1ef831b (patch) | |
| tree | c152efd16644a6609ea1e3f432244cd4c199e407 | |
| parent | 6104d72491cd4712a1c153c4fdbb6ad3c68c36e2 (diff) | |
Notes
| -rw-r--r-- | release/sysinstall/devices.c | 71 | ||||
| -rw-r--r-- | release/sysinstall/menus.c | 15 | ||||
| -rw-r--r-- | release/sysinstall/tcpip.c | 4 | ||||
| -rw-r--r-- | usr.sbin/sade/devices.c | 71 | ||||
| -rw-r--r-- | usr.sbin/sade/menus.c | 15 | ||||
| -rw-r--r-- | usr.sbin/sysinstall/devices.c | 71 | ||||
| -rw-r--r-- | usr.sbin/sysinstall/menus.c | 15 | ||||
| -rw-r--r-- | usr.sbin/sysinstall/tcpip.c | 4 |
8 files changed, 157 insertions, 109 deletions
diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c index 7b6d2f358de1..be307e26c4e9 100644 --- a/release/sysinstall/devices.c +++ b/release/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.45 1996/04/23 01:29:12 jkh Exp $ + * $Id: devices.c,v 1.46 1996/06/12 17:09:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -70,10 +70,10 @@ static struct { { DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" }, { DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" }, { DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" }, - { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa2", "Serial port (COM3) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa3", "Serial port (COM4) configured as %s device" }, + { DEVICE_TYPE_NETWORK, "cuaa0", "%s on serial port 0 (COM1)" }, + { DEVICE_TYPE_NETWORK, "cuaa1", "%s on serial port 1 (COM2)" }, + { DEVICE_TYPE_NETWORK, "cuaa2", "%s on serial port 2 (COM3)" }, + { DEVICE_TYPE_NETWORK, "cuaa3", "%s on serial port 3 (COM4)" }, { DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" }, { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" }, { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" }, @@ -154,21 +154,10 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e Boolean (*init)(Device *), int (*get)(Device *, char *, Boolean), Boolean (*close)(Device *, int), void (*shutdown)(Device *), void *private) { - Device *newdev; + Device *newdev = NULL; if (numDevs == DEV_MAX) msgFatal("Too many devices found!"); - if (!strncmp("cuaa", name, 4)) { - char *newdesc; - - /* Serial devices get a slip and ppp device each - trap here and special case the registration */ - newdesc = safe_malloc(strlen(desc) + 5); - sprintf(newdesc, desc, "sl0"); - (void)deviceRegister("sl0", newdesc, devname, type, enabled, init, get, close, shutdown, private); - newdesc = safe_malloc(strlen(desc) + 5); - sprintf(newdesc, desc, "ppp0"); - newdev = deviceRegister("ppp0", newdesc, devname, type, enabled, init, get, close, shutdown, private); - } else { newdev = new_device(name); newdev->description = desc; @@ -272,11 +261,23 @@ deviceGetAll(void) case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i].name, try); + /* The only network devices that you can open this way are serial ones */ if (fd >= 0) { - if (fd) close(fd); - /* The only network devices that have fds associated are serial ones */ - deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_NETWORK, - TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); + char *newdesc, *cp; + + if (fd) + close(fd); + + /* Serial devices get a slip and ppp device each */ + cp = device_names[i].description; + newdesc = safe_malloc(strlen(cp) + 40); + sprintf(newdesc, cp, "SLIP interface"); + deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, NULL, mediaShutdownNetwork, NULL); + newdesc = safe_malloc(strlen(cp) + 50); + sprintf(newdesc, cp, "PPP interface"); + deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, NULL, mediaShutdownNetwork, NULL); msgDebug("Found a device of type network named: %s\n", device_names[i].name); } break; @@ -302,6 +303,8 @@ deviceGetAll(void) ifflags = ifc.ifc_req->ifr_flags; end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { + char *descr; + /* If it's not a link entry, forget it */ if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) continue; @@ -309,7 +312,18 @@ deviceGetAll(void) if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) continue; - deviceRegister(ifptr->ifr_name, ifptr->ifr_name, ifptr->ifr_name, DEVICE_TYPE_NETWORK, TRUE, + descr = NULL; + for (i = 0; device_names[i].name; i++) { + int len = strlen(device_names[i].name); + + if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { + descr = device_names[i].description; + break; + } + } + if (!descr) + descr = "<unknown network interface type>"; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); close(s); @@ -367,21 +381,20 @@ deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), i int i, j; devs = deviceFind(NULL, type); - if (!devs) + numdevs = deviceCount(devs); + if (!numdevs) return NULL; - - for (numdevs = 0; devs[numdevs]; numdevs++); tmp = (DMenu *)safe_malloc(sizeof(DMenu) + (sizeof(dialogMenuItem) * (numdevs + 1))); bcopy(menu, tmp, sizeof(DMenu)); for (i = 0; devs[i]; i++) { tmp->items[i].prompt = devs[i]->name; - for (j = 0; device_names[j].name; j++) { - if (!strncmp(devs[i]->name, device_names[j].name, strlen(device_names[j].name))) { - tmp->items[i].title = device_names[j].description; + for (j = 0; j < numDevs; j++) { + if (devs[i] == Devices[j]) { + tmp->items[i].title = Devices[j]->description; break; } } - if (!device_names[j].name) + if (j == numDevs) tmp->items[i].title = "<unknown device type>"; tmp->items[i].fire = hook; tmp->items[i].checked = check; diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index b6651ec62194..ec43b9acc7bc 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/menus.c @@ -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.65 1996/06/12 14:20:18 jkh Exp $ + * $Id: menus.c,v 1.66 1996/06/12 17:09:32 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -122,34 +122,37 @@ clearX11Fonts(dialogMenuItem *self) return DITEM_SUCCESS | DITEM_REDRAW; } +#define IS_DEVELOPER(dist, extra) (((dist) == (_DIST_DEVELOPER | (extra))) || ((dist) == (_DIST_DEVELOPER | DIST_DES | (extra)))) +#define IS_USER(dist, extra) (((dist) == (_DIST_USER | (extra))) || ((dist) == (_DIST_USER | DIST_DES | (extra)))) + static int checkDistDeveloper(dialogMenuItem *self) { - return (Dists == _DIST_DEVELOPER && SrcDists == DIST_SRC_ALL); + return (IS_DEVELOPER(Dists, 0) && SrcDists == DIST_SRC_ALL); } static int checkDistXDeveloper(dialogMenuItem *self) { - return (Dists == (_DIST_DEVELOPER | DIST_XF86) && SrcDists == DIST_SRC_ALL); + return (IS_DEVELOPER(Dists, DIST_XF86) && SrcDists == DIST_SRC_ALL); } static int checkDistKernDeveloper(dialogMenuItem *self) { - return (Dists == _DIST_DEVELOPER && SrcDists == DIST_SRC_SYS); + return (IS_DEVELOPER(Dists, 0) && SrcDists == DIST_SRC_SYS); } static int checkDistUser(dialogMenuItem *self) { - return (Dists == _DIST_USER); + return (IS_USER(Dists, 0)); } static int checkDistXUser(dialogMenuItem *self) { - return (Dists == (_DIST_USER | DIST_XF86)); + return (IS_USER(Dists, DIST_XF86)); } static int diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c index d9c522f2664f..6094813d0c90 100644 --- a/release/sysinstall/tcpip.c +++ b/release/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.39 1996/05/21 15:57:21 jkh Exp $ + * $Id: tcpip.c,v 1.40 1996/06/12 17:09:34 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -542,7 +542,7 @@ tcpDeviceSelect(void) msgConfirm("No network devices available!"); status = FALSE; } - else if (cnt == 1 || !RunningAsInit) { + else if (cnt == 1 || (!RunningAsInit && !Fake)) { /* If we're running in user mode, assume network already up */ if (RunningAsInit) tcpOpenDialog(devs[0]); diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c index 7b6d2f358de1..be307e26c4e9 100644 --- a/usr.sbin/sade/devices.c +++ b/usr.sbin/sade/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.45 1996/04/23 01:29:12 jkh Exp $ + * $Id: devices.c,v 1.46 1996/06/12 17:09:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -70,10 +70,10 @@ static struct { { DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" }, { DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" }, { DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" }, - { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa2", "Serial port (COM3) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa3", "Serial port (COM4) configured as %s device" }, + { DEVICE_TYPE_NETWORK, "cuaa0", "%s on serial port 0 (COM1)" }, + { DEVICE_TYPE_NETWORK, "cuaa1", "%s on serial port 1 (COM2)" }, + { DEVICE_TYPE_NETWORK, "cuaa2", "%s on serial port 2 (COM3)" }, + { DEVICE_TYPE_NETWORK, "cuaa3", "%s on serial port 3 (COM4)" }, { DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" }, { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" }, { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" }, @@ -154,21 +154,10 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e Boolean (*init)(Device *), int (*get)(Device *, char *, Boolean), Boolean (*close)(Device *, int), void (*shutdown)(Device *), void *private) { - Device *newdev; + Device *newdev = NULL; if (numDevs == DEV_MAX) msgFatal("Too many devices found!"); - if (!strncmp("cuaa", name, 4)) { - char *newdesc; - - /* Serial devices get a slip and ppp device each - trap here and special case the registration */ - newdesc = safe_malloc(strlen(desc) + 5); - sprintf(newdesc, desc, "sl0"); - (void)deviceRegister("sl0", newdesc, devname, type, enabled, init, get, close, shutdown, private); - newdesc = safe_malloc(strlen(desc) + 5); - sprintf(newdesc, desc, "ppp0"); - newdev = deviceRegister("ppp0", newdesc, devname, type, enabled, init, get, close, shutdown, private); - } else { newdev = new_device(name); newdev->description = desc; @@ -272,11 +261,23 @@ deviceGetAll(void) case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i].name, try); + /* The only network devices that you can open this way are serial ones */ if (fd >= 0) { - if (fd) close(fd); - /* The only network devices that have fds associated are serial ones */ - deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_NETWORK, - TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); + char *newdesc, *cp; + + if (fd) + close(fd); + + /* Serial devices get a slip and ppp device each */ + cp = device_names[i].description; + newdesc = safe_malloc(strlen(cp) + 40); + sprintf(newdesc, cp, "SLIP interface"); + deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, NULL, mediaShutdownNetwork, NULL); + newdesc = safe_malloc(strlen(cp) + 50); + sprintf(newdesc, cp, "PPP interface"); + deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, NULL, mediaShutdownNetwork, NULL); msgDebug("Found a device of type network named: %s\n", device_names[i].name); } break; @@ -302,6 +303,8 @@ deviceGetAll(void) ifflags = ifc.ifc_req->ifr_flags; end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { + char *descr; + /* If it's not a link entry, forget it */ if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) continue; @@ -309,7 +312,18 @@ deviceGetAll(void) if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) continue; - deviceRegister(ifptr->ifr_name, ifptr->ifr_name, ifptr->ifr_name, DEVICE_TYPE_NETWORK, TRUE, + descr = NULL; + for (i = 0; device_names[i].name; i++) { + int len = strlen(device_names[i].name); + + if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { + descr = device_names[i].description; + break; + } + } + if (!descr) + descr = "<unknown network interface type>"; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); close(s); @@ -367,21 +381,20 @@ deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), i int i, j; devs = deviceFind(NULL, type); - if (!devs) + numdevs = deviceCount(devs); + if (!numdevs) return NULL; - - for (numdevs = 0; devs[numdevs]; numdevs++); tmp = (DMenu *)safe_malloc(sizeof(DMenu) + (sizeof(dialogMenuItem) * (numdevs + 1))); bcopy(menu, tmp, sizeof(DMenu)); for (i = 0; devs[i]; i++) { tmp->items[i].prompt = devs[i]->name; - for (j = 0; device_names[j].name; j++) { - if (!strncmp(devs[i]->name, device_names[j].name, strlen(device_names[j].name))) { - tmp->items[i].title = device_names[j].description; + for (j = 0; j < numDevs; j++) { + if (devs[i] == Devices[j]) { + tmp->items[i].title = Devices[j]->description; break; } } - if (!device_names[j].name) + if (j == numDevs) tmp->items[i].title = "<unknown device type>"; tmp->items[i].fire = hook; tmp->items[i].checked = check; diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index b6651ec62194..ec43b9acc7bc 100644 --- a/usr.sbin/sade/menus.c +++ b/usr.sbin/sade/menus.c @@ -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.65 1996/06/12 14:20:18 jkh Exp $ + * $Id: menus.c,v 1.66 1996/06/12 17:09:32 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -122,34 +122,37 @@ clearX11Fonts(dialogMenuItem *self) return DITEM_SUCCESS | DITEM_REDRAW; } +#define IS_DEVELOPER(dist, extra) (((dist) == (_DIST_DEVELOPER | (extra))) || ((dist) == (_DIST_DEVELOPER | DIST_DES | (extra)))) +#define IS_USER(dist, extra) (((dist) == (_DIST_USER | (extra))) || ((dist) == (_DIST_USER | DIST_DES | (extra)))) + static int checkDistDeveloper(dialogMenuItem *self) { - return (Dists == _DIST_DEVELOPER && SrcDists == DIST_SRC_ALL); + return (IS_DEVELOPER(Dists, 0) && SrcDists == DIST_SRC_ALL); } static int checkDistXDeveloper(dialogMenuItem *self) { - return (Dists == (_DIST_DEVELOPER | DIST_XF86) && SrcDists == DIST_SRC_ALL); + return (IS_DEVELOPER(Dists, DIST_XF86) && SrcDists == DIST_SRC_ALL); } static int checkDistKernDeveloper(dialogMenuItem *self) { - return (Dists == _DIST_DEVELOPER && SrcDists == DIST_SRC_SYS); + return (IS_DEVELOPER(Dists, 0) && SrcDists == DIST_SRC_SYS); } static int checkDistUser(dialogMenuItem *self) { - return (Dists == _DIST_USER); + return (IS_USER(Dists, 0)); } static int checkDistXUser(dialogMenuItem *self) { - return (Dists == (_DIST_USER | DIST_XF86)); + return (IS_USER(Dists, DIST_XF86)); } static int diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index 7b6d2f358de1..be307e26c4e9 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.45 1996/04/23 01:29:12 jkh Exp $ + * $Id: devices.c,v 1.46 1996/06/12 17:09:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -70,10 +70,10 @@ static struct { { DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" }, { DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" }, { DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" }, - { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa2", "Serial port (COM3) configured as %s device" }, - { DEVICE_TYPE_NETWORK, "cuaa3", "Serial port (COM4) configured as %s device" }, + { DEVICE_TYPE_NETWORK, "cuaa0", "%s on serial port 0 (COM1)" }, + { DEVICE_TYPE_NETWORK, "cuaa1", "%s on serial port 1 (COM2)" }, + { DEVICE_TYPE_NETWORK, "cuaa2", "%s on serial port 2 (COM3)" }, + { DEVICE_TYPE_NETWORK, "cuaa3", "%s on serial port 3 (COM4)" }, { DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" }, { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" }, { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" }, @@ -154,21 +154,10 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e Boolean (*init)(Device *), int (*get)(Device *, char *, Boolean), Boolean (*close)(Device *, int), void (*shutdown)(Device *), void *private) { - Device *newdev; + Device *newdev = NULL; if (numDevs == DEV_MAX) msgFatal("Too many devices found!"); - if (!strncmp("cuaa", name, 4)) { - char *newdesc; - - /* Serial devices get a slip and ppp device each - trap here and special case the registration */ - newdesc = safe_malloc(strlen(desc) + 5); - sprintf(newdesc, desc, "sl0"); - (void)deviceRegister("sl0", newdesc, devname, type, enabled, init, get, close, shutdown, private); - newdesc = safe_malloc(strlen(desc) + 5); - sprintf(newdesc, desc, "ppp0"); - newdev = deviceRegister("ppp0", newdesc, devname, type, enabled, init, get, close, shutdown, private); - } else { newdev = new_device(name); newdev->description = desc; @@ -272,11 +261,23 @@ deviceGetAll(void) case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i].name, try); + /* The only network devices that you can open this way are serial ones */ if (fd >= 0) { - if (fd) close(fd); - /* The only network devices that have fds associated are serial ones */ - deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_NETWORK, - TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); + char *newdesc, *cp; + + if (fd) + close(fd); + + /* Serial devices get a slip and ppp device each */ + cp = device_names[i].description; + newdesc = safe_malloc(strlen(cp) + 40); + sprintf(newdesc, cp, "SLIP interface"); + deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, NULL, mediaShutdownNetwork, NULL); + newdesc = safe_malloc(strlen(cp) + 50); + sprintf(newdesc, cp, "PPP interface"); + deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, NULL, mediaShutdownNetwork, NULL); msgDebug("Found a device of type network named: %s\n", device_names[i].name); } break; @@ -302,6 +303,8 @@ deviceGetAll(void) ifflags = ifc.ifc_req->ifr_flags; end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { + char *descr; + /* If it's not a link entry, forget it */ if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) continue; @@ -309,7 +312,18 @@ deviceGetAll(void) if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) continue; - deviceRegister(ifptr->ifr_name, ifptr->ifr_name, ifptr->ifr_name, DEVICE_TYPE_NETWORK, TRUE, + descr = NULL; + for (i = 0; device_names[i].name; i++) { + int len = strlen(device_names[i].name); + + if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { + descr = device_names[i].description; + break; + } + } + if (!descr) + descr = "<unknown network interface type>"; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); close(s); @@ -367,21 +381,20 @@ deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), i int i, j; devs = deviceFind(NULL, type); - if (!devs) + numdevs = deviceCount(devs); + if (!numdevs) return NULL; - - for (numdevs = 0; devs[numdevs]; numdevs++); tmp = (DMenu *)safe_malloc(sizeof(DMenu) + (sizeof(dialogMenuItem) * (numdevs + 1))); bcopy(menu, tmp, sizeof(DMenu)); for (i = 0; devs[i]; i++) { tmp->items[i].prompt = devs[i]->name; - for (j = 0; device_names[j].name; j++) { - if (!strncmp(devs[i]->name, device_names[j].name, strlen(device_names[j].name))) { - tmp->items[i].title = device_names[j].description; + for (j = 0; j < numDevs; j++) { + if (devs[i] == Devices[j]) { + tmp->items[i].title = Devices[j]->description; break; } } - if (!device_names[j].name) + if (j == numDevs) tmp->items[i].title = "<unknown device type>"; tmp->items[i].fire = hook; tmp->items[i].checked = check; diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index b6651ec62194..ec43b9acc7bc 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -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.65 1996/06/12 14:20:18 jkh Exp $ + * $Id: menus.c,v 1.66 1996/06/12 17:09:32 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -122,34 +122,37 @@ clearX11Fonts(dialogMenuItem *self) return DITEM_SUCCESS | DITEM_REDRAW; } +#define IS_DEVELOPER(dist, extra) (((dist) == (_DIST_DEVELOPER | (extra))) || ((dist) == (_DIST_DEVELOPER | DIST_DES | (extra)))) +#define IS_USER(dist, extra) (((dist) == (_DIST_USER | (extra))) || ((dist) == (_DIST_USER | DIST_DES | (extra)))) + static int checkDistDeveloper(dialogMenuItem *self) { - return (Dists == _DIST_DEVELOPER && SrcDists == DIST_SRC_ALL); + return (IS_DEVELOPER(Dists, 0) && SrcDists == DIST_SRC_ALL); } static int checkDistXDeveloper(dialogMenuItem *self) { - return (Dists == (_DIST_DEVELOPER | DIST_XF86) && SrcDists == DIST_SRC_ALL); + return (IS_DEVELOPER(Dists, DIST_XF86) && SrcDists == DIST_SRC_ALL); } static int checkDistKernDeveloper(dialogMenuItem *self) { - return (Dists == _DIST_DEVELOPER && SrcDists == DIST_SRC_SYS); + return (IS_DEVELOPER(Dists, 0) && SrcDists == DIST_SRC_SYS); } static int checkDistUser(dialogMenuItem *self) { - return (Dists == _DIST_USER); + return (IS_USER(Dists, 0)); } static int checkDistXUser(dialogMenuItem *self) { - return (Dists == (_DIST_USER | DIST_XF86)); + return (IS_USER(Dists, DIST_XF86)); } static int diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c index d9c522f2664f..6094813d0c90 100644 --- a/usr.sbin/sysinstall/tcpip.c +++ b/usr.sbin/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.39 1996/05/21 15:57:21 jkh Exp $ + * $Id: tcpip.c,v 1.40 1996/06/12 17:09:34 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -542,7 +542,7 @@ tcpDeviceSelect(void) msgConfirm("No network devices available!"); status = FALSE; } - else if (cnt == 1 || !RunningAsInit) { + else if (cnt == 1 || (!RunningAsInit && !Fake)) { /* If we're running in user mode, assume network already up */ if (RunningAsInit) tcpOpenDialog(devs[0]); |
