summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-10-20 07:02:53 +0000
committerjkh <jkh@FreeBSD.org>1995-10-20 07:02:53 +0000
commit5cfb4aca37c8d842868ccced836b0e293a8260f8 (patch)
treed0bbe996087ac38c98f38a01606670bbfa61e870
parentdc58fb65bda5943581853112c9762c96a1eb3f9c (diff)
downloadFreeBSD-src-5cfb4aca37c8d842868ccced836b0e293a8260f8.zip
FreeBSD-src-5cfb4aca37c8d842868ccced836b0e293a8260f8.tar.gz
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.
-rw-r--r--release/sysinstall/index.c30
-rw-r--r--release/sysinstall/installFinal.c12
-rw-r--r--release/sysinstall/options.c23
-rw-r--r--usr.sbin/sysinstall/index.c30
-rw-r--r--usr.sbin/sysinstall/options.c23
5 files changed, 69 insertions, 49 deletions
diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c
index 3965653..2b5080c 100644
--- a/release/sysinstall/index.c
+++ b/release/sysinstall/index.c
@@ -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));
-
- if (!tmp) {
- fprintf(stderr, "Out of memory - unable to allocate a new index node!\n");
- exit(1);
- }
+ IndexEntryPtr tmp = safe_malloc(sizeof(IndexEntry));
- 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';
}
diff --git a/release/sysinstall/installFinal.c b/release/sysinstall/installFinal.c
index 2f44c9e..739c4eb 100644
--- a/release/sysinstall/installFinal.c
+++ b/release/sysinstall/installFinal.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.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? */
diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c
index 28eadd5..24083e8 100644
--- a/release/sysinstall/options.c
+++ b/release/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.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 ' ':
+ dialog_clear();
fire(Options[currOpt]);
- clear();
dialog_clear();
+ clear();
continue;
case 'Q':
diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c
index 3965653..2b5080c 100644
--- a/usr.sbin/sysinstall/index.c
+++ b/usr.sbin/sysinstall/index.c
@@ -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));
-
- if (!tmp) {
- fprintf(stderr, "Out of memory - unable to allocate a new index node!\n");
- exit(1);
- }
+ IndexEntryPtr tmp = safe_malloc(sizeof(IndexEntry));
- 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';
}
diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c
index 28eadd5..24083e8 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.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 ' ':
+ dialog_clear();
fire(Options[currOpt]);
- clear();
dialog_clear();
+ clear();
continue;
case 'Q':
OpenPOWER on IntegriCloud