pass lint[pass1]

This commit is contained in:
christos 2003-01-10 20:00:27 +00:00
parent e756303d08
commit 2d7e213ded
27 changed files with 273 additions and 247 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aout2elf.c,v 1.2 2002/02/03 22:44:21 skrll Exp $ /* $NetBSD: aout2elf.c,v 1.3 2003/01/10 20:00:27 christos Exp $
* *
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
* All rights reserved. * All rights reserved.
@ -46,6 +46,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <err.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
@ -132,7 +133,7 @@ handle_aout_libs(const char *dir, int op, const void *arg)
{ {
DIR *dd; DIR *dd;
struct dirent *dp; struct dirent *dp;
char *fullname; char *full_name;
const char *destdir; const char *destdir;
int n; int n;
@ -161,9 +162,12 @@ handle_aout_libs(const char *dir, int op, const void *arg)
if (strncmp(dp->d_name, "lib", 3) != 0) if (strncmp(dp->d_name, "lib", 3) != 0)
continue; continue;
asprintf(&fullname, "%s/%s", dir, dp->d_name); if (asprintf(&full_name, "%s/%s", dir, dp->d_name) == -1) {
warn("Out of memory");
continue;
}
if (!is_aout_shared_lib(fullname)) if (!is_aout_shared_lib(full_name))
goto endloop; goto endloop;
switch (op) { switch (op) {
@ -172,12 +176,12 @@ handle_aout_libs(const char *dir, int op, const void *arg)
break; break;
case LIB_MOVE: case LIB_MOVE:
run_prog(0, NULL, "mv -f %s %s/%s", run_prog(0, NULL, "mv -f %s %s/%s",
fullname, destdir, dp->d_name); full_name, destdir, dp->d_name);
break; break;
} }
endloop: endloop:
free(fullname); free(full_name);
} }
closedir(dd); closedir(dd);

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.4 2002/12/05 01:17:20 fvdl Exp $ */ /* $NetBSD: md.c,v 1.5 2003/01/10 20:00:29 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -48,6 +48,8 @@
#include <stdio.h> #include <stdio.h>
#include <util.h> #include <util.h>
#include <dirent.h> #include <dirent.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.26 2002/12/22 12:07:35 lukem Exp $ */ /* $NetBSD: md.c,v 1.27 2003/01/10 20:00:29 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,6 +42,8 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <stdio.h> #include <stdio.h>
#include <util.h> #include <util.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.2 2002/12/22 12:07:35 lukem Exp $ */ /* $NetBSD: md.c,v 1.3 2003/01/10 20:00:30 christos Exp $ */
/* /*
* Copyright 1997,2002 Piermont Information Systems Inc. * Copyright 1997,2002 Piermont Information Systems Inc.
@ -42,6 +42,8 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <stdio.h> #include <stdio.h>
#include <util.h> #include <util.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.16 2002/12/05 01:17:23 fvdl Exp $ */ /* $NetBSD: md.c,v 1.17 2003/01/10 20:00:30 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -43,6 +43,8 @@
#include <sys/param.h> #include <sys/param.h>
#include <machine/cpu.h> #include <machine/cpu.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.66 2002/12/05 01:17:24 fvdl Exp $ */ /* $NetBSD: md.c,v 1.67 2003/01/10 20:00:30 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -48,6 +48,8 @@
#include <stdio.h> #include <stdio.h>
#include <util.h> #include <util.h>
#include <dirent.h> #include <dirent.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"
@ -55,8 +57,7 @@
char mbr[512]; char mbr[512];
char kernstr[STRSIZE]; int mbr_len;
int mbr_present, mbr_len;
int c1024_resp; int c1024_resp;
struct disklist *disklist = NULL; struct disklist *disklist = NULL;
struct nativedisk_info *nativedisk; struct nativedisk_info *nativedisk;
@ -94,7 +95,7 @@ md_get_info()
md_bios_info(diskdev); md_bios_info(diskdev);
edit: edit:
edit_mbr((struct mbr_partition *)&mbr[MBR_PARTOFF]); edit_mbr((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF]);
if (mbr_part_above_chs(part) && if (mbr_part_above_chs(part) &&
(biosdisk == NULL || !(biosdisk->bi_flags & BIFLAG_EXTINT13))) { (biosdisk == NULL || !(biosdisk->bi_flags & BIFLAG_EXTINT13))) {
@ -164,11 +165,11 @@ md_read_bootcode(path, buf, len)
close(fd); close(fd);
return -1; return -1;
} }
if (lseek(fd, MBR_MAGICOFF, SEEK_SET) < 0) { if (lseek(fd, (off_t)MBR_MAGICOFF, SEEK_SET) < 0) {
close(fd); close(fd);
return -1; return -1;
} }
cc = read(fd, &buf[MBR_MAGICOFF], st.st_size - MBR_MAGICOFF); cc = read(fd, &buf[MBR_MAGICOFF], (size_t)(st.st_size - MBR_MAGICOFF));
close(fd); close(fd);
@ -379,7 +380,7 @@ custom:
/* XXX UGH! need arguments to process_menu */ /* XXX UGH! need arguments to process_menu */
switch (c1024_resp) { switch (c1024_resp) {
case 1: case 1:
edit_mbr((struct mbr_partition *)&mbr[MBR_PARTOFF]); edit_mbr((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF]);
/*FALLTHROUGH*/ /*FALLTHROUGH*/
case 2: case 2:
goto editlab; goto editlab;
@ -461,7 +462,7 @@ md_upgrade_mbrtype()
if (read_mbr(diskdev, mbr, sizeof mbr) < 0) if (read_mbr(diskdev, mbr, sizeof mbr) < 0)
return; return;
mbrp = (struct mbr_partition *)&mbr[MBR_PARTOFF]; mbrp = (struct mbr_partition *)(void *)&mbr[MBR_PARTOFF];
for (i = 0; i < NMBRPART; i++) { for (i = 0; i < NMBRPART; i++) {
if (mbrp[i].mbrp_typ == MBR_PTYPE_386BSD) { if (mbrp[i].mbrp_typ == MBR_PTYPE_386BSD) {
@ -534,7 +535,8 @@ int
md_bios_info(dev) md_bios_info(dev)
char *dev; char *dev;
{ {
int mib[2], i, len; int mib[2], i;
size_t len;
struct biosdisk_info *bip; struct biosdisk_info *bip;
struct nativedisk_info *nip = NULL, *nat; struct nativedisk_info *nip = NULL, *nat;
int cyl, head, sec; int cyl, head, sec;
@ -625,11 +627,11 @@ static void
configure_bootsel() configure_bootsel()
{ {
struct mbr_partition *parts = struct mbr_partition *parts =
(struct mbr_partition *)&mbr[MBR_PARTOFF]; (struct mbr_partition *)(void *)&mbr[MBR_PARTOFF];
int i; int i;
mbs = (struct mbr_bootsel *)&mbr[MBR_BOOTSELOFF]; mbs = (struct mbr_bootsel *)(void *)&mbr[MBR_BOOTSELOFF];
mbs->flags = BFL_SELACTIVE; mbs->flags = BFL_SELACTIVE;
/* Setup default labels for partitions, since if not done by user */ /* Setup default labels for partitions, since if not done by user */
@ -653,6 +655,7 @@ configure_bootsel()
} }
void void
/*ARGSUSED*/
disp_bootsel(part, mbsp) disp_bootsel(part, mbsp)
struct mbr_partition *part; struct mbr_partition *part;
struct mbr_bootsel *mbsp; struct mbr_bootsel *mbsp;
@ -698,12 +701,14 @@ md_init()
{ {
} }
#ifdef notdef
void void
md_set_sizemultname() md_set_sizemultname()
{ {
set_sizemultname_meg(); set_sizemultname_meg();
} }
#endif
void void
md_set_no_x() md_set_no_x()

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md.en,v 1.38 2002/09/09 10:53:49 grant Exp $ */ /* $NetBSD: menus.md.en,v 1.39 2003/01/10 20:00:30 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -81,7 +81,7 @@ menu dlgeom, title "Choose an option";
menu editparttable, title "Choose your partition", exit; menu editparttable, title "Choose your partition", exit;
display action { msg_display (MSG_editparttable); display action { msg_display (MSG_editparttable);
disp_cur_part((struct mbr_partition *)&mbr[MBR_PARTOFF disp_cur_part((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF
], activepart,-1); ], activepart,-1);
}; };
option "Edit partition 0", sub menu editpart, option "Edit partition 0", sub menu editpart,
@ -97,7 +97,7 @@ menu editparttable, title "Choose your partition", exit;
menu editpart, title "Select to change"; menu editpart, title "Select to change";
display action { msg_display (MSG_editpart, editpart); display action { msg_display (MSG_editpart, editpart);
disp_cur_part((struct mbr_partition *)&mbr[MBR_PARTOFF disp_cur_part((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF
], editpart,-1); ], editpart,-1);
msg_display_add(MSG_newline); msg_display_add(MSG_newline);
}; };
@ -287,7 +287,7 @@ menu biosmultmatch;
menu configbootsel, y=16, title "Change a bootmenu item", exit; menu configbootsel, y=16, title "Change a bootmenu item", exit;
display action { msg_display(MSG_configbootsel); display action { msg_display(MSG_configbootsel);
disp_bootsel((struct mbr_partition *)&mbr[MBR_PARTOFF], mbs); disp_bootsel((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF], mbs);
msg_display_add(MSG_bootseltimeout, (1000 * mbs->timeo) / 18200); msg_display_add(MSG_bootseltimeout, (1000 * mbs->timeo) / 18200);
msg_display_add(MSG_defbootselopt); msg_display_add(MSG_defbootselopt);
if (mbs->defkey == SCAN_ENTER) if (mbs->defkey == SCAN_ENTER)

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md.fr,v 1.32 2002/09/27 15:21:54 grant Exp $ */ /* $NetBSD: menus.md.fr,v 1.33 2003/01/10 20:00:30 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -82,7 +82,7 @@ menu dlgeom, title "Choisissez une option";
menu editparttable, title "Choisissez votre partition", exit; menu editparttable, title "Choisissez votre partition", exit;
display action { msg_display (MSG_editparttable); display action { msg_display (MSG_editparttable);
disp_cur_part((struct mbr_partition *)&mbr[MBR_PARTOFF disp_cur_part((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF
], activepart,-1); ], activepart,-1);
}; };
option "Edition de la partition 0", sub menu editpart, option "Edition de la partition 0", sub menu editpart,
@ -98,7 +98,7 @@ menu editparttable, title "Choisissez votre partition", exit;
menu editpart, title "Changement"; menu editpart, title "Changement";
display action { msg_display (MSG_editpart, editpart); display action { msg_display (MSG_editpart, editpart);
disp_cur_part((struct mbr_partition *)&mbr[MBR_PARTOFF disp_cur_part((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF
], activepart,editpart); ], activepart,editpart);
msg_display_add(MSG_newline); msg_display_add(MSG_newline);
}; };
@ -259,7 +259,7 @@ menu biosmultmatch;
menu configbootsel, title "Changer une entree du menu", exit; menu configbootsel, title "Changer une entree du menu", exit;
display action { msg_display(MSG_configbootsel); display action { msg_display(MSG_configbootsel);
disp_bootsel((struct mbr_partition *)&mbr[MBR_PARTOFF], mbs); disp_bootsel((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF], mbs);
msg_display_add(MSG_bootseltimeout, (1000 * mbs->timeo) / 18200); msg_display_add(MSG_bootseltimeout, (1000 * mbs->timeo) / 18200);
msg_display_add(MSG_defbootselopt); msg_display_add(MSG_defbootselopt);
if (mbs->defkey == SCAN_ENTER) if (mbs->defkey == SCAN_ENTER)

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md.pl,v 1.3 2002/07/25 15:19:18 grant Exp $ */ /* $NetBSD: menus.md.pl,v 1.4 2003/01/10 20:00:30 christos Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: menus.md.en,v 1.36 2001/11/29 23:20:58 thorpej Exp */ /* NetBSD: menus.md.en,v 1.36 2001/11/29 23:20:58 thorpej Exp */
@ -83,7 +83,7 @@ menu dlgeom, title "Wybierz opcje";
menu editparttable, title "Wybierz swoje partycje", exit; menu editparttable, title "Wybierz swoje partycje", exit;
display action { msg_display (MSG_editparttable); display action { msg_display (MSG_editparttable);
disp_cur_part((struct mbr_partition *)&mbr[MBR_PARTOFF disp_cur_part((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF
], activepart,-1); ], activepart,-1);
}; };
option "Edytuj partycje 0", sub menu editpart, option "Edytuj partycje 0", sub menu editpart,
@ -99,7 +99,7 @@ menu editparttable, title "Wybierz swoje partycje", exit;
menu editpart, title "Wybierz aby zmienic"; menu editpart, title "Wybierz aby zmienic";
display action { msg_display (MSG_editpart, editpart); display action { msg_display (MSG_editpart, editpart);
disp_cur_part((struct mbr_partition *)&mbr[MBR_PARTOFF disp_cur_part((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF
], editpart,-1); ], editpart,-1);
msg_display_add(MSG_newline); msg_display_add(MSG_newline);
}; };
@ -288,7 +288,7 @@ menu biosmultmatch;
menu configbootsel, y=16, title "Zmien bootmenu", exit; menu configbootsel, y=16, title "Zmien bootmenu", exit;
display action { msg_display(MSG_configbootsel); display action { msg_display(MSG_configbootsel);
disp_bootsel((struct mbr_partition *)&mbr[MBR_PARTOFF], mbs); disp_bootsel((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF], mbs);
msg_display_add(MSG_bootseltimeout, (1000 * mbs->timeo) / 18200); msg_display_add(MSG_bootseltimeout, (1000 * mbs->timeo) / 18200);
msg_display_add(MSG_defbootselopt); msg_display_add(MSG_defbootselopt);
if (mbs->defkey == SCAN_ENTER) if (mbs->defkey == SCAN_ENTER)

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.26 2002/12/05 01:17:25 fvdl Exp $ */ /* $NetBSD: md.c,v 1.27 2003/01/10 20:00:30 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,6 +44,8 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.4 2002/12/05 01:17:28 fvdl Exp $ */ /* $NetBSD: md.c,v 1.5 2003/01/10 20:00:31 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -43,6 +43,8 @@
#include <stdio.h> #include <stdio.h>
#include <util.h> #include <util.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include <machine/cpu.h> #include <machine/cpu.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.4 2002/12/22 12:07:35 lukem Exp $ */ /* $NetBSD: md.c,v 1.5 2003/01/10 20:00:31 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,6 +42,8 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <stdio.h> #include <stdio.h>
#include <util.h> #include <util.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2002/12/05 02:05:56 fvdl Exp $ */ /* $NetBSD: md.c,v 1.2 2003/01/10 20:00:31 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -48,6 +48,8 @@
#include <stdio.h> #include <stdio.h>
#include <util.h> #include <util.h>
#include <dirent.h> #include <dirent.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
#include "msg_defs.h" #include "msg_defs.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.73 2002/12/05 01:17:15 fvdl Exp $ */ /* $NetBSD: defs.h,v 1.74 2003/01/10 20:00:27 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -40,7 +40,6 @@
/* System includes needed for this. */ /* System includes needed for this. */
#include <sys/types.h> #include <sys/types.h>
#define FSTYPENAMES
#include <sys/disklabel.h> #include <sys/disklabel.h>
#include "msg_defs.h" #include "msg_defs.h"
@ -77,8 +76,8 @@
/* Round up to the next full cylinder size */ /* Round up to the next full cylinder size */
#define NUMSEC(size,sizemult,cylsize) \ #define NUMSEC(size,sizemult,cylsize) \
((size == -1) ? -1 : (sizemult == 1) ? (size) : \ (((int)(size) == -1) ? -1 : (int)((sizemult == 1) ? (size) : \
(((size)*(sizemult)+(cylsize)-1)/(cylsize))*(cylsize)) (((size)*(sizemult)+(cylsize)-1)/(cylsize))*(cylsize)))
/* What FS type? */ /* What FS type? */
#define PI_ISBSDFS(p) ((p)->pi_fstype == FS_BSDLFS || \ #define PI_ISBSDFS(p) ((p)->pi_fstype == FS_BSDLFS || \

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.47 2002/12/05 01:17:16 fvdl Exp $ */ /* $NetBSD: disks.c,v 1.48 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -49,6 +49,8 @@
#include <sys/param.h> #include <sys/param.h>
#include <ufs/ufs/dinode.h> #include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h> #include <ufs/ffs/fs.h>
#define FSTYPENAMES
#include <sys/disklabel.h>
#include "defs.h" #include "defs.h"
#include "md.h" #include "md.h"
@ -60,7 +62,7 @@
/* Local prototypes */ /* Local prototypes */
static void get_disks (void); static void get_disks (void);
static void foundffs (struct data *list, int num); static void foundffs (struct data *list, size_t num);
static int do_fsck(const char *diskpart); static int do_fsck(const char *diskpart);
static int fsck_root (void); static int fsck_root (void);
static int static int
@ -239,8 +241,9 @@ write_disklabel (void)
/* disklabel the disk */ /* disklabel the disk */
return run_prog(RUN_DISPLAY, MSG_cmdfail, return run_prog(RUN_DISPLAY, MSG_cmdfail,
"%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname); "%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname);
#endif #else
return 0; return 0;
#endif
} }
int int
@ -271,7 +274,7 @@ make_filesystems(void)
static int static int
do_flfs_newfs(const char *partname, int partno, const char *mountpoint) do_flfs_newfs(const char *partname, int partno, const char *mountpoint)
{ {
char devname[STRSIZE]; char dev_name[STRSIZE];
int error; int error;
if (*mountpoint && !preservemount[partno]) if (*mountpoint && !preservemount[partno])
@ -281,13 +284,13 @@ do_flfs_newfs(const char *partname, int partno, const char *mountpoint)
else else
error = 0; error = 0;
if (*mountpoint && error == 0) { if (*mountpoint && error == 0) {
snprintf(devname, STRSIZE, "/dev/%s", partname); snprintf(dev_name, sizeof(dev_name), "/dev/%s", partname);
if (partno > 0) /* XXX strcmp(mountpoint, "/") ? XXX */ if (partno > 0) /* XXX strcmp(mountpoint, "/") ? XXX */
make_target_dir(mountpoint); make_target_dir(mountpoint);
error = target_mount(bsdlabel[partno].pi_fstype == FS_BSDFFS ? error = target_mount(bsdlabel[partno].pi_fstype == FS_BSDFFS ?
"-v -o async" : "-v", devname, mountpoint); "-v -o async" : "-v", dev_name, mountpoint);
if (error) { if (error) {
msg_display(MSG_mountfail, devname, mountpoint); msg_display(MSG_mountfail, dev_name, mountpoint);
process_menu (MENU_ok); process_menu (MENU_ok);
} }
} }
@ -298,7 +301,7 @@ int
make_fstab(void) make_fstab(void)
{ {
FILE *f; FILE *f;
int i, swapdev = -1; int i, swap_dev = -1;
/* Create the fstab. */ /* Create the fstab. */
make_target_dir("/etc"); make_target_dir("/etc");
@ -345,13 +348,13 @@ make_fstab(void)
scripting_fprintf(f, "%s/dev/%s%c %s msdos rw 0 0\n", s, scripting_fprintf(f, "%s/dev/%s%c %s msdos rw 0 0\n", s,
diskdev, 'a'+i, fsmount[i]); diskdev, 'a'+i, fsmount[i]);
} else if (bsdlabel[i].pi_fstype == FS_SWAP) { } else if (bsdlabel[i].pi_fstype == FS_SWAP) {
if (swapdev == -1) if (swap_dev == -1)
swapdev = i; swap_dev = i;
scripting_fprintf(f, "/dev/%s%c none swap sw 0 0\n", diskdev, 'a'+i); scripting_fprintf(f, "/dev/%s%c none swap sw 0 0\n", diskdev, 'a'+i);
} }
if (layout_tmp) { if (layout_tmp) {
if (swapdev != -1) if (swap_dev != -1)
scripting_fprintf(f, "/dev/%s%c /tmp mfs rw\n", diskdev, 'a'+swapdev); scripting_fprintf(f, "/dev/%s%c /tmp mfs rw\n", diskdev, 'a'+swap_dev);
else else
scripting_fprintf(f, "swap /tmp mfs rw\n"); scripting_fprintf(f, "swap /tmp mfs rw\n");
} }
@ -385,7 +388,7 @@ static struct lookfor fstabbuf[] = {
{"/dev/", "/dev/%s %s ffs %s", "c", NULL, 0, 0, foundffs}, {"/dev/", "/dev/%s %s ffs %s", "c", NULL, 0, 0, foundffs},
{"/dev/", "/dev/%s %s ufs %s", "c", NULL, 0, 0, foundffs}, {"/dev/", "/dev/%s %s ufs %s", "c", NULL, 0, 0, foundffs},
}; };
static int numfstabbuf = sizeof(fstabbuf) / sizeof(struct lookfor); static size_t numfstabbuf = sizeof(fstabbuf) / sizeof(struct lookfor);
#define MAXDEVS 40 #define MAXDEVS 40
@ -394,7 +397,8 @@ static char mnt[MAXDEVS][STRSIZE];
static int devcnt = 0; static int devcnt = 0;
static void static void
foundffs(struct data *list, int num) /*ARGSUSED*/
foundffs(struct data *list, size_t num)
{ {
if (strcmp(list[1].u.s_val, "/") != 0 && if (strcmp(list[1].u.s_val, "/") != 0 &&
strstr(list[2].u.s_val, "noauto") == NULL) { strstr(list[2].u.s_val, "noauto") == NULL) {
@ -412,7 +416,6 @@ inode_kind(char *dev)
char pad[SBSIZE]; char pad[SBSIZE];
} fs; } fs;
int fd; int fd;
int ret;
fd = open(dev, O_RDONLY, 0); fd = open(dev, O_RDONLY, 0);
if (fd < 0) if (fd < 0)
@ -421,7 +424,7 @@ inode_kind(char *dev)
close(fd); close(fd);
return -1; return -1;
} }
if ((ret = read(fd, &fs, SBSIZE)) != SBSIZE) { if (read(fd, &fs, SBSIZE) != SBSIZE) {
close(fd); close(fd);
return -2; return -2;
} }
@ -447,14 +450,14 @@ inode_kind(char *dev)
static int static int
do_fsck(const char *diskpart) do_fsck(const char *diskpart)
{ {
char raw[SSTRSIZE]; char rraw[SSTRSIZE];
int inodetype; int inodetype;
char *upgr = "", *prog = "/sbin/fsck_ffs"; char *upgr = "", *prog = "/sbin/fsck_ffs";
int err; int err;
/* cons up raw partition name. */ /* cons up raw partition name. */
snprintf (raw, SSTRSIZE, "/dev/r%s", diskpart); snprintf (rraw, sizeof(rraw), "/dev/r%s", diskpart);
inodetype = inode_kind (raw); inodetype = inode_kind (rraw);
if (inodetype == -4) { if (inodetype == -4) {
if (check_lfs_progs() == 0) if (check_lfs_progs() == 0)
@ -465,7 +468,7 @@ do_fsck(const char *diskpart)
return inodetype; return inodetype;
} else if (inodetype == 0) { } else if (inodetype == 0) {
/* Ask to upgrade */ /* Ask to upgrade */
msg_display(MSG_upgrinode, raw); msg_display(MSG_upgrinode, rraw);
process_menu(MENU_yesno); process_menu(MENU_yesno);
if (yesno) if (yesno)
upgr = "-c 3 "; upgr = "-c 3 ";
@ -473,9 +476,9 @@ do_fsck(const char *diskpart)
/*endwin();*/ /*endwin();*/
#ifndef DEBUG_SETS #ifndef DEBUG_SETS
err = run_prog(RUN_DISPLAY, NULL, "%s %s%s", prog, upgr, raw); err = run_prog(RUN_DISPLAY, NULL, "%s %s%s", prog, upgr, rraw);
#else #else
err = run_prog(RUN_DISPLAY, NULL, "%s -f %s%s", prog, upgr, raw); err = run_prog(RUN_DISPLAY, NULL, "%s -f %s%s", prog, upgr, rraw);
#endif #endif
wrefresh(stdscr); wrefresh(stdscr);
return err; return err;
@ -513,16 +516,16 @@ int target_mount_with_error_menu(const char *opt,
char *diskpart, const char *mntpoint) char *diskpart, const char *mntpoint)
{ {
int error; int error;
char devname[STRSIZE]; char dev_name[STRSIZE];
snprintf(devname, STRSIZE, "/dev/%s", diskpart); snprintf(dev_name, sizeof(dev_name), "/dev/%s", diskpart);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "sysinst: mount_with_error_menu: %s %s %s\n", fprintf(stderr, "sysinst: mount_with_error_menu: %s %s %s\n",
opt, devname, mntpoint); opt, dev_name, mntpoint);
#endif #endif
if ((error = target_mount(opt, devname, mntpoint)) != 0) { if ((error = target_mount(opt, dev_name, mntpoint)) != 0) {
msg_display (MSG_badmount, devname, ""); msg_display (MSG_badmount, dev_name, "");
process_menu (MENU_ok); process_menu (MENU_ok);
return error; return error;
} else { } else {
@ -602,7 +605,7 @@ fsck_disks(void)
process_menu(MENU_ok); process_menu(MENU_ok);
return 0; return 0;
} }
walk(fstab, fstabsize, fstabbuf, numfstabbuf); walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf);
free(fstab); free(fstab);
for (i = 0; i < devcnt; i++) { for (i = 0; i < devcnt; i++) {
@ -624,6 +627,7 @@ int
set_swap(dev, pp, enable) set_swap(dev, pp, enable)
const char *dev; const char *dev;
partinfo *pp; partinfo *pp;
int enable;
{ {
partinfo parts[16]; partinfo parts[16];
int i, maxpart; int i, maxpart;

View File

@ -1,4 +1,4 @@
/* $NetBSD: factor.c,v 1.11 2000/12/22 10:12:12 mrg Exp $ */ /* $NetBSD: factor.c,v 1.12 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,8 +42,6 @@
#include <stdio.h> #include <stdio.h>
static void build_primes (long max);
void factor (long val, long *fact_list, int fact_size, int *num_fact);
/* /*
* primes - prime table, built to include up to 46345 because * primes - prime table, built to include up to 46345 because
@ -53,9 +51,13 @@ void factor (long val, long *fact_list, int fact_size, int *num_fact);
* about 19K of space on the binary image. * about 19K of space on the binary image.
*/ */
#ifdef TESTING
long primes[4800]; long primes[4800];
int num_primes = 2; int num_primes = 2;
static void build_primes (long max);
void factor (long val, long *fact_list, int fact_size, int *num_fact);
static void static void
build_primes(max) build_primes(max)
long max; long max;
@ -118,7 +120,6 @@ factor(val, fact_list, fact_size, num_fact)
} }
#ifdef TESTING
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: geom.c,v 1.4 2001/01/14 02:38:14 mrg Exp $ */ /* $NetBSD: geom.c,v 1.5 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright (c) 1995, 1997 Jason R. Thorpe. * Copyright (c) 1995, 1997 Jason R. Thorpe.
@ -56,7 +56,7 @@ get_geom(disk, l)
if (fd < 0) if (fd < 0)
return 0; return 0;
if (ioctl(fd, DIOCGDEFLABEL, (char *)l) < 0) { if (ioctl(fd, DIOCGDEFLABEL, l) < 0) {
(void)close(fd); (void)close(fd);
return 0; return 0;
} }
@ -77,7 +77,7 @@ get_real_geom(disk, l)
if (fd < 0) if (fd < 0)
return 0; return 0;
if (ioctl(fd, DIOCGDINFO, (char *)l) < 0) { if (ioctl(fd, DIOCGDINFO, l) < 0) {
(void)close(fd); (void)close(fd);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: label.c,v 1.23 2002/12/23 10:29:57 jdolecek Exp $ */ /* $NetBSD: label.c,v 1.24 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: label.c,v 1.23 2002/12/23 10:29:57 jdolecek Exp $"); __RCSID("$NetBSD: label.c,v 1.24 2003/01/10 20:00:28 christos Exp $");
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -156,7 +156,7 @@ edit_and_check_label(lp, nparts, rawpart, bsdpart)
int rawpart; int rawpart;
int bsdpart; int bsdpart;
{ {
while (1) { for (;;) {
int i, j; int i, j;
/* first give the user the option to edit the label... */ /* first give the user the option to edit the label... */
@ -198,7 +198,9 @@ emptylabel(lp)
} }
} }
#ifdef notdef
int int
/*ARGSUSED*/
savenewlabel(lp, nparts) savenewlabel(lp, nparts)
partinfo *lp; partinfo *lp;
int nparts; int nparts;
@ -248,6 +250,7 @@ savenewlabel(lp, nparts)
fflush(NULL); fflush(NULL);
return(0); return(0);
} }
#endif
/* /*
@ -335,7 +338,7 @@ getpartoff(msg_no, defpartstart)
int i, localsizemult, partn; int i, localsizemult, partn;
maxpartc = 'a' + getmaxpartitions() - 1; maxpartc = 'a' + getmaxpartitions() - 1;
while (1) { for (;;) {
msg_table_add(MSG_label_offset_special, maxpartc, maxpartc); msg_table_add(MSG_label_offset_special, maxpartc, maxpartc);
snprintf (isize, 20, "%d", (defpartstart)/sizemult); snprintf (isize, 20, "%d", (defpartstart)/sizemult);
msg_prompt_add(msg_no, (defpartstart > 0) ? isize : NULL, msg_prompt_add(msg_no, (defpartstart > 0) ? isize : NULL,
@ -382,7 +385,7 @@ getpartsize(msg_no, partstart, defpartsize)
int partn; int partn;
maxpartc = 'a' + getmaxpartitions() - 1; maxpartc = 'a' + getmaxpartitions() - 1;
while (1) { for (;;) {
msg_table_add(MSG_label_size_special, maxpartc); msg_table_add(MSG_label_size_special, maxpartc);
snprintf (isize, 20, "%d", (defpartsize)/sizemult); snprintf (isize, 20, "%d", (defpartsize)/sizemult);
msg_prompt_add (msg_no, (defpartsize != 0) ? isize : 0, msg_prompt_add (msg_no, (defpartsize != 0) ? isize : 0,

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.29 2002/12/05 01:17:16 fvdl Exp $ */ /* $NetBSD: main.c,v 1.30 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -157,7 +157,7 @@ main(argc, argv)
process_menu(MENU_netbsd); process_menu(MENU_netbsd);
exit_cleanly = 1; exit_cleanly = 1;
exit(0); return (0);
} }
@ -380,7 +380,7 @@ void process_f_flag (char *f_name)
fprintf (stderr, msg_string(MSG_config_read_error), f_name); fprintf (stderr, msg_string(MSG_config_read_error), f_name);
exit (1); exit (1);
} }
buffer[statinfo.st_size] = 0; buffer[(size_t)statinfo.st_size] = 0;
/* close the file */ /* close the file */
close (fd); close (fd);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mbr.c,v 1.29 2002/12/05 01:17:16 fvdl Exp $ */ /* $NetBSD: mbr.c,v 1.30 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -111,6 +111,7 @@ static void convert_mbr_chs (int, int, int, u_int8_t *, u_int8_t *,
u_int8_t *, u_int32_t); u_int8_t *, u_int32_t);
#ifdef notdef
/* /*
* First, geometry stuff... * First, geometry stuff...
*/ */
@ -120,6 +121,7 @@ check_geom()
return bcyl <= 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0; return bcyl <= 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
} }
#endif
/* /*
* get C/H/S geometry from user via menu interface and * get C/H/S geometry from user via menu interface and
@ -145,6 +147,7 @@ set_bios_geom(cyl, head, sec)
bsec = atoi(res); bsec = atoi(res);
} }
#ifdef notdef
void void
disp_cur_geom() disp_cur_geom()
{ {
@ -152,6 +155,7 @@ disp_cur_geom()
msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec); msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec);
msg_display_add(MSG_biosgeom, bcyl, bhead, bsec); msg_display_add(MSG_biosgeom, bcyl, bhead, bsec);
} }
#endif
/* /*
@ -194,7 +198,6 @@ edit_mbr(partition)
int otherparts = 0; int otherparts = 0;
int ourparts = 0; int ourparts = 0;
int i;
/* Count nonempty, non-BSD partitions. */ /* Count nonempty, non-BSD partitions. */
for (i = 0; i < NMBRPART; i++) { for (i = 0; i < NMBRPART; i++) {
otherparts += otherpart(part[i].mbrp_typ); otherparts += otherpart(part[i].mbrp_typ);
@ -403,7 +406,7 @@ disp_cur_part(part, sel, disp)
int int
read_mbr(disk, buf, len) read_mbr(disk, buf, len)
char *disk, *buf; char *disk, *buf;
int len; size_t len;
{ {
char diskpath[MAXPATHLEN]; char diskpath[MAXPATHLEN];
int fd, i; int fd, i;
@ -414,7 +417,7 @@ read_mbr(disk, buf, len)
if (fd < 0) if (fd < 0)
return -1; return -1;
if (lseek(fd, MBR_BBSECTOR * MBR_SECSIZE, SEEK_SET) < 0) { if (lseek(fd, (off_t)(MBR_BBSECTOR * MBR_SECSIZE), SEEK_SET) < 0) {
close(fd); close(fd);
return -1; return -1;
} }
@ -424,7 +427,7 @@ read_mbr(disk, buf, len)
} }
if (valid_mbr(buf)) { if (valid_mbr(buf)) {
mbrp = (struct mbr_partition *)&buf[MBR_PARTOFF]; mbrp = (struct mbr_partition *)(void *)&buf[MBR_PARTOFF];
for (i = 0; i < NMBRPART; i++) { for (i = 0; i < NMBRPART; i++) {
if (mbrp[i].mbrp_typ != 0) { if (mbrp[i].mbrp_typ != 0) {
mbrp[i].mbrp_start = mbrp[i].mbrp_start =
@ -446,7 +449,7 @@ read_mbr(disk, buf, len)
int int
write_mbr(disk, buf, len, convert) write_mbr(disk, buf, len, convert)
char *disk, *buf; char *disk, *buf;
int len; size_t len;
int convert; int convert;
{ {
char diskpath[MAXPATHLEN]; char diskpath[MAXPATHLEN];
@ -459,12 +462,12 @@ write_mbr(disk, buf, len, convert)
if (fd < 0) if (fd < 0)
return -1; return -1;
if (lseek(fd, MBR_BBSECTOR * MBR_SECSIZE, SEEK_SET) < 0) { if (lseek(fd, (off_t)(MBR_BBSECTOR * MBR_SECSIZE), SEEK_SET) < 0) {
close(fd); close(fd);
return -1; return -1;
} }
mbrp = (struct mbr_partition *)&buf[MBR_PARTOFF]; mbrp = (struct mbr_partition *)(void *)&buf[MBR_PARTOFF];
for (i = 0; i < NMBRPART; i++) { for (i = 0; i < NMBRPART; i++) {
if (mbrp[i].mbrp_start == 0 && if (mbrp[i].mbrp_start == 0 &&
mbrp[i].mbrp_size == 0) { mbrp[i].mbrp_size == 0) {
@ -503,7 +506,7 @@ valid_mbr(buf)
{ {
u_int16_t magic; u_int16_t magic;
magic = *((u_int16_t *)&buf[MBR_MAGICOFF]); magic = *((u_int16_t *)(void *)&buf[MBR_MAGICOFF]);
return (le_to_native16(magic) == MBR_MAGIC); return (le_to_native16(magic) == MBR_MAGIC);
} }
@ -547,7 +550,7 @@ guess_biosgeom_from_mbr(buf, cyl, head, sec)
char *buf; char *buf;
int *cyl, *head, *sec; int *cyl, *head, *sec;
{ {
struct mbr_partition *parts = (struct mbr_partition *)&buf[MBR_PARTOFF]; struct mbr_partition *parts = (struct mbr_partition *)(void *)&buf[MBR_PARTOFF];
int cylinders = -1, heads = -1, sectors = -1, i, j; int cylinders = -1, heads = -1, sectors = -1, i, j;
int c1, h1, s1, c2, h2, s2; int c1, h1, s1, c2, h2, s2;
long a1, a2; long a1, a2;
@ -565,7 +568,7 @@ guess_biosgeom_from_mbr(buf, cyl, head, sec)
num = (quad_t)h1*(a2-s2) - (quad_t)h2*(a1-s1); num = (quad_t)h1*(a2-s2) - (quad_t)h2*(a1-s1);
denom = (quad_t)c2*(a1-s1) - (quad_t)c1*(a2-s2); denom = (quad_t)c2*(a1-s1) - (quad_t)c1*(a2-s2);
if (denom != 0 && num % denom == 0) { if (denom != 0 && num % denom == 0) {
heads = num / denom; heads = (int)(num / denom);
break; break;
} }
} }
@ -583,7 +586,7 @@ guess_biosgeom_from_mbr(buf, cyl, head, sec)
num = a1 - s1; num = a1 - s1;
denom = c1 * heads + h1; denom = c1 * heads + h1;
if (denom != 0 && num % denom == 0) { if (denom != 0 && num % denom == 0) {
sectors = num / denom; sectors = (int)(num / denom);
break; break;
} }
} }
@ -623,20 +626,20 @@ get_mapping(parts, i, cylinder, head, sector, absolute)
int i, *cylinder, *head, *sector; int i, *cylinder, *head, *sector;
long *absolute; long *absolute;
{ {
struct mbr_partition *part = &parts[i / 2]; struct mbr_partition *apart = &parts[i / 2];
if (part->mbrp_typ == 0) if (apart->mbrp_typ == 0)
return -1; return -1;
if (i % 2 == 0) { if (i % 2 == 0) {
*cylinder = MBR_PCYL(part->mbrp_scyl, part->mbrp_ssect); *cylinder = MBR_PCYL(apart->mbrp_scyl, part->mbrp_ssect);
*head = part->mbrp_shd; *head = apart->mbrp_shd;
*sector = MBR_PSECT(part->mbrp_ssect) - 1; *sector = MBR_PSECT(apart->mbrp_ssect) - 1;
*absolute = part->mbrp_start; *absolute = apart->mbrp_start;
} else { } else {
*cylinder = MBR_PCYL(part->mbrp_ecyl, part->mbrp_esect); *cylinder = MBR_PCYL(apart->mbrp_ecyl, apart->mbrp_esect);
*head = part->mbrp_ehd; *head = apart->mbrp_ehd;
*sector = MBR_PSECT(part->mbrp_esect) - 1; *sector = MBR_PSECT(apart->mbrp_esect) - 1;
*absolute = part->mbrp_start + part->mbrp_size - 1; *absolute = apart->mbrp_start + apart->mbrp_size - 1;
} }
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: mbr.h,v 1.9 2000/12/22 10:12:13 mrg Exp $ */ /* $NetBSD: mbr.h,v 1.10 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997, 1988 Piermont Information Systems Inc. * Copyright 1997, 1988 Piermont Information Systems Inc.
@ -77,8 +77,8 @@ int partsoverlap (struct mbr_partition *, int, int);
/* from mbr.c */ /* from mbr.c */
int read_mbr (char *, char *, int); int read_mbr (char *, char *, size_t);
int write_mbr (char *, char *, int, int); int write_mbr (char *, char *, size_t, int);
int valid_mbr (char *); int valid_mbr (char *);
int guess_biosgeom_from_mbr (char *, int *, int *, int *); int guess_biosgeom_from_mbr (char *, int *, int *, int *);
int md_bios_info (char *); int md_bios_info (char *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.c,v 1.80 2002/12/05 01:17:17 fvdl Exp $ */ /* $NetBSD: net.c,v 1.81 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -210,7 +210,7 @@ get_ifconfig_info()
char *textbuf; char *textbuf;
char *t, *nt, *ndest; char *t, *nt, *ndest;
const char **ignore; const char **ignore;
int textsize, len; int textsize;
/* Get ifconfig information */ /* Get ifconfig information */
@ -229,7 +229,7 @@ get_ifconfig_info()
*ndest = '\0'; *ndest = '\0';
while ((t = strsep(&nt, " ")) != NULL) { while ((t = strsep(&nt, " ")) != NULL) {
for (ignore = ignored_if_names; *ignore != NULL; ignore++) { for (ignore = ignored_if_names; *ignore != NULL; ignore++) {
len = strlen(*ignore); size_t len = strlen(*ignore);
if (strncmp(t, *ignore, len) == 0 && if (strncmp(t, *ignore, len) == 0 &&
isdigit((unsigned char)t[len])) isdigit((unsigned char)t[len]))
goto loop; goto loop;
@ -254,7 +254,6 @@ get_ifinterface_info()
int textsize; int textsize;
char *t; char *t;
char hostname[MAXHOSTNAMELEN + 1]; char hostname[MAXHOSTNAMELEN + 1];
int max_len;
char *dot; char *dot;
/* First look to see if the selected interface is already configured. */ /* First look to see if the selected interface is already configured. */
@ -318,7 +317,7 @@ get_ifinterface_info()
strncpy(net_host, hostname, sizeof(net_host)); strncpy(net_host, hostname, sizeof(net_host));
} else { } else {
/* split hostname into host/domain parts */ /* split hostname into host/domain parts */
max_len = dot - hostname; size_t max_len = dot - hostname;
max_len = (sizeof(net_host)<max_len)?sizeof(net_host):max_len; max_len = (sizeof(net_host)<max_len)?sizeof(net_host):max_len;
*dot = '\0'; *dot = '\0';
dot++; dot++;
@ -393,7 +392,10 @@ config_network()
{ char *tp; { char *tp;
char defname[255]; char defname[255];
int octet0; int octet0;
int pass, v6config, dhcp_config; int pass, dhcp_config;
#ifdef INET6
int v6config = 1;
#endif
FILE *f; FILE *f;
time_t now; time_t now;
@ -431,11 +433,6 @@ again:
/* Remove that space we added. */ /* Remove that space we added. */
net_dev[strlen(net_dev) - 1] = 0; net_dev[strlen(net_dev) - 1] = 0;
#ifdef INET6
v6config = 1;
#else
v6config = 0;
#endif
/* Preload any defaults we can find */ /* Preload any defaults we can find */
get_ifinterface_info(); get_ifinterface_info();
@ -1028,7 +1025,7 @@ char *line;
int textsize; int textsize;
char *textbuf; char *textbuf;
char *t; char *t;
char *walk; char *walkp;
textsize = collect(T_FILE, &textbuf, "/tmp/dhclient.leases"); textsize = collect(T_FILE, &textbuf, "/tmp/dhclient.leases");
if (textsize < 0) { if (textsize < 0) {
@ -1045,14 +1042,14 @@ char *line;
t = strtok(NULL, " \t\n"); t = strtok(NULL, " \t\n");
/* found the tag, extract the value */ /* found the tag, extract the value */
/* last char should be a ';' */ /* last char should be a ';' */
walk = strrchr(t,';'); walkp = strrchr(t, ';');
if (walk != NULL ) { if (walkp != NULL) {
*walk = '\0'; *walkp = '\0';
} }
/* strip any " from the string */ /* strip any " from the string */
walk = strrchr(t,'"'); walkp = strrchr(t, '"');
if (walk != NULL ) { if (walkp != NULL) {
*walk = '\0'; *walkp = '\0';
t++; t++;
} }
strcpy(targ, t); strcpy(targ, t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: run.c,v 1.36 2002/12/05 01:17:17 fvdl Exp $ */ /* $NetBSD: run.c,v 1.37 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -70,7 +70,6 @@
/* /*
* local prototypes * local prototypes
*/ */
static char* va_prog_cmdstr (const char *cmd, va_list ap);
static int launch_subwin (WINDOW *actionwin, char **args, struct winsize *win, static int launch_subwin (WINDOW *actionwin, char **args, struct winsize *win,
int display, const char **errstr); int display, const char **errstr);
int log_flip (menudesc *); int log_flip (menudesc *);
@ -104,6 +103,7 @@ do_logging(void)
} }
int int
/*ARGSUSED*/
log_flip(menudesc *m) log_flip(menudesc *m)
{ {
time_t tloc; time_t tloc;
@ -131,6 +131,7 @@ log_flip(menudesc *m)
} }
int int
/*ARGSUSED*/
script_flip(menudesc *m) script_flip(menudesc *m)
{ {
time_t tloc; time_t tloc;
@ -241,21 +242,6 @@ do_system(execstr)
} }
/*
* build command tring for do_system() from anonymous args.
* XXX return result is in a static buffer.
*/
static char *
va_prog_cmdstr(const char *cmd, va_list ap)
{
static char command[STRSIZE];
memset(command, 0, STRSIZE);
(void)vsnprintf(command, STRSIZE, cmd, ap);
return (command);
}
/* /*
* launch a program inside a subwindow, and report it's return status when done * launch a program inside a subwindow, and report it's return status when done
*/ */
@ -275,7 +261,6 @@ launch_subwin(actionwin, args, win, flags, errstr)
int dataflow[2]; int dataflow[2];
pid_t child, subchild, pid; pid_t child, subchild, pid;
char ibuf[MAXBUF], obuf[MAXBUF]; char ibuf[MAXBUF], obuf[MAXBUF];
char *command, *p, *argzero, **origargs;
char pktdata; char pktdata;
struct termios rtt; struct termios rtt;
struct termios tt; struct termios tt;
@ -285,14 +270,6 @@ launch_subwin(actionwin, args, win, flags, errstr)
return (1); return (1);
} }
argzero = *args;
origargs = args;
command = (char *)malloc(MAXBUF * sizeof(char));
for (p = *args; p != NULL; p = *++args) {
strcat(command, p);
strcat(command, " ");
}
(void)tcgetattr(STDIN_FILENO, &tt); (void)tcgetattr(STDIN_FILENO, &tt);
if (openpty(&master, &slave, NULL, &tt, win) == -1) { if (openpty(&master, &slave, NULL, &tt, win) == -1) {
*errstr = "openpty() failed"; *errstr = "openpty() failed";
@ -326,7 +303,7 @@ launch_subwin(actionwin, args, win, flags, errstr)
n = read(master, obuf, sizeof(obuf)); n = read(master, obuf, sizeof(obuf));
if (n <= 0) if (n <= 0)
break; break;
write(dataflow[1], obuf, n); write(dataflow[1], obuf, (size_t)n);
} /* while spinning */ } /* while spinning */
_exit(EXIT_SUCCESS); _exit(EXIT_SUCCESS);
} /* subchild, child forks */ } /* subchild, child forks */
@ -338,13 +315,16 @@ launch_subwin(actionwin, args, win, flags, errstr)
(void)tcsetattr(slave, TCSANOW, &rtt); (void)tcsetattr(slave, TCSANOW, &rtt);
login_tty(slave); login_tty(slave);
if (logging) { if (logging) {
fprintf(logfp, "executing: %s\n", command); fprintf(logfp, "executing:");
fflush(logfp); for (i = 0; args[i]; i++)
fprintf(logfp, " %s", args[i]);
fprintf(logfp, "\n");
fclose(logfp); fclose(logfp);
} }
if (scripting) { if (scripting) {
fprintf(script, "%s\n", command); for (i = 0; args[i]; i++)
fflush(script); fprintf(script, "%s ", args[i]);
fprintf(script, "\n");
fclose(script); fclose(script);
} }
/* /*
@ -353,10 +333,10 @@ launch_subwin(actionwin, args, win, flags, errstr)
*/ */
if ((flags & RUN_CHROOT) != 0) if ((flags & RUN_CHROOT) != 0)
chroot(target_prefix()); chroot(target_prefix());
execvp(argzero, origargs); execvp(*args, args);
/* the parent will see this as the output from the /* the parent will see this as the output from the
child */ child */
warn("execvp %s", argzero); warn("execvp %s", *args);
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
break; /* end of child */ break; /* end of child */
default: default:
@ -375,16 +355,16 @@ launch_subwin(actionwin, args, win, flags, errstr)
for (selectfailed = 0;;) { for (selectfailed = 0;;) {
if (selectfailed) { if (selectfailed) {
char *msg = "select(2) failed but no child died?"; char *mmsg = "select(2) failed but no child died?";
if(logging) if(logging)
(void)fprintf(logfp, msg); (void)fprintf(logfp, mmsg);
errx(1, msg); errx(1, mmsg);
} }
read_fd_set = active_fd_set; read_fd_set = active_fd_set;
if (select(FD_SETSIZE, &read_fd_set, NULL, NULL, NULL) < 0) { if (select(FD_SETSIZE, &read_fd_set, NULL, NULL, NULL) < 0) {
if (errno == EINTR) if (errno == EINTR)
goto loop; goto loop;
perror("select"); warn("select");
if (logging) if (logging)
(void)fprintf(logfp, (void)fprintf(logfp,
"select failure: %s\n", strerror(errno)); "select failure: %s\n", strerror(errno));
@ -392,15 +372,19 @@ launch_subwin(actionwin, args, win, flags, errstr)
} else for (i = 0; i < FD_SETSIZE; ++i) { } else for (i = 0; i < FD_SETSIZE; ++i) {
if (FD_ISSET (i, &read_fd_set)) { if (FD_ISSET (i, &read_fd_set)) {
n = read(i, ibuf, MAXBUF); n = read(i, ibuf, MAXBUF);
if (n <= 0) {
warn("read");
continue;
}
if (i == STDIN_FILENO) { if (i == STDIN_FILENO) {
(void)write(master, ibuf, n); (void)write(master, ibuf, (size_t)n);
if ((rtt.c_lflag & ECHO) == 0) if ((rtt.c_lflag & ECHO) == 0)
goto enddisp; goto enddisp;
} }
pktdata = ibuf[0]; pktdata = ibuf[0];
if (pktdata != 0 && i != STDIN_FILENO) { if (pktdata != 0 && i != STDIN_FILENO) {
if (pktdata & TIOCPKT_IOCTL) if (pktdata & TIOCPKT_IOCTL)
rtt = *(struct termios *)ibuf; memcpy(&rtt, ibuf, sizeof(rtt));
goto enddisp; goto enddisp;
} }
for (j=1; j < n; j++) { for (j=1; j < n; j++) {
@ -477,17 +461,18 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
struct winsize win; struct winsize win;
int ret; int ret;
WINDOW *actionwin, *statuswin, *boxwin; WINDOW *actionwin, *statuswin, *boxwin;
char buf2[MAXBUF]; char buf2[MAXBUF], scmd[MAXBUF];
char *command, *p, *args[51], **aps; char *p, *args[256], **aps;
const char *errstr; const char *errstr;
va_start(ap,cmd); va_start(ap,cmd);
sprintf(buf2,"%s",va_prog_cmdstr(cmd,ap)); vsnprintf(buf2, sizeof(buf2), cmd, ap);
strcpy(scmd, buf2);
p = buf2; p = buf2;
command = strdup(buf2);
/* 51 strings and it's blown! */ /* 51 strings and it's blown! */
for (aps = args; (*aps = strsep(&p, " ")) != NULL;) for (aps = args; aps < &args[sizeof(args) / sizeof(args[0])] &&
(*aps = strsep(&p, " ")) != NULL;)
if (**aps != '\0') if (**aps != '\0')
++aps; ++aps;
@ -501,7 +486,7 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
if ((flags & RUN_SYSTEM) != 0) { if ((flags & RUN_SYSTEM) != 0) {
if ((flags & RUN_CHROOT) != 0) if ((flags & RUN_CHROOT) != 0)
chroot(target_prefix()); chroot(target_prefix());
ret = system(command); ret = system(scmd);
} else if ((flags & RUN_DISPLAY) != 0) { } else if ((flags & RUN_DISPLAY) != 0) {
wclear(stdscr); wclear(stdscr);
clearok(stdscr, 1); clearok(stdscr, 1);
@ -550,7 +535,7 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
wmove(statuswin, 1, 4); wmove(statuswin, 1, 4);
waddstr(statuswin, "Command: "); waddstr(statuswin, "Command: ");
wstandout(statuswin); wstandout(statuswin);
waddstr(statuswin, command); waddstr(statuswin, scmd);
wstandend(statuswin); wstandend(statuswin);
wrefresh(statuswin); wrefresh(statuswin);
@ -599,7 +584,7 @@ done:
if ((flags & RUN_FATAL) != 0 && ret != 0) if ((flags & RUN_FATAL) != 0 && ret != 0)
exit(ret); exit(ret);
if (ret && errmsg != MSG_NONE) { if (ret && errmsg != MSG_NONE) {
msg_display(errmsg, command); msg_display(errmsg, scmd);
process_menu(MENU_ok); process_menu(MENU_ok);
} }
return(ret); return(ret);

View File

@ -1,4 +1,4 @@
/* $NetBSD: target.c,v 1.33 2002/12/05 01:17:18 fvdl Exp $ */ /* $NetBSD: target.c,v 1.34 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -75,7 +75,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: target.c,v 1.33 2002/12/05 01:17:18 fvdl Exp $"); __RCSID("$NetBSD: target.c,v 1.34 2003/01/10 20:00:28 christos Exp $");
#endif #endif
/* /*
@ -142,6 +142,7 @@ struct unwind_mount *unwind_mountlist = NULL;
/* /*
* debugging helper. curses... * debugging helper. curses...
*/ */
#if defined(DEBUG) || defined(DEBUG_ROOT)
void void
backtowin() backtowin()
{ {
@ -150,6 +151,7 @@ backtowin()
getchar(); /* wait for user to press return */ getchar(); /* wait for user to press return */
wrefresh(stdscr); wrefresh(stdscr);
} }
#endif
/* /*
* Get name of current root device from kernel via sysctl. * Get name of current root device from kernel via sysctl.
@ -383,7 +385,7 @@ concat_paths(prefix, suffix)
const char* prefix; const char* prefix;
const char *suffix; const char *suffix;
{ {
static char realpath[MAXPATHLEN]; static char real_path[MAXPATHLEN];
/* absolute prefix and null suffix? */ /* absolute prefix and null suffix? */
if (prefix[0] == '/' && suffix[0] == 0) if (prefix[0] == '/' && suffix[0] == 0)
@ -395,10 +397,11 @@ concat_paths(prefix, suffix)
/* avoid "//" */ /* avoid "//" */
if (suffix[0] == '/' || suffix[0] == 0) if (suffix[0] == '/' || suffix[0] == 0)
snprintf(realpath, MAXPATHLEN, "%s%s", prefix, suffix); snprintf(real_path, sizeof(real_path), "%s%s", prefix, suffix);
else else
snprintf(realpath, MAXPATHLEN, "%s/%s", prefix, suffix); snprintf(real_path, sizeof(real_path), "%s/%s",
return (realpath); prefix, suffix);
return (real_path);
} }
/* /*
@ -437,6 +440,7 @@ make_target_dir(path)
make_prefixed_dir(target_prefix(), path); make_prefixed_dir(target_prefix(), path);
} }
#ifdef notdef
/* Make a directory with a pathname in the currently-mounted root. */ /* Make a directory with a pathname in the currently-mounted root. */
void void
make_ramdisk_dir(path) make_ramdisk_dir(path)
@ -446,7 +450,6 @@ make_ramdisk_dir(path)
make_prefixed_dir(path, ""); make_prefixed_dir(path, "");
} }
#if 0
/* unused, will not work with new run.c */ /* unused, will not work with new run.c */
/* /*
* *
@ -549,6 +552,7 @@ target_chdir_or_die(dir)
(void) do_target_chdir(dir, 1); (void) do_target_chdir(dir, 1);
} }
#ifdef notdef
int int
target_chdir(dir) target_chdir(dir)
const char *dir; const char *dir;
@ -556,6 +560,7 @@ target_chdir(dir)
return(do_target_chdir(dir, 0)); return(do_target_chdir(dir, 0));
} }
#endif
/* /*
* Copy a file from the current root into the target system, * Copy a file from the current root into the target system,
@ -567,9 +572,9 @@ cp_to_target(srcpath, tgt_path)
const char *srcpath; const char *srcpath;
const char *tgt_path; const char *tgt_path;
{ {
const char *realpath = target_expand(tgt_path); const char *real_path = target_expand(tgt_path);
return run_prog(0, NULL, "/bin/cp %s %s", srcpath, realpath); return run_prog(0, NULL, "/bin/cp %s %s", srcpath, real_path);
} }
/* /*
@ -668,7 +673,7 @@ mount_with_unwind(fstype, from, on)
void void
unwind_mounts() unwind_mounts()
{ {
struct unwind_mount *m, *prev; struct unwind_mount *m;
volatile static int unwind_in_progress = 0; volatile static int unwind_in_progress = 0;
/* signal safety */ /* signal safety */
@ -676,7 +681,6 @@ unwind_mounts()
return; return;
unwind_in_progress = 1; unwind_in_progress = 1;
prev = NULL;
for (m = unwind_mountlist; m; ) { for (m = unwind_mountlist; m; ) {
struct unwind_mount *prev; struct unwind_mount *prev;
#ifdef DEBUG_UNWIND #ifdef DEBUG_UNWIND
@ -735,14 +739,14 @@ target_test(mode, path)
unsigned int mode; unsigned int mode;
const char *path; const char *path;
{ {
const char *realpath = target_expand(path); const char *real_path = target_expand(path);
register int result; register int result;
result = !file_mode_match(realpath, mode); result = !file_mode_match(real_path, mode);
scripting_fprintf(NULL, "if [ $? != 0 ]; then echo \"%s does not exist!\"; fi\n", realpath); scripting_fprintf(NULL, "if [ $? != 0 ]; then echo \"%s does not exist!\"; fi\n", real_path);
#if defined(DEBUG) #if defined(DEBUG)
printf("target_test(%s %s) returning %d\n", test, realpath, result); printf("target_test(%s %s) returning %d\n", test, real_path, result);
#endif #endif
return (result); return (result);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: txtwalk.c,v 1.6 2000/12/22 10:12:13 mrg Exp $ */ /* $NetBSD: txtwalk.c,v 1.7 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -10,16 +10,16 @@
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, item list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, item list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software * 3. All advertising materials mentioning features or use of item software
* must display the following acknowledgement: * must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by * This product includes software developed for the NetBSD Project by
* Piermont Information Systems Inc. * Piermont Information Systems Inc.
* 4. The name of Piermont Information Systems Inc. may not be used to endorse * 4. The name of Piermont Information Systems Inc. may not be used to endorse
* or promote products derived from this software without specific prior * or promote products derived from item software without specific prior
* written permission. * written permission.
* *
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS'' * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
@ -56,10 +56,10 @@
/* prototypes */ /* prototypes */
static void process (struct lookfor, char *); static void process (struct lookfor *, char *);
static void match (char *, struct lookfor *, int); static void match (char *, struct lookfor *, size_t);
static int finddata (struct lookfor, char *, struct data *, int *); static int finddata (struct lookfor *, char *, struct data *, size_t *);
static char *strndup (char *, int); static char *strndup (char *, size_t);
/* /*
* Walk the buffer, call match for each line. * Walk the buffer, call match for each line.
@ -69,10 +69,10 @@ walk(buffer, size, these, numthese)
char *buffer; char *buffer;
size_t size; size_t size;
struct lookfor *these; struct lookfor *these;
int numthese; size_t numthese;
{ {
int i = 0; size_t i = 0;
int len; size_t len;
int line = 1; int line = 1;
while (i < size) { while (i < size) {
@ -81,7 +81,7 @@ walk(buffer, size, these, numthese)
buffer++; buffer++;
i++; i++;
} else { } else {
/* Assume this starts a line. */ /* Assume item starts a line. */
len = 0; len = 0;
while (buffer[len] != '\n' && buffer[len] != '\0') while (buffer[len] != '\n' && buffer[len] != '\0')
len++; len++;
@ -105,11 +105,11 @@ static void
match(line, these, numthese) match(line, these, numthese)
char *line; char *line;
struct lookfor *these; struct lookfor *these;
int numthese; size_t numthese;
{ {
int linelen; /* Line length */ size_t linelen; /* Line length */
int patlen; /* Pattern length */ size_t patlen; /* Pattern length */
int which; /* Which pattern we are using */ size_t which; /* Which pattern we are using */
linelen = strlen(line); linelen = strlen(line);
@ -118,23 +118,23 @@ match(line, these, numthese)
if (linelen < patlen) if (linelen < patlen)
continue; continue;
if (strncmp(these[which].head, line, patlen) == 0) if (strncmp(these[which].head, line, patlen) == 0)
process(these[which], line); process(&these[which], line);
} }
} }
/* process the matched line. */ /* process the matched line. */
static void static void
process(this, line) process(item, line)
struct lookfor this; struct lookfor *item;
char *line; char *line;
{ {
struct data found[MAXDATA]; struct data found[MAXDATA];
int numfound = 0; size_t numfound = 0;
char *p; char *p;
int i, j; size_t i, j;
if (finddata(this, line, found, &numfound)) { if (finddata(item, line, found, &numfound)) {
#ifdef DEBUG #ifdef DEBUG
printf("process: \"%s\"\n", line); printf("process: \"%s\"\n", line);
for (i = 0; i < numfound; i++) { for (i = 0; i < numfound; i++) {
@ -150,9 +150,9 @@ process(this, line)
} }
#endif #endif
/* Process the stuff. */ /* Process the stuff. */
switch (this.todo[0]) { switch (item->todo[0]) {
case 'a': /* Assign data */ case 'a': /* Assign data */
p = this.todo; p = item->todo;
j = 0; j = 0;
while (*p && *p != '$') while (*p && *p != '$')
p++; p++;
@ -162,14 +162,14 @@ process(this, line)
i = atoi(p); i = atoi(p);
switch (found[i].what) { switch (found[i].what) {
case INT: case INT:
*((int *)this.var+j) *((int *)item->var+j)
= found[i].u.i_val; = found[i].u.i_val;
break; break;
case STR: case STR:
strncpy(*((char **)this.var+j), strncpy(*((char **)item->var+j),
found[i].u.s_val, found[i].u.s_val,
this.size-1); item->size-1);
found[i].u.s_val[this.size-1] = 0; found[i].u.s_val[item->size-1] = 0;
break; break;
} }
while (isdigit(*p)) while (isdigit(*p))
@ -179,12 +179,12 @@ process(this, line)
if (*p) if (*p)
p++; p++;
j++; j++;
if (j >= this.nument) if (j >= item->nument)
break; break;
} }
break; break;
case 'c': /* Call a function with data. */ case 'c': /* Call a function with data. */
(*this.func)(found, numfound); (*item->func)(found, numfound);
break; break;
} }
} }
@ -198,14 +198,14 @@ process(this, line)
* Side Effect -- sets numfound and found. * Side Effect -- sets numfound and found.
*/ */
static int static int
finddata(this, line, found, numfound ) finddata(item, line, found, numfound)
struct lookfor this; struct lookfor *item;
char *line; char *line;
struct data *found; struct data *found;
int *numfound; size_t *numfound;
{ {
char *fmt = this.fmt; char *fmt = item->fmt;
int len; size_t len;
*numfound = 0; *numfound = 0;
while (*fmt) { while (*fmt) {
@ -280,14 +280,14 @@ finddata(this, line, found, numfound )
static char * static char *
strndup(str, len) strndup(str, len)
char *str; char *str;
int len; size_t len;
{ {
int alen; size_t alen;
char *val; char *val;
alen = strlen(str); alen = strlen(str);
alen = len < alen ? len + 1 : alen + 1; alen = len < alen ? len + 1 : alen + 1;
val = (char *)malloc(alen); val = malloc(alen);
if (!val) if (!val)
return NULL; return NULL;
strncpy(val, str, alen-1); strncpy(val, str, alen-1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: txtwalk.h,v 1.6 2000/12/22 10:12:13 mrg Exp $ */ /* $NetBSD: txtwalk.h,v 1.7 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -55,9 +55,9 @@ struct lookfor {
char *fmt; /* Expected format. */ char *fmt; /* Expected format. */
char *todo; /* What to do ... */ char *todo; /* What to do ... */
void *var; /* Possible var */ void *var; /* Possible var */
int nument; /* Number of entries in the "array" */ size_t nument; /* Number of entries in the "array" */
int size; /* size of string variables */ size_t size; /* size of string variables */
void (*func) (struct data *list, int num); /* function to call */ void (*func) (struct data *list, size_t num); /* function to call */
}; };
/* Format string for the expected string: /* Format string for the expected string:
@ -79,7 +79,7 @@ struct lookfor {
/* prototypes */ /* prototypes */
void walk (char *, size_t, struct lookfor *, int); void walk (char *, size_t, struct lookfor *, size_t);
/* Maximum number of matched data elements per line! */ /* Maximum number of matched data elements per line! */

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.77 2002/12/22 12:07:34 lukem Exp $ */ /* $NetBSD: util.c,v 1.78 2003/01/10 20:00:28 christos Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -117,13 +117,13 @@ distribution_sets_exist_p(path)
void void
get_ramsize() get_ramsize()
{ {
long len = sizeof(long); size_t len = sizeof(ramsize);
int mib[2] = {CTL_HW, HW_PHYSMEM}; int mib[2] = {CTL_HW, HW_PHYSMEM};
sysctl(mib, 2, (void *)&ramsize, (size_t *)&len, NULL, 0); sysctl(mib, 2, &ramsize, &len, NULL, 0);
/* Find out how many Megs ... round up. */ /* Find out how many Megs ... round up. */
rammb = (ramsize + MEG - 1) / MEG; rammb = (unsigned int)((ramsize + MEG - 1) / MEG);
} }
static int asked = 0; static int asked = 0;
@ -160,7 +160,7 @@ run_makedev()
msg_display(MSG_makedev); msg_display(MSG_makedev);
sleep (1); sleep (1);
owd = getcwd(NULL,0); owd = getcwd(NULL, 0);
/* make /dev, in case the user didn't extract it. */ /* make /dev, in case the user didn't extract it. */
make_target_dir("/dev"); make_target_dir("/dev");
@ -181,7 +181,7 @@ get_via_floppy()
char distname[STRSIZE]; char distname[STRSIZE];
char fddev[STRSIZE] = "/dev/fd0a"; char fddev[STRSIZE] = "/dev/fd0a";
char fname[STRSIZE]; char fname[STRSIZE];
char fullname[STRSIZE]; char full_name[STRSIZE];
char catcmd[STRSIZE]; char catcmd[STRSIZE];
distinfo *list; distinfo *list;
char post[4]; char post[4];
@ -199,9 +199,9 @@ get_via_floppy()
snprintf(distname, STRSIZE, "%s%s", list->name, dist_postfix); snprintf(distname, STRSIZE, "%s%s", list->name, dist_postfix);
while (list->getit && strcmp(&post[1],list->fdlast) <= 0) { while (list->getit && strcmp(&post[1],list->fdlast) <= 0) {
snprintf(fname, STRSIZE, "%s%s", list->name, post); snprintf(fname, STRSIZE, "%s%s", list->name, post);
snprintf(fullname, STRSIZE, "/mnt2/%s", fname); snprintf(full_name, STRSIZE, "/mnt2/%s", fname);
first = 1; first = 1;
while (!mounted || stat(fullname, &sb)) { while (!mounted || stat(full_name, &sb)) {
if (mounted) if (mounted)
run_prog(0, NULL, "/sbin/umount /mnt2"); run_prog(0, NULL, "/sbin/umount /mnt2");
if (first) if (first)
@ -223,7 +223,7 @@ get_via_floppy()
first = 0; first = 0;
} }
sprintf(catcmd, "/bin/cat %s >> %s", sprintf(catcmd, "/bin/cat %s >> %s",
fullname, distname); full_name, distname);
if (logging) if (logging)
(void)fprintf(logfp, "%s\n", catcmd); (void)fprintf(logfp, "%s\n", catcmd);
if (scripting) if (scripting)
@ -860,6 +860,7 @@ sanity_check()
return 1; return 1;
} }
#ifdef notdef
/* set reverse to 1 to default to no */ /* set reverse to 1 to default to no */
int askyesno(int reverse) int askyesno(int reverse)
{ {
@ -880,7 +881,7 @@ int askyesno(int reverse)
waddstr(yesnowin, "Yes or No: [Y]"); waddstr(yesnowin, "Yes or No: [Y]");
wrefresh(yesnowin); wrefresh(yesnowin);
while ((c = getchar())) { while ((c = getchar()) != 0) {
if (c == 'y' || c == 'Y') { if (c == 'y' || c == 'Y') {
found = 1; found = 1;
break; break;
@ -901,6 +902,7 @@ int askyesno(int reverse)
refresh(); refresh();
return(found); return(found);
} }
#endif
/* /*
* Some globals to pass things back from callbacks * Some globals to pass things back from callbacks
@ -933,6 +935,7 @@ set_timezone_select(menudesc *m)
* Alarm-handler to update example-display * Alarm-handler to update example-display
*/ */
static void static void
/*ARGSUSED*/
timezone_sig(int sig) timezone_sig(int sig)
{ {
set_timezone_select(NULL); set_timezone_select(NULL);
@ -949,10 +952,8 @@ set_timezone()
char localtime_target[STRSIZE]; char localtime_target[STRSIZE];
int rc; int rc;
time_t t; time_t t;
sig_t oldalrm;
FTS *tree; FTS *tree;
FTSENT *entry; FTSENT *entry;
int rval;
char *argv[2]; char *argv[2];
int skip; int skip;
struct stat sb; struct stat sb;
@ -960,7 +961,7 @@ set_timezone()
int menu_no; int menu_no;
menu_ent *tz_menu; menu_ent *tz_menu;
oldalrm = signal(SIGALRM, timezone_sig); signal(SIGALRM, timezone_sig);
alarm(1); alarm(1);
strncpy(zoneinfo_dir, target_expand("/usr/share/zoneinfo"), STRSIZE); strncpy(zoneinfo_dir, target_expand("/usr/share/zoneinfo"), STRSIZE);
@ -1012,10 +1013,12 @@ set_timezone()
return 1; /* error - skip timezone setting */ return 1; /* error - skip timezone setting */
} }
n = 0; n = 0;
for (rval = 0; (entry = fts_read(tree)) != NULL; ) { for (; (entry = fts_read(tree)) != NULL; ) {
stat(entry->fts_accpath, &sb); stat(entry->fts_accpath, &sb);
if (S_ISREG(sb.st_mode)) { if (S_ISREG(sb.st_mode)) {
tz_menu[n].opt_name = strdup(entry->fts_accpath+skip+1); tz_menu[n].opt_name = strdup(entry->fts_accpath+skip+1);
if (tz_menu[n].opt_name == NULL)
tz_menu[n].opt_name = "*";
tz_menu[n].opt_menu = OPT_NOMENU; tz_menu[n].opt_menu = OPT_NOMENU;
tz_menu[n].opt_flags = 0; tz_menu[n].opt_flags = 0;
tz_menu[n].opt_action = set_timezone_select; tz_menu[n].opt_action = set_timezone_select;
@ -1153,6 +1156,7 @@ add_rc_conf(const char *fmt, ...)
va_end(ap); va_end(ap);
} }
#ifdef notdef
/* /*
* check that there is at least a / somewhere. * check that there is at least a / somewhere.
*/ */
@ -1185,6 +1189,7 @@ set_sizemultname_meg()
sizemult = MEG / sectorsize; sizemult = MEG / sectorsize;
multname = msg_string(MSG_megname); multname = msg_string(MSG_megname);
} }
#endif
int int
check_lfs_progs() check_lfs_progs()