summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release/sysinstall/attr.c31
-rw-r--r--release/sysinstall/cdrom.c5
-rw-r--r--release/sysinstall/dist.c5
-rw-r--r--release/sysinstall/main.c6
-rw-r--r--release/sysinstall/sysinstall.h8
-rw-r--r--usr.sbin/sade/main.c6
-rw-r--r--usr.sbin/sade/sade.h8
-rw-r--r--usr.sbin/sysinstall/cdrom.c5
-rw-r--r--usr.sbin/sysinstall/dist.c5
-rw-r--r--usr.sbin/sysinstall/main.c6
-rw-r--r--usr.sbin/sysinstall/sysinstall.h8
11 files changed, 32 insertions, 61 deletions
diff --git a/release/sysinstall/attr.c b/release/sysinstall/attr.c
index 2310d3c..10449e54 100644
--- a/release/sysinstall/attr.c
+++ b/release/sysinstall/attr.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: attr.c,v 1.10 1996/12/11 09:34:53 jkh Exp $
+ * $Id: attr.c,v 1.11 1996/12/11 18:23:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -137,23 +137,23 @@ attr_parse(Attribs *attr, FILE *fp)
break;
case COMMIT:
- attr[num_attribs].name = strdup(hold_n);
- attr[num_attribs].value = strdup(hold_v);
+ SAFE_STRCPY(attr[num_attribs].name, hold_n);
+ SAFE_STRCPY(attr[num_attribs].value, hold_v);
state = LOOK;
v = n = 0;
if (++num_attribs >= MAX_ATTRIBS)
msgFatal("Attribute limit overflow; encountered a bad attributes file!");
break;
-
+
default:
msgFatal("Unknown state at line %d??", lno);
}
}
- attr[num_attribs].name = NULL; /* end marker */
- attr[num_attribs].value = NULL; /* end marker */
+ attr[num_attribs].name[0] = NULL; /* end marker */
+ attr[num_attribs].value[0] = NULL; /* end marker */
if (isDebug())
msgDebug("Finished parsing %d attributes.\n", num_attribs);
-
+
return DITEM_SUCCESS;
}
@@ -165,7 +165,7 @@ attr_match(Attribs *attr, char *name)
if (isDebug())
msgDebug("Trying to match attribute `%s'\n", name);
- for (n = 0; attr[n].name && strcasecmp(attr[n].name, name) != 0; n++) {
+ for (n = 0; attr[n].name[0] && strcasecmp(attr[n].name, name) != 0; n++) {
if (isDebug())
msgDebug("Skipping attribute %u\n", n);
}
@@ -173,7 +173,7 @@ attr_match(Attribs *attr, char *name)
if (isDebug())
msgDebug("Stopped on attribute %u\n", n);
- if (attr[n].name) {
+ if (attr[n].name[0]) {
if (isDebug())
msgDebug("Returning `%s'\n", attr[n].value);
return(attr[n].value);
@@ -181,16 +181,3 @@ attr_match(Attribs *attr, char *name)
return NULL;
}
-
-void
-attr_free(Attribs *attr)
-{
- int i;
-
- for (i = 0; attr[i].name; i++) {
- free(attr[i].name);
- free(attr[i].value);
- attr[i].name = attr[i].value = NULL;
- }
- free(attr);
-}
diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c
index 8324e65..69b415b 100644
--- a/release/sysinstall/cdrom.c
+++ b/release/sysinstall/cdrom.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: cdrom.c,v 1.27 1996/12/11 09:34:54 jkh Exp $
+ * $Id: cdrom.c,v 1.28 1996/12/11 18:23:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -74,7 +74,7 @@ mediaInitCDROM(Device *dev)
args.fspec = dev->devname;
args.flags = 0;
- cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
+ cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
cp = NULL;
dontRead = FALSE;
/* If this cdrom's not already mounted or can't be mounted, yell */
@@ -116,7 +116,6 @@ mediaInitCDROM(Device *dev)
"to set the boot floppy version string to match that of the CD\n"
"before selecting it as an installation media to avoid this warning", cp, variable_get(VAR_RELNAME));
}
- attr_free(cd_attr);
msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname);
return TRUE;
}
diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c
index b2f60a0..9fde44e 100644
--- a/release/sysinstall/dist.c
+++ b/release/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.81 1996/12/11 09:34:57 jkh Exp $
+ * $Id: dist.c,v 1.82 1996/12/11 18:23:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -389,7 +389,7 @@ distExtract(char *parent, Distribution *me)
if (fp > 0) {
if (isDebug())
msgDebug("Parsing attributes file for distribution %s\n", dist);
- dist_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
+ dist_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
if (DITEM_STATUS(attr_parse(dist_attr, fp)) == DITEM_FAILURE)
msgConfirm("Cannot parse information file for the %s distribution!\n"
"Please verify that your media is valid and try again.", dist);
@@ -400,7 +400,6 @@ distExtract(char *parent, Distribution *me)
if (tmp)
numchunks = strtol(tmp, 0, 0);
}
- attr_free(dist_attr);
fclose(fp);
if (!numchunks)
continue;
diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c
index 90a4367..c8a9025 100644
--- a/release/sysinstall/main.c
+++ b/release/sysinstall/main.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: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $
+ * $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -119,7 +119,7 @@ main(int argc, char **argv)
FILE *fp;
Attribs *attrs;
- attrs = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
+ attrs = alloca(sizeof(Attribs) * MAX_ATTRIBS);
fp = fopen("install.cfg", "r");
if (fp) {
msgNotify("Loading pre-configuration file");
@@ -130,7 +130,6 @@ main(int argc, char **argv)
variable_set2(attrs[i].name, attrs[i].value);
}
fclose(fp);
- attr_free(attrs);
}
#if defined(LOAD_CONFIG_FILE)
@@ -158,7 +157,6 @@ main(int argc, char **argv)
variable_set2(attrs[i].name, attrs[i].value);
}
fclose(fp);
- attr_free(attrs);
}
mediaDevice->shutdown(mediaDevice);
}
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index a121167..3ee4ec8 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/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.91 1996/12/11 09:35:05 jkh Exp $
+ * $Id: sysinstall.h,v 1.92 1996/12/11 18:23:19 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -179,8 +179,8 @@ typedef struct _variable {
#define MAX_VALUE 256
typedef struct _attribs {
- char *name;
- char *value;
+ char name[MAX_NAME];
+ char value[MAX_VALUE];
} Attribs;
typedef enum {
@@ -211,7 +211,6 @@ typedef struct _device {
Boolean enabled;
Boolean (*init)(struct _device *dev);
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
- Boolean (*close)(struct _device *dev, FILE *fp);
void (*shutdown)(struct _device *dev);
void *private;
unsigned int flags;
@@ -355,7 +354,6 @@ extern int configAnonFTP(dialogMenuItem *self);
extern char *attr_match(Attribs *attr, char *name);
extern int attr_parse_file(Attribs *attr, char *file);
extern int attr_parse(Attribs *attr, FILE *fp);
-extern void attr_free(Attribs *attr);
/* cdrom.c */
extern Boolean mediaInitCDROM(Device *dev);
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c
index 90a4367..c8a9025 100644
--- a/usr.sbin/sade/main.c
+++ b/usr.sbin/sade/main.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: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $
+ * $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -119,7 +119,7 @@ main(int argc, char **argv)
FILE *fp;
Attribs *attrs;
- attrs = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
+ attrs = alloca(sizeof(Attribs) * MAX_ATTRIBS);
fp = fopen("install.cfg", "r");
if (fp) {
msgNotify("Loading pre-configuration file");
@@ -130,7 +130,6 @@ main(int argc, char **argv)
variable_set2(attrs[i].name, attrs[i].value);
}
fclose(fp);
- attr_free(attrs);
}
#if defined(LOAD_CONFIG_FILE)
@@ -158,7 +157,6 @@ main(int argc, char **argv)
variable_set2(attrs[i].name, attrs[i].value);
}
fclose(fp);
- attr_free(attrs);
}
mediaDevice->shutdown(mediaDevice);
}
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index a121167..3ee4ec8 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.91 1996/12/11 09:35:05 jkh Exp $
+ * $Id: sysinstall.h,v 1.92 1996/12/11 18:23:19 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -179,8 +179,8 @@ typedef struct _variable {
#define MAX_VALUE 256
typedef struct _attribs {
- char *name;
- char *value;
+ char name[MAX_NAME];
+ char value[MAX_VALUE];
} Attribs;
typedef enum {
@@ -211,7 +211,6 @@ typedef struct _device {
Boolean enabled;
Boolean (*init)(struct _device *dev);
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
- Boolean (*close)(struct _device *dev, FILE *fp);
void (*shutdown)(struct _device *dev);
void *private;
unsigned int flags;
@@ -355,7 +354,6 @@ extern int configAnonFTP(dialogMenuItem *self);
extern char *attr_match(Attribs *attr, char *name);
extern int attr_parse_file(Attribs *attr, char *file);
extern int attr_parse(Attribs *attr, FILE *fp);
-extern void attr_free(Attribs *attr);
/* cdrom.c */
extern Boolean mediaInitCDROM(Device *dev);
diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c
index 8324e65..69b415b 100644
--- a/usr.sbin/sysinstall/cdrom.c
+++ b/usr.sbin/sysinstall/cdrom.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: cdrom.c,v 1.27 1996/12/11 09:34:54 jkh Exp $
+ * $Id: cdrom.c,v 1.28 1996/12/11 18:23:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -74,7 +74,7 @@ mediaInitCDROM(Device *dev)
args.fspec = dev->devname;
args.flags = 0;
- cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
+ cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
cp = NULL;
dontRead = FALSE;
/* If this cdrom's not already mounted or can't be mounted, yell */
@@ -116,7 +116,6 @@ mediaInitCDROM(Device *dev)
"to set the boot floppy version string to match that of the CD\n"
"before selecting it as an installation media to avoid this warning", cp, variable_get(VAR_RELNAME));
}
- attr_free(cd_attr);
msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname);
return TRUE;
}
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index b2f60a0..9fde44e 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.81 1996/12/11 09:34:57 jkh Exp $
+ * $Id: dist.c,v 1.82 1996/12/11 18:23:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -389,7 +389,7 @@ distExtract(char *parent, Distribution *me)
if (fp > 0) {
if (isDebug())
msgDebug("Parsing attributes file for distribution %s\n", dist);
- dist_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
+ dist_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
if (DITEM_STATUS(attr_parse(dist_attr, fp)) == DITEM_FAILURE)
msgConfirm("Cannot parse information file for the %s distribution!\n"
"Please verify that your media is valid and try again.", dist);
@@ -400,7 +400,6 @@ distExtract(char *parent, Distribution *me)
if (tmp)
numchunks = strtol(tmp, 0, 0);
}
- attr_free(dist_attr);
fclose(fp);
if (!numchunks)
continue;
diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c
index 90a4367..c8a9025 100644
--- a/usr.sbin/sysinstall/main.c
+++ b/usr.sbin/sysinstall/main.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: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $
+ * $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -119,7 +119,7 @@ main(int argc, char **argv)
FILE *fp;
Attribs *attrs;
- attrs = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
+ attrs = alloca(sizeof(Attribs) * MAX_ATTRIBS);
fp = fopen("install.cfg", "r");
if (fp) {
msgNotify("Loading pre-configuration file");
@@ -130,7 +130,6 @@ main(int argc, char **argv)
variable_set2(attrs[i].name, attrs[i].value);
}
fclose(fp);
- attr_free(attrs);
}
#if defined(LOAD_CONFIG_FILE)
@@ -158,7 +157,6 @@ main(int argc, char **argv)
variable_set2(attrs[i].name, attrs[i].value);
}
fclose(fp);
- attr_free(attrs);
}
mediaDevice->shutdown(mediaDevice);
}
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index a121167..3ee4ec8 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.91 1996/12/11 09:35:05 jkh Exp $
+ * $Id: sysinstall.h,v 1.92 1996/12/11 18:23:19 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -179,8 +179,8 @@ typedef struct _variable {
#define MAX_VALUE 256
typedef struct _attribs {
- char *name;
- char *value;
+ char name[MAX_NAME];
+ char value[MAX_VALUE];
} Attribs;
typedef enum {
@@ -211,7 +211,6 @@ typedef struct _device {
Boolean enabled;
Boolean (*init)(struct _device *dev);
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
- Boolean (*close)(struct _device *dev, FILE *fp);
void (*shutdown)(struct _device *dev);
void *private;
unsigned int flags;
@@ -355,7 +354,6 @@ extern int configAnonFTP(dialogMenuItem *self);
extern char *attr_match(Attribs *attr, char *name);
extern int attr_parse_file(Attribs *attr, char *file);
extern int attr_parse(Attribs *attr, FILE *fp);
-extern void attr_free(Attribs *attr);
/* cdrom.c */
extern Boolean mediaInitCDROM(Device *dev);
OpenPOWER on IntegriCloud