Too many bugs fixed to mention. This code just seems to BREED them.

Many interfaces were also simplified or generally cleaned up in an
attempt to curb this problem.
This commit is contained in:
jkh 1995-10-20 07:02:53 +00:00
parent 8f4e7cd8bb
commit b1d7bc8c3f
5 changed files with 71 additions and 51 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: index.c,v 1.9 1995/10/16 09:25:13 jkh Exp $
* $Id: index.c,v 1.10 1995/10/16 15:14:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -60,8 +60,7 @@ _strdup(char *ptr)
}
static char *descrs[] = {
"Package Selection",
"To select a package or category, move to it and press SPACE.\n"
"Package Selection", "To select a package or category, move to it and press SPACE.\n"
"To remove a package from consideration, press SPACE again.\n"
"To go to a previous menu, select UP item or Cancel. To search\n"
"for a package by name, press ESC.",
@ -126,13 +125,8 @@ fetch_desc(char *name)
static PkgNodePtr
new_pkg_node(char *name, node_type type)
{
PkgNodePtr tmp = malloc(sizeof(PkgNode));
PkgNodePtr tmp = safe_malloc(sizeof(PkgNode));
if (!tmp) {
fprintf(stderr, "Out of memory - unable to allocate a new package node!\n");
exit(1);
}
bzero(tmp, sizeof(PkgNode));
tmp->name = _strdup(name);
tmp->type = type;
return tmp;
@ -141,14 +135,8 @@ new_pkg_node(char *name, node_type type)
static IndexEntryPtr
new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint)
{
IndexEntryPtr tmp = malloc(sizeof(IndexEntry));
IndexEntryPtr tmp = safe_malloc(sizeof(IndexEntry));
if (!tmp) {
fprintf(stderr, "Out of memory - unable to allocate a new index node!\n");
exit(1);
}
bzero(tmp, sizeof(IndexEntry));
tmp->name = _strdup(name);
tmp->path = _strdup(pathto);
tmp->prefix = _strdup(prefix);
@ -163,8 +151,14 @@ strchop(char *s1, char *s2, int len)
{
int len2;
len2 = strlen(s1);
if (len2 >= len) {
if (!s1)
return s1;
if (!s2) {
s1[0] = '\0';
return s1;
}
len2 = strlen(s2);
if (len2 > len) {
strncpy(s1, s2, len - 1);
s1[len] = '\0';
}

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.71.2.38 1995/10/18 05:01:55 jkh Exp $
* $Id: installFinal.c,v 1.1 1995/10/19 16:15:39 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard & Coranth Gryphon. All rights reserved.
@ -52,6 +52,13 @@
#include <unistd.h>
#include <sys/mount.h>
/* place-holder for now */
int
installApache(void)
{
return RET_SUCCESS;
}
static DMenu MenuSamba = {
DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
"Samba Services Menu",
@ -75,7 +82,6 @@ static DMenu MenuSamba = {
#define SMB_CONF "./smb.conf"
#define APACHE_WEBDIR "/usr/local/www/pages"
/* Do any final optional hackery */
int
@ -121,7 +127,7 @@ installFinal(void)
/* Set this machine up as a web server? */
if (variable_get("apache_httpd")) {
/* Load and configure the Apache HTTPD web server */
i = installApache();
}
/* Set this machine up as a Samba server? */

View File

@ -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.14 1995/10/19 15:55:20 jkh Exp $
* $Id: options.c,v 1.15 1995/10/19 18:37:49 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -49,9 +49,9 @@ ftpFlagCheck(Option opt)
{
/* Verify that everything's sane */
if ((int)opt.aux == OPT_FTP_ABORT && optionIsSet(OPT_FTP_RESELECT))
OptFlags &= ~OPT_FTP_RESELECT;
optionUnset(OPT_FTP_RESELECT);
else if ((int)opt.aux == OPT_FTP_RESELECT && optionIsSet(OPT_FTP_ABORT))
OptFlags &= ~OPT_FTP_ABORT;
optionUnset(OPT_FTP_ABORT);
return NULL;
}
@ -96,6 +96,12 @@ mediaCheck(Option opt)
case DEVICE_TYPE_NFS:
return "NFS";
case DEVICE_TYPE_NONE:
case DEVICE_TYPE_NETWORK:
case DEVICE_TYPE_ANY:
default:
return "<unknown>";
}
}
return "<unset>";
@ -128,7 +134,7 @@ static Option Options[] = {
OPT_IS_VAR, "Please specify a full pathname to the HTML browser binary:", BROWSER_BINARY, varCheck },
{ "Config File", "Name of default configuration file for Load command (top menu)",
OPT_IS_VAR, "Please specify the name of a configuration file", CONFIG_FILE, varCheck },
{ "Media", "The current installation media type.",
{ "Media Type", "The current installation media type.",
OPT_IS_FUNC, mediaGetType, MEDIA_TYPE, mediaCheck },
{ "Use Defaults", "Reset all values to startup defaults",
OPT_IS_FUNC, installVarDefaults, 0, resetLogo },
@ -147,6 +153,12 @@ optionIsSet(int opt)
return OptFlags & opt;
}
void
optionUnset(int opt)
{
OptFlags &= ~opt;
}
static char *
value_of(Option opt)
{
@ -273,9 +285,10 @@ optionsEditor(char *str)
continue;
case ' ':
fire(Options[currOpt]);
clear();
dialog_clear();
fire(Options[currOpt]);
dialog_clear();
clear();
continue;
case 'Q':

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: index.c,v 1.9 1995/10/16 09:25:13 jkh Exp $
* $Id: index.c,v 1.10 1995/10/16 15:14:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -60,8 +60,7 @@ _strdup(char *ptr)
}
static char *descrs[] = {
"Package Selection",
"To select a package or category, move to it and press SPACE.\n"
"Package Selection", "To select a package or category, move to it and press SPACE.\n"
"To remove a package from consideration, press SPACE again.\n"
"To go to a previous menu, select UP item or Cancel. To search\n"
"for a package by name, press ESC.",
@ -126,13 +125,8 @@ fetch_desc(char *name)
static PkgNodePtr
new_pkg_node(char *name, node_type type)
{
PkgNodePtr tmp = malloc(sizeof(PkgNode));
PkgNodePtr tmp = safe_malloc(sizeof(PkgNode));
if (!tmp) {
fprintf(stderr, "Out of memory - unable to allocate a new package node!\n");
exit(1);
}
bzero(tmp, sizeof(PkgNode));
tmp->name = _strdup(name);
tmp->type = type;
return tmp;
@ -141,14 +135,8 @@ new_pkg_node(char *name, node_type type)
static IndexEntryPtr
new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint)
{
IndexEntryPtr tmp = malloc(sizeof(IndexEntry));
IndexEntryPtr tmp = safe_malloc(sizeof(IndexEntry));
if (!tmp) {
fprintf(stderr, "Out of memory - unable to allocate a new index node!\n");
exit(1);
}
bzero(tmp, sizeof(IndexEntry));
tmp->name = _strdup(name);
tmp->path = _strdup(pathto);
tmp->prefix = _strdup(prefix);
@ -163,8 +151,14 @@ strchop(char *s1, char *s2, int len)
{
int len2;
len2 = strlen(s1);
if (len2 >= len) {
if (!s1)
return s1;
if (!s2) {
s1[0] = '\0';
return s1;
}
len2 = strlen(s2);
if (len2 > len) {
strncpy(s1, s2, len - 1);
s1[len] = '\0';
}

View File

@ -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.14 1995/10/19 15:55:20 jkh Exp $
* $Id: options.c,v 1.15 1995/10/19 18:37:49 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -49,9 +49,9 @@ ftpFlagCheck(Option opt)
{
/* Verify that everything's sane */
if ((int)opt.aux == OPT_FTP_ABORT && optionIsSet(OPT_FTP_RESELECT))
OptFlags &= ~OPT_FTP_RESELECT;
optionUnset(OPT_FTP_RESELECT);
else if ((int)opt.aux == OPT_FTP_RESELECT && optionIsSet(OPT_FTP_ABORT))
OptFlags &= ~OPT_FTP_ABORT;
optionUnset(OPT_FTP_ABORT);
return NULL;
}
@ -96,6 +96,12 @@ mediaCheck(Option opt)
case DEVICE_TYPE_NFS:
return "NFS";
case DEVICE_TYPE_NONE:
case DEVICE_TYPE_NETWORK:
case DEVICE_TYPE_ANY:
default:
return "<unknown>";
}
}
return "<unset>";
@ -128,7 +134,7 @@ static Option Options[] = {
OPT_IS_VAR, "Please specify a full pathname to the HTML browser binary:", BROWSER_BINARY, varCheck },
{ "Config File", "Name of default configuration file for Load command (top menu)",
OPT_IS_VAR, "Please specify the name of a configuration file", CONFIG_FILE, varCheck },
{ "Media", "The current installation media type.",
{ "Media Type", "The current installation media type.",
OPT_IS_FUNC, mediaGetType, MEDIA_TYPE, mediaCheck },
{ "Use Defaults", "Reset all values to startup defaults",
OPT_IS_FUNC, installVarDefaults, 0, resetLogo },
@ -147,6 +153,12 @@ optionIsSet(int opt)
return OptFlags & opt;
}
void
optionUnset(int opt)
{
OptFlags &= ~opt;
}
static char *
value_of(Option opt)
{
@ -273,9 +285,10 @@ optionsEditor(char *str)
continue;
case ' ':
fire(Options[currOpt]);
clear();
dialog_clear();
fire(Options[currOpt]);
dialog_clear();
clear();
continue;
case 'Q':