Make this compile again. Poul and I need to sync up again.

This commit is contained in:
Jordan K. Hubbard 1995-05-07 05:58:57 +00:00
parent 2f27939662
commit 2b0e7dfa13
12 changed files with 237 additions and 168 deletions

View File

@ -39,10 +39,6 @@ makedevs.c: dev2c.sh Makefile rtermcap
file2c 'const unsigned char boot0[] = {' '};' \
< bteasy17 >> makedevs.tmp
rm -rf bteasy17
file2c 'const unsigned char boot1[] = {' '};' \
< ${BOOTS}/boot1 >> makedevs.tmp
file2c 'const unsigned char boot2[] = {' '};' \
< ${BOOTS}/boot2 >> makedevs.tmp
./rtermcap cons25 | \
file2c 'const char termcap_cons25[] = {' ',0};' \
>> makedevs.tmp

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: devices.c,v 1.6 1995/05/06 09:34:09 jkh Exp $
* $Id: devices.c,v 1.7 1995/05/07 03:37:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -86,6 +86,7 @@ record_chunks(struct disk *d)
if (!d->chunks)
msgFatal("No chunk list found for %s!", d->name);
c1 = d->chunks->part;
current_chunk = 0;
while (c1) {
if (c1->type == unused && c1->size > last_free) {
last_free = c1->size;

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: disks.c,v 1.4 1995/05/07 02:04:25 jkh Exp $
* $Id: disks.c,v 1.5 1995/05/07 03:37:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -128,11 +128,10 @@ static void
record_fbsd_chunks(struct disk **disks)
{
int i, j, p;
struct chunk *c1, *c2;
j = p = 0;
j = p = current_chunk = 0;
for (i = 0; disks[i]; i++) {
struct chunk *c1;
if (!disks[i]->chunks)
msgFatal("No chunk list found for %s!", disks[i]->name);
@ -142,16 +141,16 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].type = PART_SLICE;
fbsd_chunk_info[j].d = disks[i];
fbsd_chunk_info[j].c = c1;
fbsd_chunk_info[j++].p = NULL;
fbsd_chunk_info[j].p = NULL;
++j;
}
}
}
for (i = 0; disks[i]; i++) {
/* Then buzz through and pick up the partitions */
for (c1 = disks[i]->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
struct chunk *c2 = c1->part;
while (c2) {
for (c2 = c1->part; c2; c2 = c2->next) {
if (c2->type == part) {
if (c2->subtype == FS_SWAP)
fbsd_chunk_info[j].type = PART_SWAP;
@ -159,9 +158,9 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].type = PART_FILESYSTEM;
fbsd_chunk_info[j].d = disks[i];
fbsd_chunk_info[j].c = c2;
fbsd_chunk_info[j++].p = c2->private;
fbsd_chunk_info[j].p = c2->private;
++j;
}
c2 = c2->next;
}
}
}
@ -170,39 +169,48 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].c = NULL;
}
static PartInfo *
new_part(char *mpoint, Boolean newfs)
{
PartInfo *ret;
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
ret->newfs = newfs;
return ret;
}
int
get_mountpoint(struct chunk *c)
get_mountpoint(int i)
{
char *val;
PartInfo *part;
val = msgGetInput(c->private,
"Please specify mount point for new partition");
val = msgGetInput(fbsd_chunk_info[i].p ?
fbsd_chunk_info[i].p->mountpoint : NULL,
"Please specify a mount point for the new partition");
if (val) {
if (!strcmp(val, "/")) {
if (c->flags & CHUNK_PAST_1024) {
if (fbsd_chunk_info[i].c->flags & CHUNK_PAST_1024) {
msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
return 1;
}
c->flags |= CHUNK_IS_ROOT;
fbsd_chunk_info[i].c->flags |= CHUNK_IS_ROOT;
}
if (check_conflict(val)) {
msgConfirm("You already have a mountpoint for %s assigned!", val);
return 1;
}
safe_free(c->private);
part = (PartInfo *)malloc(sizeof(PartInfo));
strncpy(part->mountpoint, val, FILENAME_MAX);
part->newfs = TRUE;
c->private = (void *)part;
c->private_free = free;
safe_free(fbsd_chunk_info[i].c->private);
fbsd_chunk_info[i].c->private = new_part(val, TRUE);
fbsd_chunk_info[i].c->private_free = free;
fbsd_chunk_info[i].p = fbsd_chunk_info[i].c->private;
return 0;
}
return 1;
}
static PartType
get_partition_type(struct chunk *c)
get_partition_type(void)
{
char selection[20];
static unsigned char *fs_types[] = {
@ -228,7 +236,7 @@ get_partition_type(struct chunk *c)
#define PART_MOUNT_COL 8
#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 4)
#define PART_NEWFS_COL (PART_SIZE_COL + 8)
#define PART_OFF 40
#define PART_OFF 42
static void
print_fbsd_chunks(void)
@ -278,22 +286,28 @@ print_fbsd_chunks(void)
}
/* Otherwise it's a swap or filesystem entry, at the bottom */
else {
char *mountpoint, *newfs;
char onestr[PART_OFF], num[10], *mountpoint, *newfs;
memset(onestr, ' ', PART_OFF - 1);
onestr[PART_OFF - 1] = '\0';
/* Go for two columns */
if (prow == (CHUNK_PART_START_ROW + 9))
if (prow == (CHUNK_PART_START_ROW + 8))
pcol = PART_OFF;
else
pcol = 0;
mvaddstr(prow, pcol + PART_PART_COL, fbsd_chunk_info[i].c->name);
memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
strlen(fbsd_chunk_info[i].c->name));
if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
if (fbsd_chunk_info[i].p) {
mountpoint = fbsd_chunk_info[i].p->mountpoint;
newfs = fbsd_chunk_info[i].p->newfs ? "Y" : "N";
}
else {
fbsd_chunk_info[i].c->private = new_part("", FALSE);
fbsd_chunk_info[i].c->private_free = free;
fbsd_chunk_info[i].p = fbsd_chunk_info[i].c->private;
mountpoint = " ";
newfs = " ";
newfs = "N";
}
}
else {
@ -301,11 +315,12 @@ print_fbsd_chunks(void)
newfs = " ";
}
for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
mvaddch(prow, pcol + PART_MOUNT_COL + j, mountpoint[j]);
mvprintw(prow, pcol + PART_SIZE_COL, "%4dMB",
fbsd_chunk_info[i].c->size ?
fbsd_chunk_info[i].c->size / 2048 : 0);
mvaddstr(prow, pcol + PART_NEWFS_COL, newfs);
onestr[PART_MOUNT_COL + j] = mountpoint[j];
sprintf(num, "%4ldMB", fbsd_chunk_info[i].c->size ?
fbsd_chunk_info[i].c->size / 2048 : 0);
memcpy(onestr + PART_SIZE_COL, num, strlen(num));
memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
mvaddstr(prow, pcol, onestr);
++prow;
}
if (i == current_chunk)
@ -345,13 +360,14 @@ partition_disks(struct disk **disks)
print_fbsd_chunks();
print_command_summary();
if (msg) {
standout(); mvprintw(23, 0, msg); standend();
attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
beep();
msg = NULL;
}
refresh();
key = toupper(getch());
switch (key) {
case KEY_UP:
case '-':
if (current_chunk != 0)
@ -382,7 +398,7 @@ partition_disks(struct disk **disks)
case 'C':
if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
msg = "Can only create sub-partitions in a master partition (at top)";
msg = "Can't create a sub-partition here (that only works in master partitions)";
break;
}
sz = space_free(fbsd_chunk_info[current_chunk].c);
@ -397,9 +413,7 @@ partition_disks(struct disk **disks)
if (val && (size = strtol(val, 0, 0)) > 0) {
PartType type;
if (get_mountpoint(fbsd_chunk_info[current_chunk].c))
break;
type = get_partition_type(fbsd_chunk_info[current_chunk].c);
type = get_partition_type();
if (type == PART_NONE)
break;
Create_Chunk(fbsd_chunk_info[current_chunk].d,
@ -409,18 +423,30 @@ partition_disks(struct disk **disks)
part,
type == PART_SWAP ? FS_SWAP : freebsd,
fbsd_chunk_info[current_chunk].c->flags);
if (get_mountpoint(current_chunk))
break;
record_fbsd_chunks(disks);
}
}
break;
case 'D':
case 'D': /* delete */
if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
msg = "Use the Master Partition Editor to delete one of these";
break;
}
Delete_Chunk(fbsd_chunk_info[current_chunk].d,
fbsd_chunk_info[current_chunk].c);
record_fbsd_chunks(disks);
break;
case 'M': /* mount */
if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
msg = "You can't mount one of these directly!";
break;
}
if (get_mountpoint(current_chunk))
record_fbsd_chunks(disks);
break;
case 27: /* ESC */

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: msg.c,v 1.6 1995/05/05 23:47:44 jkh Exp $
* $Id: msg.c,v 1.7 1995/05/07 03:38:01 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -52,7 +52,7 @@ msgYap(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
errstr[0] = '\0';
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -73,7 +73,7 @@ msgInfo(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
errstr[0] = '\0';
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -94,7 +94,7 @@ msgWarn(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Warning: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -116,7 +116,7 @@ msgError(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Error: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -138,7 +138,7 @@ msgFatal(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Fatal Error: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -167,7 +167,7 @@ msgConfirm(char *fmt, ...)
va_list args;
char *errstr;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -184,7 +184,7 @@ msgNotify(char *fmt, ...)
va_list args;
char *errstr;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -202,7 +202,7 @@ msgYesNo(char *fmt, ...)
char *errstr;
int ret;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -222,7 +222,7 @@ msgGetInput(char *buf, char *fmt, ...)
static char input_buffer[256];
int rval;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);

View File

@ -39,10 +39,6 @@ makedevs.c: dev2c.sh Makefile rtermcap
file2c 'const unsigned char boot0[] = {' '};' \
< bteasy17 >> makedevs.tmp
rm -rf bteasy17
file2c 'const unsigned char boot1[] = {' '};' \
< ${BOOTS}/boot1 >> makedevs.tmp
file2c 'const unsigned char boot2[] = {' '};' \
< ${BOOTS}/boot2 >> makedevs.tmp
./rtermcap cons25 | \
file2c 'const char termcap_cons25[] = {' ',0};' \
>> makedevs.tmp

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: devices.c,v 1.6 1995/05/06 09:34:09 jkh Exp $
* $Id: devices.c,v 1.7 1995/05/07 03:37:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -86,6 +86,7 @@ record_chunks(struct disk *d)
if (!d->chunks)
msgFatal("No chunk list found for %s!", d->name);
c1 = d->chunks->part;
current_chunk = 0;
while (c1) {
if (c1->type == unused && c1->size > last_free) {
last_free = c1->size;

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: disks.c,v 1.4 1995/05/07 02:04:25 jkh Exp $
* $Id: disks.c,v 1.5 1995/05/07 03:37:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -128,11 +128,10 @@ static void
record_fbsd_chunks(struct disk **disks)
{
int i, j, p;
struct chunk *c1, *c2;
j = p = 0;
j = p = current_chunk = 0;
for (i = 0; disks[i]; i++) {
struct chunk *c1;
if (!disks[i]->chunks)
msgFatal("No chunk list found for %s!", disks[i]->name);
@ -142,16 +141,16 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].type = PART_SLICE;
fbsd_chunk_info[j].d = disks[i];
fbsd_chunk_info[j].c = c1;
fbsd_chunk_info[j++].p = NULL;
fbsd_chunk_info[j].p = NULL;
++j;
}
}
}
for (i = 0; disks[i]; i++) {
/* Then buzz through and pick up the partitions */
for (c1 = disks[i]->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
struct chunk *c2 = c1->part;
while (c2) {
for (c2 = c1->part; c2; c2 = c2->next) {
if (c2->type == part) {
if (c2->subtype == FS_SWAP)
fbsd_chunk_info[j].type = PART_SWAP;
@ -159,9 +158,9 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].type = PART_FILESYSTEM;
fbsd_chunk_info[j].d = disks[i];
fbsd_chunk_info[j].c = c2;
fbsd_chunk_info[j++].p = c2->private;
fbsd_chunk_info[j].p = c2->private;
++j;
}
c2 = c2->next;
}
}
}
@ -170,39 +169,48 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].c = NULL;
}
static PartInfo *
new_part(char *mpoint, Boolean newfs)
{
PartInfo *ret;
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
ret->newfs = newfs;
return ret;
}
int
get_mountpoint(struct chunk *c)
get_mountpoint(int i)
{
char *val;
PartInfo *part;
val = msgGetInput(c->private,
"Please specify mount point for new partition");
val = msgGetInput(fbsd_chunk_info[i].p ?
fbsd_chunk_info[i].p->mountpoint : NULL,
"Please specify a mount point for the new partition");
if (val) {
if (!strcmp(val, "/")) {
if (c->flags & CHUNK_PAST_1024) {
if (fbsd_chunk_info[i].c->flags & CHUNK_PAST_1024) {
msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
return 1;
}
c->flags |= CHUNK_IS_ROOT;
fbsd_chunk_info[i].c->flags |= CHUNK_IS_ROOT;
}
if (check_conflict(val)) {
msgConfirm("You already have a mountpoint for %s assigned!", val);
return 1;
}
safe_free(c->private);
part = (PartInfo *)malloc(sizeof(PartInfo));
strncpy(part->mountpoint, val, FILENAME_MAX);
part->newfs = TRUE;
c->private = (void *)part;
c->private_free = free;
safe_free(fbsd_chunk_info[i].c->private);
fbsd_chunk_info[i].c->private = new_part(val, TRUE);
fbsd_chunk_info[i].c->private_free = free;
fbsd_chunk_info[i].p = fbsd_chunk_info[i].c->private;
return 0;
}
return 1;
}
static PartType
get_partition_type(struct chunk *c)
get_partition_type(void)
{
char selection[20];
static unsigned char *fs_types[] = {
@ -228,7 +236,7 @@ get_partition_type(struct chunk *c)
#define PART_MOUNT_COL 8
#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 4)
#define PART_NEWFS_COL (PART_SIZE_COL + 8)
#define PART_OFF 40
#define PART_OFF 42
static void
print_fbsd_chunks(void)
@ -278,22 +286,28 @@ print_fbsd_chunks(void)
}
/* Otherwise it's a swap or filesystem entry, at the bottom */
else {
char *mountpoint, *newfs;
char onestr[PART_OFF], num[10], *mountpoint, *newfs;
memset(onestr, ' ', PART_OFF - 1);
onestr[PART_OFF - 1] = '\0';
/* Go for two columns */
if (prow == (CHUNK_PART_START_ROW + 9))
if (prow == (CHUNK_PART_START_ROW + 8))
pcol = PART_OFF;
else
pcol = 0;
mvaddstr(prow, pcol + PART_PART_COL, fbsd_chunk_info[i].c->name);
memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
strlen(fbsd_chunk_info[i].c->name));
if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
if (fbsd_chunk_info[i].p) {
mountpoint = fbsd_chunk_info[i].p->mountpoint;
newfs = fbsd_chunk_info[i].p->newfs ? "Y" : "N";
}
else {
fbsd_chunk_info[i].c->private = new_part("", FALSE);
fbsd_chunk_info[i].c->private_free = free;
fbsd_chunk_info[i].p = fbsd_chunk_info[i].c->private;
mountpoint = " ";
newfs = " ";
newfs = "N";
}
}
else {
@ -301,11 +315,12 @@ print_fbsd_chunks(void)
newfs = " ";
}
for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
mvaddch(prow, pcol + PART_MOUNT_COL + j, mountpoint[j]);
mvprintw(prow, pcol + PART_SIZE_COL, "%4dMB",
fbsd_chunk_info[i].c->size ?
fbsd_chunk_info[i].c->size / 2048 : 0);
mvaddstr(prow, pcol + PART_NEWFS_COL, newfs);
onestr[PART_MOUNT_COL + j] = mountpoint[j];
sprintf(num, "%4ldMB", fbsd_chunk_info[i].c->size ?
fbsd_chunk_info[i].c->size / 2048 : 0);
memcpy(onestr + PART_SIZE_COL, num, strlen(num));
memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
mvaddstr(prow, pcol, onestr);
++prow;
}
if (i == current_chunk)
@ -345,13 +360,14 @@ partition_disks(struct disk **disks)
print_fbsd_chunks();
print_command_summary();
if (msg) {
standout(); mvprintw(23, 0, msg); standend();
attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
beep();
msg = NULL;
}
refresh();
key = toupper(getch());
switch (key) {
case KEY_UP:
case '-':
if (current_chunk != 0)
@ -382,7 +398,7 @@ partition_disks(struct disk **disks)
case 'C':
if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
msg = "Can only create sub-partitions in a master partition (at top)";
msg = "Can't create a sub-partition here (that only works in master partitions)";
break;
}
sz = space_free(fbsd_chunk_info[current_chunk].c);
@ -397,9 +413,7 @@ partition_disks(struct disk **disks)
if (val && (size = strtol(val, 0, 0)) > 0) {
PartType type;
if (get_mountpoint(fbsd_chunk_info[current_chunk].c))
break;
type = get_partition_type(fbsd_chunk_info[current_chunk].c);
type = get_partition_type();
if (type == PART_NONE)
break;
Create_Chunk(fbsd_chunk_info[current_chunk].d,
@ -409,18 +423,30 @@ partition_disks(struct disk **disks)
part,
type == PART_SWAP ? FS_SWAP : freebsd,
fbsd_chunk_info[current_chunk].c->flags);
if (get_mountpoint(current_chunk))
break;
record_fbsd_chunks(disks);
}
}
break;
case 'D':
case 'D': /* delete */
if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
msg = "Use the Master Partition Editor to delete one of these";
break;
}
Delete_Chunk(fbsd_chunk_info[current_chunk].d,
fbsd_chunk_info[current_chunk].c);
record_fbsd_chunks(disks);
break;
case 'M': /* mount */
if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
msg = "You can't mount one of these directly!";
break;
}
if (get_mountpoint(current_chunk))
record_fbsd_chunks(disks);
break;
case 27: /* ESC */

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: msg.c,v 1.6 1995/05/05 23:47:44 jkh Exp $
* $Id: msg.c,v 1.7 1995/05/07 03:38:01 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -52,7 +52,7 @@ msgYap(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
errstr[0] = '\0';
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -73,7 +73,7 @@ msgInfo(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
errstr[0] = '\0';
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -94,7 +94,7 @@ msgWarn(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Warning: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -116,7 +116,7 @@ msgError(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Error: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -138,7 +138,7 @@ msgFatal(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Fatal Error: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -167,7 +167,7 @@ msgConfirm(char *fmt, ...)
va_list args;
char *errstr;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -184,7 +184,7 @@ msgNotify(char *fmt, ...)
va_list args;
char *errstr;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -202,7 +202,7 @@ msgYesNo(char *fmt, ...)
char *errstr;
int ret;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -222,7 +222,7 @@ msgGetInput(char *buf, char *fmt, ...)
static char input_buffer[256];
int rval;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);

View File

@ -39,10 +39,6 @@ makedevs.c: dev2c.sh Makefile rtermcap
file2c 'const unsigned char boot0[] = {' '};' \
< bteasy17 >> makedevs.tmp
rm -rf bteasy17
file2c 'const unsigned char boot1[] = {' '};' \
< ${BOOTS}/boot1 >> makedevs.tmp
file2c 'const unsigned char boot2[] = {' '};' \
< ${BOOTS}/boot2 >> makedevs.tmp
./rtermcap cons25 | \
file2c 'const char termcap_cons25[] = {' ',0};' \
>> makedevs.tmp

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: devices.c,v 1.6 1995/05/06 09:34:09 jkh Exp $
* $Id: devices.c,v 1.7 1995/05/07 03:37:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -86,6 +86,7 @@ record_chunks(struct disk *d)
if (!d->chunks)
msgFatal("No chunk list found for %s!", d->name);
c1 = d->chunks->part;
current_chunk = 0;
while (c1) {
if (c1->type == unused && c1->size > last_free) {
last_free = c1->size;

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: disks.c,v 1.4 1995/05/07 02:04:25 jkh Exp $
* $Id: disks.c,v 1.5 1995/05/07 03:37:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -128,11 +128,10 @@ static void
record_fbsd_chunks(struct disk **disks)
{
int i, j, p;
struct chunk *c1, *c2;
j = p = 0;
j = p = current_chunk = 0;
for (i = 0; disks[i]; i++) {
struct chunk *c1;
if (!disks[i]->chunks)
msgFatal("No chunk list found for %s!", disks[i]->name);
@ -142,16 +141,16 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].type = PART_SLICE;
fbsd_chunk_info[j].d = disks[i];
fbsd_chunk_info[j].c = c1;
fbsd_chunk_info[j++].p = NULL;
fbsd_chunk_info[j].p = NULL;
++j;
}
}
}
for (i = 0; disks[i]; i++) {
/* Then buzz through and pick up the partitions */
for (c1 = disks[i]->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
struct chunk *c2 = c1->part;
while (c2) {
for (c2 = c1->part; c2; c2 = c2->next) {
if (c2->type == part) {
if (c2->subtype == FS_SWAP)
fbsd_chunk_info[j].type = PART_SWAP;
@ -159,9 +158,9 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].type = PART_FILESYSTEM;
fbsd_chunk_info[j].d = disks[i];
fbsd_chunk_info[j].c = c2;
fbsd_chunk_info[j++].p = c2->private;
fbsd_chunk_info[j].p = c2->private;
++j;
}
c2 = c2->next;
}
}
}
@ -170,39 +169,48 @@ record_fbsd_chunks(struct disk **disks)
fbsd_chunk_info[j].c = NULL;
}
static PartInfo *
new_part(char *mpoint, Boolean newfs)
{
PartInfo *ret;
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
ret->newfs = newfs;
return ret;
}
int
get_mountpoint(struct chunk *c)
get_mountpoint(int i)
{
char *val;
PartInfo *part;
val = msgGetInput(c->private,
"Please specify mount point for new partition");
val = msgGetInput(fbsd_chunk_info[i].p ?
fbsd_chunk_info[i].p->mountpoint : NULL,
"Please specify a mount point for the new partition");
if (val) {
if (!strcmp(val, "/")) {
if (c->flags & CHUNK_PAST_1024) {
if (fbsd_chunk_info[i].c->flags & CHUNK_PAST_1024) {
msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
return 1;
}
c->flags |= CHUNK_IS_ROOT;
fbsd_chunk_info[i].c->flags |= CHUNK_IS_ROOT;
}
if (check_conflict(val)) {
msgConfirm("You already have a mountpoint for %s assigned!", val);
return 1;
}
safe_free(c->private);
part = (PartInfo *)malloc(sizeof(PartInfo));
strncpy(part->mountpoint, val, FILENAME_MAX);
part->newfs = TRUE;
c->private = (void *)part;
c->private_free = free;
safe_free(fbsd_chunk_info[i].c->private);
fbsd_chunk_info[i].c->private = new_part(val, TRUE);
fbsd_chunk_info[i].c->private_free = free;
fbsd_chunk_info[i].p = fbsd_chunk_info[i].c->private;
return 0;
}
return 1;
}
static PartType
get_partition_type(struct chunk *c)
get_partition_type(void)
{
char selection[20];
static unsigned char *fs_types[] = {
@ -228,7 +236,7 @@ get_partition_type(struct chunk *c)
#define PART_MOUNT_COL 8
#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 4)
#define PART_NEWFS_COL (PART_SIZE_COL + 8)
#define PART_OFF 40
#define PART_OFF 42
static void
print_fbsd_chunks(void)
@ -278,22 +286,28 @@ print_fbsd_chunks(void)
}
/* Otherwise it's a swap or filesystem entry, at the bottom */
else {
char *mountpoint, *newfs;
char onestr[PART_OFF], num[10], *mountpoint, *newfs;
memset(onestr, ' ', PART_OFF - 1);
onestr[PART_OFF - 1] = '\0';
/* Go for two columns */
if (prow == (CHUNK_PART_START_ROW + 9))
if (prow == (CHUNK_PART_START_ROW + 8))
pcol = PART_OFF;
else
pcol = 0;
mvaddstr(prow, pcol + PART_PART_COL, fbsd_chunk_info[i].c->name);
memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
strlen(fbsd_chunk_info[i].c->name));
if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
if (fbsd_chunk_info[i].p) {
mountpoint = fbsd_chunk_info[i].p->mountpoint;
newfs = fbsd_chunk_info[i].p->newfs ? "Y" : "N";
}
else {
fbsd_chunk_info[i].c->private = new_part("", FALSE);
fbsd_chunk_info[i].c->private_free = free;
fbsd_chunk_info[i].p = fbsd_chunk_info[i].c->private;
mountpoint = " ";
newfs = " ";
newfs = "N";
}
}
else {
@ -301,11 +315,12 @@ print_fbsd_chunks(void)
newfs = " ";
}
for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
mvaddch(prow, pcol + PART_MOUNT_COL + j, mountpoint[j]);
mvprintw(prow, pcol + PART_SIZE_COL, "%4dMB",
fbsd_chunk_info[i].c->size ?
fbsd_chunk_info[i].c->size / 2048 : 0);
mvaddstr(prow, pcol + PART_NEWFS_COL, newfs);
onestr[PART_MOUNT_COL + j] = mountpoint[j];
sprintf(num, "%4ldMB", fbsd_chunk_info[i].c->size ?
fbsd_chunk_info[i].c->size / 2048 : 0);
memcpy(onestr + PART_SIZE_COL, num, strlen(num));
memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
mvaddstr(prow, pcol, onestr);
++prow;
}
if (i == current_chunk)
@ -345,13 +360,14 @@ partition_disks(struct disk **disks)
print_fbsd_chunks();
print_command_summary();
if (msg) {
standout(); mvprintw(23, 0, msg); standend();
attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
beep();
msg = NULL;
}
refresh();
key = toupper(getch());
switch (key) {
case KEY_UP:
case '-':
if (current_chunk != 0)
@ -382,7 +398,7 @@ partition_disks(struct disk **disks)
case 'C':
if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
msg = "Can only create sub-partitions in a master partition (at top)";
msg = "Can't create a sub-partition here (that only works in master partitions)";
break;
}
sz = space_free(fbsd_chunk_info[current_chunk].c);
@ -397,9 +413,7 @@ partition_disks(struct disk **disks)
if (val && (size = strtol(val, 0, 0)) > 0) {
PartType type;
if (get_mountpoint(fbsd_chunk_info[current_chunk].c))
break;
type = get_partition_type(fbsd_chunk_info[current_chunk].c);
type = get_partition_type();
if (type == PART_NONE)
break;
Create_Chunk(fbsd_chunk_info[current_chunk].d,
@ -409,18 +423,30 @@ partition_disks(struct disk **disks)
part,
type == PART_SWAP ? FS_SWAP : freebsd,
fbsd_chunk_info[current_chunk].c->flags);
if (get_mountpoint(current_chunk))
break;
record_fbsd_chunks(disks);
}
}
break;
case 'D':
case 'D': /* delete */
if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
msg = "Use the Master Partition Editor to delete one of these";
break;
}
Delete_Chunk(fbsd_chunk_info[current_chunk].d,
fbsd_chunk_info[current_chunk].c);
record_fbsd_chunks(disks);
break;
case 'M': /* mount */
if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
msg = "You can't mount one of these directly!";
break;
}
if (get_mountpoint(current_chunk))
record_fbsd_chunks(disks);
break;
case 27: /* ESC */

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: msg.c,v 1.6 1995/05/05 23:47:44 jkh Exp $
* $Id: msg.c,v 1.7 1995/05/07 03:38:01 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -52,7 +52,7 @@ msgYap(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
errstr[0] = '\0';
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -73,7 +73,7 @@ msgInfo(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
errstr[0] = '\0';
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -94,7 +94,7 @@ msgWarn(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Warning: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -116,7 +116,7 @@ msgError(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Error: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -138,7 +138,7 @@ msgFatal(char *fmt, ...)
char *errstr;
int attrs;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
strcpy(errstr, "Fatal Error: ");
va_start(args, fmt);
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
@ -167,7 +167,7 @@ msgConfirm(char *fmt, ...)
va_list args;
char *errstr;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -184,7 +184,7 @@ msgNotify(char *fmt, ...)
va_list args;
char *errstr;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -202,7 +202,7 @@ msgYesNo(char *fmt, ...)
char *errstr;
int ret;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
@ -222,7 +222,7 @@ msgGetInput(char *buf, char *fmt, ...)
static char input_buffer[256];
int rval;
errstr = (char *)malloc(FILENAME_MAX);
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);