pass lint[pass1]
This commit is contained in:
parent
e756303d08
commit
2d7e213ded
|
@ -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.
|
||||
* All rights reserved.
|
||||
|
@ -46,6 +46,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
|
@ -132,7 +133,7 @@ handle_aout_libs(const char *dir, int op, const void *arg)
|
|||
{
|
||||
DIR *dd;
|
||||
struct dirent *dp;
|
||||
char *fullname;
|
||||
char *full_name;
|
||||
const char *destdir;
|
||||
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)
|
||||
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;
|
||||
|
||||
switch (op) {
|
||||
|
@ -172,12 +176,12 @@ handle_aout_libs(const char *dir, int op, const void *arg)
|
|||
break;
|
||||
case LIB_MOVE:
|
||||
run_prog(0, NULL, "mv -f %s %s/%s",
|
||||
fullname, destdir, dp->d_name);
|
||||
full_name, destdir, dp->d_name);
|
||||
break;
|
||||
}
|
||||
|
||||
endloop:
|
||||
free(fullname);
|
||||
free(full_name);
|
||||
}
|
||||
|
||||
closedir(dd);
|
||||
|
|
|
@ -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.
|
||||
|
@ -48,6 +48,8 @@
|
|||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#include <dirent.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
|
|
@ -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.
|
||||
|
@ -42,6 +42,8 @@
|
|||
#include <sys/sysctl.h>
|
||||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
|
|
@ -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.
|
||||
|
@ -42,6 +42,8 @@
|
|||
#include <sys/sysctl.h>
|
||||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
|
|
@ -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.
|
||||
|
@ -43,6 +43,8 @@
|
|||
#include <sys/param.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <sys/sysctl.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
|
|
@ -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.
|
||||
|
@ -48,6 +48,8 @@
|
|||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#include <dirent.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
@ -55,8 +57,7 @@
|
|||
|
||||
|
||||
char mbr[512];
|
||||
char kernstr[STRSIZE];
|
||||
int mbr_present, mbr_len;
|
||||
int mbr_len;
|
||||
int c1024_resp;
|
||||
struct disklist *disklist = NULL;
|
||||
struct nativedisk_info *nativedisk;
|
||||
|
@ -94,7 +95,7 @@ md_get_info()
|
|||
md_bios_info(diskdev);
|
||||
|
||||
edit:
|
||||
edit_mbr((struct mbr_partition *)&mbr[MBR_PARTOFF]);
|
||||
edit_mbr((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF]);
|
||||
|
||||
if (mbr_part_above_chs(part) &&
|
||||
(biosdisk == NULL || !(biosdisk->bi_flags & BIFLAG_EXTINT13))) {
|
||||
|
@ -164,11 +165,11 @@ md_read_bootcode(path, buf, len)
|
|||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
if (lseek(fd, MBR_MAGICOFF, SEEK_SET) < 0) {
|
||||
if (lseek(fd, (off_t)MBR_MAGICOFF, SEEK_SET) < 0) {
|
||||
close(fd);
|
||||
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);
|
||||
|
||||
|
@ -379,7 +380,7 @@ custom:
|
|||
/* XXX UGH! need arguments to process_menu */
|
||||
switch (c1024_resp) {
|
||||
case 1:
|
||||
edit_mbr((struct mbr_partition *)&mbr[MBR_PARTOFF]);
|
||||
edit_mbr((struct mbr_partition *)(void *)&mbr[MBR_PARTOFF]);
|
||||
/*FALLTHROUGH*/
|
||||
case 2:
|
||||
goto editlab;
|
||||
|
@ -461,7 +462,7 @@ md_upgrade_mbrtype()
|
|||
if (read_mbr(diskdev, mbr, sizeof mbr) < 0)
|
||||
return;
|
||||
|
||||
mbrp = (struct mbr_partition *)&mbr[MBR_PARTOFF];
|
||||
mbrp = (struct mbr_partition *)(void *)&mbr[MBR_PARTOFF];
|
||||
|
||||
for (i = 0; i < NMBRPART; i++) {
|
||||
if (mbrp[i].mbrp_typ == MBR_PTYPE_386BSD) {
|
||||
|
@ -534,7 +535,8 @@ int
|
|||
md_bios_info(dev)
|
||||
char *dev;
|
||||
{
|
||||
int mib[2], i, len;
|
||||
int mib[2], i;
|
||||
size_t len;
|
||||
struct biosdisk_info *bip;
|
||||
struct nativedisk_info *nip = NULL, *nat;
|
||||
int cyl, head, sec;
|
||||
|
@ -625,11 +627,11 @@ static void
|
|||
configure_bootsel()
|
||||
{
|
||||
struct mbr_partition *parts =
|
||||
(struct mbr_partition *)&mbr[MBR_PARTOFF];
|
||||
(struct mbr_partition *)(void *)&mbr[MBR_PARTOFF];
|
||||
int i;
|
||||
|
||||
|
||||
mbs = (struct mbr_bootsel *)&mbr[MBR_BOOTSELOFF];
|
||||
mbs = (struct mbr_bootsel *)(void *)&mbr[MBR_BOOTSELOFF];
|
||||
mbs->flags = BFL_SELACTIVE;
|
||||
|
||||
/* Setup default labels for partitions, since if not done by user */
|
||||
|
@ -653,6 +655,7 @@ configure_bootsel()
|
|||
}
|
||||
|
||||
void
|
||||
/*ARGSUSED*/
|
||||
disp_bootsel(part, mbsp)
|
||||
struct mbr_partition *part;
|
||||
struct mbr_bootsel *mbsp;
|
||||
|
@ -698,12 +701,14 @@ md_init()
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
void
|
||||
md_set_sizemultname()
|
||||
{
|
||||
|
||||
set_sizemultname_meg();
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
md_set_no_x()
|
||||
|
|
|
@ -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.
|
||||
|
@ -81,7 +81,7 @@ menu dlgeom, title "Choose an option";
|
|||
|
||||
menu editparttable, title "Choose your partition", exit;
|
||||
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);
|
||||
};
|
||||
option "Edit partition 0", sub menu editpart,
|
||||
|
@ -97,7 +97,7 @@ menu editparttable, title "Choose your partition", exit;
|
|||
|
||||
menu editpart, title "Select to change";
|
||||
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);
|
||||
msg_display_add(MSG_newline);
|
||||
};
|
||||
|
@ -287,7 +287,7 @@ menu biosmultmatch;
|
|||
|
||||
menu configbootsel, y=16, title "Change a bootmenu item", exit;
|
||||
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_defbootselopt);
|
||||
if (mbs->defkey == SCAN_ENTER)
|
||||
|
|
|
@ -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.
|
||||
|
@ -82,7 +82,7 @@ menu dlgeom, title "Choisissez une option";
|
|||
|
||||
menu editparttable, title "Choisissez votre partition", exit;
|
||||
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);
|
||||
};
|
||||
option "Edition de la partition 0", sub menu editpart,
|
||||
|
@ -98,7 +98,7 @@ menu editparttable, title "Choisissez votre partition", exit;
|
|||
|
||||
menu editpart, title "Changement";
|
||||
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);
|
||||
msg_display_add(MSG_newline);
|
||||
};
|
||||
|
@ -259,7 +259,7 @@ menu biosmultmatch;
|
|||
|
||||
menu configbootsel, title "Changer une entree du menu", exit;
|
||||
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_defbootselopt);
|
||||
if (mbs->defkey == SCAN_ENTER)
|
||||
|
|
|
@ -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: */
|
||||
/* 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;
|
||||
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);
|
||||
};
|
||||
option "Edytuj partycje 0", sub menu editpart,
|
||||
|
@ -99,7 +99,7 @@ menu editparttable, title "Wybierz swoje partycje", exit;
|
|||
|
||||
menu editpart, title "Wybierz aby zmienic";
|
||||
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);
|
||||
msg_display_add(MSG_newline);
|
||||
};
|
||||
|
@ -288,7 +288,7 @@ menu biosmultmatch;
|
|||
|
||||
menu configbootsel, y=16, title "Zmien bootmenu", exit;
|
||||
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_defbootselopt);
|
||||
if (mbs->defkey == SCAN_ENTER)
|
||||
|
|
|
@ -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.
|
||||
|
@ -44,6 +44,8 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
|
|
@ -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.
|
||||
|
@ -43,6 +43,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -42,6 +42,8 @@
|
|||
#include <sys/sysctl.h>
|
||||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
|
|
@ -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.
|
||||
|
@ -48,6 +48,8 @@
|
|||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#include <dirent.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
|
|
|
@ -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.
|
||||
|
@ -40,7 +40,6 @@
|
|||
|
||||
/* System includes needed for this. */
|
||||
#include <sys/types.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include "msg_defs.h"
|
||||
|
@ -77,8 +76,8 @@
|
|||
|
||||
/* Round up to the next full cylinder size */
|
||||
#define NUMSEC(size,sizemult,cylsize) \
|
||||
((size == -1) ? -1 : (sizemult == 1) ? (size) : \
|
||||
(((size)*(sizemult)+(cylsize)-1)/(cylsize))*(cylsize))
|
||||
(((int)(size) == -1) ? -1 : (int)((sizemult == 1) ? (size) : \
|
||||
(((size)*(sizemult)+(cylsize)-1)/(cylsize))*(cylsize)))
|
||||
|
||||
/* What FS type? */
|
||||
#define PI_ISBSDFS(p) ((p)->pi_fstype == FS_BSDLFS || \
|
||||
|
|
|
@ -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.
|
||||
|
@ -49,6 +49,8 @@
|
|||
#include <sys/param.h>
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
|
@ -60,7 +62,7 @@
|
|||
|
||||
/* Local prototypes */
|
||||
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 fsck_root (void);
|
||||
static int
|
||||
|
@ -239,8 +241,9 @@ write_disklabel (void)
|
|||
/* disklabel the disk */
|
||||
return run_prog(RUN_DISPLAY, MSG_cmdfail,
|
||||
"%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname);
|
||||
#endif
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -271,7 +274,7 @@ make_filesystems(void)
|
|||
static int
|
||||
do_flfs_newfs(const char *partname, int partno, const char *mountpoint)
|
||||
{
|
||||
char devname[STRSIZE];
|
||||
char dev_name[STRSIZE];
|
||||
int error;
|
||||
|
||||
if (*mountpoint && !preservemount[partno])
|
||||
|
@ -281,13 +284,13 @@ do_flfs_newfs(const char *partname, int partno, const char *mountpoint)
|
|||
else
|
||||
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 */
|
||||
make_target_dir(mountpoint);
|
||||
error = target_mount(bsdlabel[partno].pi_fstype == FS_BSDFFS ?
|
||||
"-v -o async" : "-v", devname, mountpoint);
|
||||
"-v -o async" : "-v", dev_name, mountpoint);
|
||||
if (error) {
|
||||
msg_display(MSG_mountfail, devname, mountpoint);
|
||||
msg_display(MSG_mountfail, dev_name, mountpoint);
|
||||
process_menu (MENU_ok);
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +301,7 @@ int
|
|||
make_fstab(void)
|
||||
{
|
||||
FILE *f;
|
||||
int i, swapdev = -1;
|
||||
int i, swap_dev = -1;
|
||||
|
||||
/* Create the fstab. */
|
||||
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,
|
||||
diskdev, 'a'+i, fsmount[i]);
|
||||
} else if (bsdlabel[i].pi_fstype == FS_SWAP) {
|
||||
if (swapdev == -1)
|
||||
swapdev = i;
|
||||
if (swap_dev == -1)
|
||||
swap_dev = i;
|
||||
scripting_fprintf(f, "/dev/%s%c none swap sw 0 0\n", diskdev, 'a'+i);
|
||||
}
|
||||
if (layout_tmp) {
|
||||
if (swapdev != -1)
|
||||
scripting_fprintf(f, "/dev/%s%c /tmp mfs rw\n", diskdev, 'a'+swapdev);
|
||||
if (swap_dev != -1)
|
||||
scripting_fprintf(f, "/dev/%s%c /tmp mfs rw\n", diskdev, 'a'+swap_dev);
|
||||
else
|
||||
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 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
|
||||
|
||||
|
@ -394,7 +397,8 @@ static char mnt[MAXDEVS][STRSIZE];
|
|||
static int devcnt = 0;
|
||||
|
||||
static void
|
||||
foundffs(struct data *list, int num)
|
||||
/*ARGSUSED*/
|
||||
foundffs(struct data *list, size_t num)
|
||||
{
|
||||
if (strcmp(list[1].u.s_val, "/") != 0 &&
|
||||
strstr(list[2].u.s_val, "noauto") == NULL) {
|
||||
|
@ -412,7 +416,6 @@ inode_kind(char *dev)
|
|||
char pad[SBSIZE];
|
||||
} fs;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
fd = open(dev, O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
|
@ -421,7 +424,7 @@ inode_kind(char *dev)
|
|||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
if ((ret = read(fd, &fs, SBSIZE)) != SBSIZE) {
|
||||
if (read(fd, &fs, SBSIZE) != SBSIZE) {
|
||||
close(fd);
|
||||
return -2;
|
||||
}
|
||||
|
@ -447,14 +450,14 @@ inode_kind(char *dev)
|
|||
static int
|
||||
do_fsck(const char *diskpart)
|
||||
{
|
||||
char raw[SSTRSIZE];
|
||||
char rraw[SSTRSIZE];
|
||||
int inodetype;
|
||||
char *upgr = "", *prog = "/sbin/fsck_ffs";
|
||||
int err;
|
||||
|
||||
/* cons up raw partition name. */
|
||||
snprintf (raw, SSTRSIZE, "/dev/r%s", diskpart);
|
||||
inodetype = inode_kind (raw);
|
||||
snprintf (rraw, sizeof(rraw), "/dev/r%s", diskpart);
|
||||
inodetype = inode_kind (rraw);
|
||||
|
||||
if (inodetype == -4) {
|
||||
if (check_lfs_progs() == 0)
|
||||
|
@ -465,7 +468,7 @@ do_fsck(const char *diskpart)
|
|||
return inodetype;
|
||||
} else if (inodetype == 0) {
|
||||
/* Ask to upgrade */
|
||||
msg_display(MSG_upgrinode, raw);
|
||||
msg_display(MSG_upgrinode, rraw);
|
||||
process_menu(MENU_yesno);
|
||||
if (yesno)
|
||||
upgr = "-c 3 ";
|
||||
|
@ -473,9 +476,9 @@ do_fsck(const char *diskpart)
|
|||
|
||||
/*endwin();*/
|
||||
#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
|
||||
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
|
||||
wrefresh(stdscr);
|
||||
return err;
|
||||
|
@ -513,16 +516,16 @@ int target_mount_with_error_menu(const char *opt,
|
|||
char *diskpart, const char *mntpoint)
|
||||
{
|
||||
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
|
||||
fprintf(stderr, "sysinst: mount_with_error_menu: %s %s %s\n",
|
||||
opt, devname, mntpoint);
|
||||
opt, dev_name, mntpoint);
|
||||
#endif
|
||||
|
||||
if ((error = target_mount(opt, devname, mntpoint)) != 0) {
|
||||
msg_display (MSG_badmount, devname, "");
|
||||
if ((error = target_mount(opt, dev_name, mntpoint)) != 0) {
|
||||
msg_display (MSG_badmount, dev_name, "");
|
||||
process_menu (MENU_ok);
|
||||
return error;
|
||||
} else {
|
||||
|
@ -602,7 +605,7 @@ fsck_disks(void)
|
|||
process_menu(MENU_ok);
|
||||
return 0;
|
||||
}
|
||||
walk(fstab, fstabsize, fstabbuf, numfstabbuf);
|
||||
walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf);
|
||||
free(fstab);
|
||||
|
||||
for (i = 0; i < devcnt; i++) {
|
||||
|
@ -624,6 +627,7 @@ int
|
|||
set_swap(dev, pp, enable)
|
||||
const char *dev;
|
||||
partinfo *pp;
|
||||
int enable;
|
||||
{
|
||||
partinfo parts[16];
|
||||
int i, maxpart;
|
||||
|
|
|
@ -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.
|
||||
|
@ -42,8 +42,6 @@
|
|||
|
||||
#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
|
||||
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef TESTING
|
||||
long primes[4800];
|
||||
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
|
||||
build_primes(max)
|
||||
long max;
|
||||
|
@ -118,7 +120,6 @@ factor(val, fact_list, fact_size, num_fact)
|
|||
}
|
||||
|
||||
|
||||
#ifdef TESTING
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -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.
|
||||
|
@ -56,7 +56,7 @@ get_geom(disk, l)
|
|||
if (fd < 0)
|
||||
return 0;
|
||||
|
||||
if (ioctl(fd, DIOCGDEFLABEL, (char *)l) < 0) {
|
||||
if (ioctl(fd, DIOCGDEFLABEL, l) < 0) {
|
||||
(void)close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ get_real_geom(disk, l)
|
|||
if (fd < 0)
|
||||
return 0;
|
||||
|
||||
if (ioctl(fd, DIOCGDINFO, (char *)l) < 0) {
|
||||
if (ioctl(fd, DIOCGDINFO, l) < 0) {
|
||||
(void)close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#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
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -156,7 +156,7 @@ edit_and_check_label(lp, nparts, rawpart, bsdpart)
|
|||
int rawpart;
|
||||
int bsdpart;
|
||||
{
|
||||
while (1) {
|
||||
for (;;) {
|
||||
int i, j;
|
||||
|
||||
/* first give the user the option to edit the label... */
|
||||
|
@ -198,7 +198,9 @@ emptylabel(lp)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
int
|
||||
/*ARGSUSED*/
|
||||
savenewlabel(lp, nparts)
|
||||
partinfo *lp;
|
||||
int nparts;
|
||||
|
@ -248,6 +250,7 @@ savenewlabel(lp, nparts)
|
|||
fflush(NULL);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -335,7 +338,7 @@ getpartoff(msg_no, defpartstart)
|
|||
int i, localsizemult, partn;
|
||||
|
||||
maxpartc = 'a' + getmaxpartitions() - 1;
|
||||
while (1) {
|
||||
for (;;) {
|
||||
msg_table_add(MSG_label_offset_special, maxpartc, maxpartc);
|
||||
snprintf (isize, 20, "%d", (defpartstart)/sizemult);
|
||||
msg_prompt_add(msg_no, (defpartstart > 0) ? isize : NULL,
|
||||
|
@ -382,7 +385,7 @@ getpartsize(msg_no, partstart, defpartsize)
|
|||
int partn;
|
||||
|
||||
maxpartc = 'a' + getmaxpartitions() - 1;
|
||||
while (1) {
|
||||
for (;;) {
|
||||
msg_table_add(MSG_label_size_special, maxpartc);
|
||||
snprintf (isize, 20, "%d", (defpartsize)/sizemult);
|
||||
msg_prompt_add (msg_no, (defpartsize != 0) ? isize : 0,
|
||||
|
|
|
@ -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.
|
||||
|
@ -157,7 +157,7 @@ main(argc, argv)
|
|||
process_menu(MENU_netbsd);
|
||||
|
||||
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);
|
||||
exit (1);
|
||||
}
|
||||
buffer[statinfo.st_size] = 0;
|
||||
buffer[(size_t)statinfo.st_size] = 0;
|
||||
|
||||
/* close the file */
|
||||
close (fd);
|
||||
|
|
|
@ -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.
|
||||
|
@ -111,6 +111,7 @@ static void convert_mbr_chs (int, int, int, u_int8_t *, u_int8_t *,
|
|||
u_int8_t *, u_int32_t);
|
||||
|
||||
|
||||
#ifdef notdef
|
||||
/*
|
||||
* First, geometry stuff...
|
||||
*/
|
||||
|
@ -120,6 +121,7 @@ check_geom()
|
|||
|
||||
return bcyl <= 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* get C/H/S geometry from user via menu interface and
|
||||
|
@ -145,6 +147,7 @@ set_bios_geom(cyl, head, sec)
|
|||
bsec = atoi(res);
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
void
|
||||
disp_cur_geom()
|
||||
{
|
||||
|
@ -152,6 +155,7 @@ disp_cur_geom()
|
|||
msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec);
|
||||
msg_display_add(MSG_biosgeom, bcyl, bhead, bsec);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -194,7 +198,6 @@ edit_mbr(partition)
|
|||
int otherparts = 0;
|
||||
int ourparts = 0;
|
||||
|
||||
int i;
|
||||
/* Count nonempty, non-BSD partitions. */
|
||||
for (i = 0; i < NMBRPART; i++) {
|
||||
otherparts += otherpart(part[i].mbrp_typ);
|
||||
|
@ -403,7 +406,7 @@ disp_cur_part(part, sel, disp)
|
|||
int
|
||||
read_mbr(disk, buf, len)
|
||||
char *disk, *buf;
|
||||
int len;
|
||||
size_t len;
|
||||
{
|
||||
char diskpath[MAXPATHLEN];
|
||||
int fd, i;
|
||||
|
@ -414,7 +417,7 @@ read_mbr(disk, buf, len)
|
|||
if (fd < 0)
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
@ -424,7 +427,7 @@ read_mbr(disk, buf, len)
|
|||
}
|
||||
|
||||
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++) {
|
||||
if (mbrp[i].mbrp_typ != 0) {
|
||||
mbrp[i].mbrp_start =
|
||||
|
@ -446,7 +449,7 @@ read_mbr(disk, buf, len)
|
|||
int
|
||||
write_mbr(disk, buf, len, convert)
|
||||
char *disk, *buf;
|
||||
int len;
|
||||
size_t len;
|
||||
int convert;
|
||||
{
|
||||
char diskpath[MAXPATHLEN];
|
||||
|
@ -459,12 +462,12 @@ write_mbr(disk, buf, len, convert)
|
|||
if (fd < 0)
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mbrp = (struct mbr_partition *)&buf[MBR_PARTOFF];
|
||||
mbrp = (struct mbr_partition *)(void *)&buf[MBR_PARTOFF];
|
||||
for (i = 0; i < NMBRPART; i++) {
|
||||
if (mbrp[i].mbrp_start == 0 &&
|
||||
mbrp[i].mbrp_size == 0) {
|
||||
|
@ -503,7 +506,7 @@ valid_mbr(buf)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -547,7 +550,7 @@ guess_biosgeom_from_mbr(buf, cyl, head, sec)
|
|||
char *buf;
|
||||
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 c1, h1, s1, c2, h2, s2;
|
||||
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);
|
||||
denom = (quad_t)c2*(a1-s1) - (quad_t)c1*(a2-s2);
|
||||
if (denom != 0 && num % denom == 0) {
|
||||
heads = num / denom;
|
||||
heads = (int)(num / denom);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +586,7 @@ guess_biosgeom_from_mbr(buf, cyl, head, sec)
|
|||
num = a1 - s1;
|
||||
denom = c1 * heads + h1;
|
||||
if (denom != 0 && num % denom == 0) {
|
||||
sectors = num / denom;
|
||||
sectors = (int)(num / denom);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -623,20 +626,20 @@ get_mapping(parts, i, cylinder, head, sector, absolute)
|
|||
int i, *cylinder, *head, *sector;
|
||||
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;
|
||||
if (i % 2 == 0) {
|
||||
*cylinder = MBR_PCYL(part->mbrp_scyl, part->mbrp_ssect);
|
||||
*head = part->mbrp_shd;
|
||||
*sector = MBR_PSECT(part->mbrp_ssect) - 1;
|
||||
*absolute = part->mbrp_start;
|
||||
*cylinder = MBR_PCYL(apart->mbrp_scyl, part->mbrp_ssect);
|
||||
*head = apart->mbrp_shd;
|
||||
*sector = MBR_PSECT(apart->mbrp_ssect) - 1;
|
||||
*absolute = apart->mbrp_start;
|
||||
} else {
|
||||
*cylinder = MBR_PCYL(part->mbrp_ecyl, part->mbrp_esect);
|
||||
*head = part->mbrp_ehd;
|
||||
*sector = MBR_PSECT(part->mbrp_esect) - 1;
|
||||
*absolute = part->mbrp_start + part->mbrp_size - 1;
|
||||
*cylinder = MBR_PCYL(apart->mbrp_ecyl, apart->mbrp_esect);
|
||||
*head = apart->mbrp_ehd;
|
||||
*sector = MBR_PSECT(apart->mbrp_esect) - 1;
|
||||
*absolute = apart->mbrp_start + apart->mbrp_size - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -77,8 +77,8 @@ int partsoverlap (struct mbr_partition *, int, int);
|
|||
|
||||
/* from mbr.c */
|
||||
|
||||
int read_mbr (char *, char *, int);
|
||||
int write_mbr (char *, char *, int, int);
|
||||
int read_mbr (char *, char *, size_t);
|
||||
int write_mbr (char *, char *, size_t, int);
|
||||
int valid_mbr (char *);
|
||||
int guess_biosgeom_from_mbr (char *, int *, int *, int *);
|
||||
int md_bios_info (char *);
|
||||
|
|
|
@ -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.
|
||||
|
@ -210,7 +210,7 @@ get_ifconfig_info()
|
|||
char *textbuf;
|
||||
char *t, *nt, *ndest;
|
||||
const char **ignore;
|
||||
int textsize, len;
|
||||
int textsize;
|
||||
|
||||
/* Get ifconfig information */
|
||||
|
||||
|
@ -229,7 +229,7 @@ get_ifconfig_info()
|
|||
*ndest = '\0';
|
||||
while ((t = strsep(&nt, " ")) != NULL) {
|
||||
for (ignore = ignored_if_names; *ignore != NULL; ignore++) {
|
||||
len = strlen(*ignore);
|
||||
size_t len = strlen(*ignore);
|
||||
if (strncmp(t, *ignore, len) == 0 &&
|
||||
isdigit((unsigned char)t[len]))
|
||||
goto loop;
|
||||
|
@ -254,7 +254,6 @@ get_ifinterface_info()
|
|||
int textsize;
|
||||
char *t;
|
||||
char hostname[MAXHOSTNAMELEN + 1];
|
||||
int max_len;
|
||||
char *dot;
|
||||
|
||||
/* 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));
|
||||
} else {
|
||||
/* 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;
|
||||
*dot = '\0';
|
||||
dot++;
|
||||
|
@ -393,7 +392,10 @@ config_network()
|
|||
{ char *tp;
|
||||
char defname[255];
|
||||
int octet0;
|
||||
int pass, v6config, dhcp_config;
|
||||
int pass, dhcp_config;
|
||||
#ifdef INET6
|
||||
int v6config = 1;
|
||||
#endif
|
||||
|
||||
FILE *f;
|
||||
time_t now;
|
||||
|
@ -431,11 +433,6 @@ again:
|
|||
/* Remove that space we added. */
|
||||
net_dev[strlen(net_dev) - 1] = 0;
|
||||
|
||||
#ifdef INET6
|
||||
v6config = 1;
|
||||
#else
|
||||
v6config = 0;
|
||||
#endif
|
||||
|
||||
/* Preload any defaults we can find */
|
||||
get_ifinterface_info();
|
||||
|
@ -1028,7 +1025,7 @@ char *line;
|
|||
int textsize;
|
||||
char *textbuf;
|
||||
char *t;
|
||||
char *walk;
|
||||
char *walkp;
|
||||
|
||||
textsize = collect(T_FILE, &textbuf, "/tmp/dhclient.leases");
|
||||
if (textsize < 0) {
|
||||
|
@ -1045,14 +1042,14 @@ char *line;
|
|||
t = strtok(NULL, " \t\n");
|
||||
/* found the tag, extract the value */
|
||||
/* last char should be a ';' */
|
||||
walk = strrchr(t,';');
|
||||
if (walk != NULL ) {
|
||||
*walk = '\0';
|
||||
walkp = strrchr(t, ';');
|
||||
if (walkp != NULL) {
|
||||
*walkp = '\0';
|
||||
}
|
||||
/* strip any " from the string */
|
||||
walk = strrchr(t,'"');
|
||||
if (walk != NULL ) {
|
||||
*walk = '\0';
|
||||
walkp = strrchr(t, '"');
|
||||
if (walkp != NULL) {
|
||||
*walkp = '\0';
|
||||
t++;
|
||||
}
|
||||
strcpy(targ, t);
|
||||
|
|
|
@ -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.
|
||||
|
@ -70,7 +70,6 @@
|
|||
/*
|
||||
* local prototypes
|
||||
*/
|
||||
static char* va_prog_cmdstr (const char *cmd, va_list ap);
|
||||
static int launch_subwin (WINDOW *actionwin, char **args, struct winsize *win,
|
||||
int display, const char **errstr);
|
||||
int log_flip (menudesc *);
|
||||
|
@ -104,6 +103,7 @@ do_logging(void)
|
|||
}
|
||||
|
||||
int
|
||||
/*ARGSUSED*/
|
||||
log_flip(menudesc *m)
|
||||
{
|
||||
time_t tloc;
|
||||
|
@ -131,6 +131,7 @@ log_flip(menudesc *m)
|
|||
}
|
||||
|
||||
int
|
||||
/*ARGSUSED*/
|
||||
script_flip(menudesc *m)
|
||||
{
|
||||
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
|
||||
*/
|
||||
|
@ -275,7 +261,6 @@ launch_subwin(actionwin, args, win, flags, errstr)
|
|||
int dataflow[2];
|
||||
pid_t child, subchild, pid;
|
||||
char ibuf[MAXBUF], obuf[MAXBUF];
|
||||
char *command, *p, *argzero, **origargs;
|
||||
char pktdata;
|
||||
struct termios rtt;
|
||||
struct termios tt;
|
||||
|
@ -285,14 +270,6 @@ launch_subwin(actionwin, args, win, flags, errstr)
|
|||
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);
|
||||
if (openpty(&master, &slave, NULL, &tt, win) == -1) {
|
||||
*errstr = "openpty() failed";
|
||||
|
@ -326,7 +303,7 @@ launch_subwin(actionwin, args, win, flags, errstr)
|
|||
n = read(master, obuf, sizeof(obuf));
|
||||
if (n <= 0)
|
||||
break;
|
||||
write(dataflow[1], obuf, n);
|
||||
write(dataflow[1], obuf, (size_t)n);
|
||||
} /* while spinning */
|
||||
_exit(EXIT_SUCCESS);
|
||||
} /* subchild, child forks */
|
||||
|
@ -338,13 +315,16 @@ launch_subwin(actionwin, args, win, flags, errstr)
|
|||
(void)tcsetattr(slave, TCSANOW, &rtt);
|
||||
login_tty(slave);
|
||||
if (logging) {
|
||||
fprintf(logfp, "executing: %s\n", command);
|
||||
fflush(logfp);
|
||||
fprintf(logfp, "executing:");
|
||||
for (i = 0; args[i]; i++)
|
||||
fprintf(logfp, " %s", args[i]);
|
||||
fprintf(logfp, "\n");
|
||||
fclose(logfp);
|
||||
}
|
||||
if (scripting) {
|
||||
fprintf(script, "%s\n", command);
|
||||
fflush(script);
|
||||
for (i = 0; args[i]; i++)
|
||||
fprintf(script, "%s ", args[i]);
|
||||
fprintf(script, "\n");
|
||||
fclose(script);
|
||||
}
|
||||
/*
|
||||
|
@ -353,10 +333,10 @@ launch_subwin(actionwin, args, win, flags, errstr)
|
|||
*/
|
||||
if ((flags & RUN_CHROOT) != 0)
|
||||
chroot(target_prefix());
|
||||
execvp(argzero, origargs);
|
||||
execvp(*args, args);
|
||||
/* the parent will see this as the output from the
|
||||
child */
|
||||
warn("execvp %s", argzero);
|
||||
warn("execvp %s", *args);
|
||||
_exit(EXIT_FAILURE);
|
||||
break; /* end of child */
|
||||
default:
|
||||
|
@ -375,16 +355,16 @@ launch_subwin(actionwin, args, win, flags, errstr)
|
|||
|
||||
for (selectfailed = 0;;) {
|
||||
if (selectfailed) {
|
||||
char *msg = "select(2) failed but no child died?";
|
||||
char *mmsg = "select(2) failed but no child died?";
|
||||
if(logging)
|
||||
(void)fprintf(logfp, msg);
|
||||
errx(1, msg);
|
||||
(void)fprintf(logfp, mmsg);
|
||||
errx(1, mmsg);
|
||||
}
|
||||
read_fd_set = active_fd_set;
|
||||
if (select(FD_SETSIZE, &read_fd_set, NULL, NULL, NULL) < 0) {
|
||||
if (errno == EINTR)
|
||||
goto loop;
|
||||
perror("select");
|
||||
warn("select");
|
||||
if (logging)
|
||||
(void)fprintf(logfp,
|
||||
"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) {
|
||||
if (FD_ISSET (i, &read_fd_set)) {
|
||||
n = read(i, ibuf, MAXBUF);
|
||||
if (n <= 0) {
|
||||
warn("read");
|
||||
continue;
|
||||
}
|
||||
if (i == STDIN_FILENO) {
|
||||
(void)write(master, ibuf, n);
|
||||
(void)write(master, ibuf, (size_t)n);
|
||||
if ((rtt.c_lflag & ECHO) == 0)
|
||||
goto enddisp;
|
||||
}
|
||||
pktdata = ibuf[0];
|
||||
if (pktdata != 0 && i != STDIN_FILENO) {
|
||||
if (pktdata & TIOCPKT_IOCTL)
|
||||
rtt = *(struct termios *)ibuf;
|
||||
memcpy(&rtt, ibuf, sizeof(rtt));
|
||||
goto enddisp;
|
||||
}
|
||||
for (j=1; j < n; j++) {
|
||||
|
@ -477,17 +461,18 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
|
|||
struct winsize win;
|
||||
int ret;
|
||||
WINDOW *actionwin, *statuswin, *boxwin;
|
||||
char buf2[MAXBUF];
|
||||
char *command, *p, *args[51], **aps;
|
||||
char buf2[MAXBUF], scmd[MAXBUF];
|
||||
char *p, *args[256], **aps;
|
||||
const char *errstr;
|
||||
|
||||
va_start(ap,cmd);
|
||||
sprintf(buf2,"%s",va_prog_cmdstr(cmd,ap));
|
||||
vsnprintf(buf2, sizeof(buf2), cmd, ap);
|
||||
strcpy(scmd, buf2);
|
||||
p = buf2;
|
||||
command = strdup(buf2);
|
||||
|
||||
/* 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')
|
||||
++aps;
|
||||
|
||||
|
@ -501,7 +486,7 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
|
|||
if ((flags & RUN_SYSTEM) != 0) {
|
||||
if ((flags & RUN_CHROOT) != 0)
|
||||
chroot(target_prefix());
|
||||
ret = system(command);
|
||||
ret = system(scmd);
|
||||
} else if ((flags & RUN_DISPLAY) != 0) {
|
||||
wclear(stdscr);
|
||||
clearok(stdscr, 1);
|
||||
|
@ -550,7 +535,7 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
|
|||
wmove(statuswin, 1, 4);
|
||||
waddstr(statuswin, "Command: ");
|
||||
wstandout(statuswin);
|
||||
waddstr(statuswin, command);
|
||||
waddstr(statuswin, scmd);
|
||||
wstandend(statuswin);
|
||||
wrefresh(statuswin);
|
||||
|
||||
|
@ -599,7 +584,7 @@ done:
|
|||
if ((flags & RUN_FATAL) != 0 && ret != 0)
|
||||
exit(ret);
|
||||
if (ret && errmsg != MSG_NONE) {
|
||||
msg_display(errmsg, command);
|
||||
msg_display(errmsg, scmd);
|
||||
process_menu(MENU_ok);
|
||||
}
|
||||
return(ret);
|
||||
|
|
|
@ -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
|
||||
|
@ -75,7 +75,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#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
|
||||
|
||||
/*
|
||||
|
@ -142,6 +142,7 @@ struct unwind_mount *unwind_mountlist = NULL;
|
|||
/*
|
||||
* debugging helper. curses...
|
||||
*/
|
||||
#if defined(DEBUG) || defined(DEBUG_ROOT)
|
||||
void
|
||||
backtowin()
|
||||
{
|
||||
|
@ -150,6 +151,7 @@ backtowin()
|
|||
getchar(); /* wait for user to press return */
|
||||
wrefresh(stdscr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get name of current root device from kernel via sysctl.
|
||||
|
@ -383,7 +385,7 @@ concat_paths(prefix, suffix)
|
|||
const char* prefix;
|
||||
const char *suffix;
|
||||
{
|
||||
static char realpath[MAXPATHLEN];
|
||||
static char real_path[MAXPATHLEN];
|
||||
|
||||
/* absolute prefix and null suffix? */
|
||||
if (prefix[0] == '/' && suffix[0] == 0)
|
||||
|
@ -395,10 +397,11 @@ concat_paths(prefix, suffix)
|
|||
|
||||
/* avoid "//" */
|
||||
if (suffix[0] == '/' || suffix[0] == 0)
|
||||
snprintf(realpath, MAXPATHLEN, "%s%s", prefix, suffix);
|
||||
snprintf(real_path, sizeof(real_path), "%s%s", prefix, suffix);
|
||||
else
|
||||
snprintf(realpath, MAXPATHLEN, "%s/%s", prefix, suffix);
|
||||
return (realpath);
|
||||
snprintf(real_path, sizeof(real_path), "%s/%s",
|
||||
prefix, suffix);
|
||||
return (real_path);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -437,6 +440,7 @@ make_target_dir(path)
|
|||
make_prefixed_dir(target_prefix(), path);
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
/* Make a directory with a pathname in the currently-mounted root. */
|
||||
void
|
||||
make_ramdisk_dir(path)
|
||||
|
@ -446,7 +450,6 @@ make_ramdisk_dir(path)
|
|||
make_prefixed_dir(path, "");
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* unused, will not work with new run.c */
|
||||
/*
|
||||
*
|
||||
|
@ -549,6 +552,7 @@ target_chdir_or_die(dir)
|
|||
(void) do_target_chdir(dir, 1);
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
int
|
||||
target_chdir(dir)
|
||||
const char *dir;
|
||||
|
@ -556,6 +560,7 @@ target_chdir(dir)
|
|||
|
||||
return(do_target_chdir(dir, 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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 *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
|
||||
unwind_mounts()
|
||||
{
|
||||
struct unwind_mount *m, *prev;
|
||||
struct unwind_mount *m;
|
||||
volatile static int unwind_in_progress = 0;
|
||||
|
||||
/* signal safety */
|
||||
|
@ -676,7 +681,6 @@ unwind_mounts()
|
|||
return;
|
||||
unwind_in_progress = 1;
|
||||
|
||||
prev = NULL;
|
||||
for (m = unwind_mountlist; m; ) {
|
||||
struct unwind_mount *prev;
|
||||
#ifdef DEBUG_UNWIND
|
||||
|
@ -735,14 +739,14 @@ target_test(mode, path)
|
|||
unsigned int mode;
|
||||
const char *path;
|
||||
{
|
||||
const char *realpath = target_expand(path);
|
||||
const char *real_path = target_expand(path);
|
||||
register int result;
|
||||
|
||||
result = !file_mode_match(realpath, mode);
|
||||
scripting_fprintf(NULL, "if [ $? != 0 ]; then echo \"%s does not exist!\"; fi\n", realpath);
|
||||
result = !file_mode_match(real_path, mode);
|
||||
scripting_fprintf(NULL, "if [ $? != 0 ]; then echo \"%s does not exist!\"; fi\n", real_path);
|
||||
|
||||
#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
|
||||
return (result);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -10,16 +10,16 @@
|
|||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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
|
||||
* 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.
|
||||
* 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:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
|
||||
|
@ -56,10 +56,10 @@
|
|||
|
||||
/* prototypes */
|
||||
|
||||
static void process (struct lookfor, char *);
|
||||
static void match (char *, struct lookfor *, int);
|
||||
static int finddata (struct lookfor, char *, struct data *, int *);
|
||||
static char *strndup (char *, int);
|
||||
static void process (struct lookfor *, char *);
|
||||
static void match (char *, struct lookfor *, size_t);
|
||||
static int finddata (struct lookfor *, char *, struct data *, size_t *);
|
||||
static char *strndup (char *, size_t);
|
||||
|
||||
/*
|
||||
* Walk the buffer, call match for each line.
|
||||
|
@ -69,10 +69,10 @@ walk(buffer, size, these, numthese)
|
|||
char *buffer;
|
||||
size_t size;
|
||||
struct lookfor *these;
|
||||
int numthese;
|
||||
size_t numthese;
|
||||
{
|
||||
int i = 0;
|
||||
int len;
|
||||
size_t i = 0;
|
||||
size_t len;
|
||||
int line = 1;
|
||||
|
||||
while (i < size) {
|
||||
|
@ -81,7 +81,7 @@ walk(buffer, size, these, numthese)
|
|||
buffer++;
|
||||
i++;
|
||||
} else {
|
||||
/* Assume this starts a line. */
|
||||
/* Assume item starts a line. */
|
||||
len = 0;
|
||||
while (buffer[len] != '\n' && buffer[len] != '\0')
|
||||
len++;
|
||||
|
@ -105,11 +105,11 @@ static void
|
|||
match(line, these, numthese)
|
||||
char *line;
|
||||
struct lookfor *these;
|
||||
int numthese;
|
||||
size_t numthese;
|
||||
{
|
||||
int linelen; /* Line length */
|
||||
int patlen; /* Pattern length */
|
||||
int which; /* Which pattern we are using */
|
||||
size_t linelen; /* Line length */
|
||||
size_t patlen; /* Pattern length */
|
||||
size_t which; /* Which pattern we are using */
|
||||
|
||||
linelen = strlen(line);
|
||||
|
||||
|
@ -118,23 +118,23 @@ match(line, these, numthese)
|
|||
if (linelen < patlen)
|
||||
continue;
|
||||
if (strncmp(these[which].head, line, patlen) == 0)
|
||||
process(these[which], line);
|
||||
process(&these[which], line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* process the matched line. */
|
||||
static void
|
||||
process(this, line)
|
||||
struct lookfor this;
|
||||
process(item, line)
|
||||
struct lookfor *item;
|
||||
char *line;
|
||||
{
|
||||
struct data found[MAXDATA];
|
||||
int numfound = 0;
|
||||
size_t numfound = 0;
|
||||
char *p;
|
||||
int i, j;
|
||||
size_t i, j;
|
||||
|
||||
if (finddata(this, line, found, &numfound)) {
|
||||
if (finddata(item, line, found, &numfound)) {
|
||||
#ifdef DEBUG
|
||||
printf("process: \"%s\"\n", line);
|
||||
for (i = 0; i < numfound; i++) {
|
||||
|
@ -150,9 +150,9 @@ process(this, line)
|
|||
}
|
||||
#endif
|
||||
/* Process the stuff. */
|
||||
switch (this.todo[0]) {
|
||||
switch (item->todo[0]) {
|
||||
case 'a': /* Assign data */
|
||||
p = this.todo;
|
||||
p = item->todo;
|
||||
j = 0;
|
||||
while (*p && *p != '$')
|
||||
p++;
|
||||
|
@ -162,14 +162,14 @@ process(this, line)
|
|||
i = atoi(p);
|
||||
switch (found[i].what) {
|
||||
case INT:
|
||||
*((int *)this.var+j)
|
||||
*((int *)item->var+j)
|
||||
= found[i].u.i_val;
|
||||
break;
|
||||
case STR:
|
||||
strncpy(*((char **)this.var+j),
|
||||
strncpy(*((char **)item->var+j),
|
||||
found[i].u.s_val,
|
||||
this.size-1);
|
||||
found[i].u.s_val[this.size-1] = 0;
|
||||
item->size-1);
|
||||
found[i].u.s_val[item->size-1] = 0;
|
||||
break;
|
||||
}
|
||||
while (isdigit(*p))
|
||||
|
@ -179,12 +179,12 @@ process(this, line)
|
|||
if (*p)
|
||||
p++;
|
||||
j++;
|
||||
if (j >= this.nument)
|
||||
if (j >= item->nument)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'c': /* Call a function with data. */
|
||||
(*this.func)(found, numfound);
|
||||
(*item->func)(found, numfound);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -198,14 +198,14 @@ process(this, line)
|
|||
* Side Effect -- sets numfound and found.
|
||||
*/
|
||||
static int
|
||||
finddata(this, line, found, numfound )
|
||||
struct lookfor this;
|
||||
finddata(item, line, found, numfound)
|
||||
struct lookfor *item;
|
||||
char *line;
|
||||
struct data *found;
|
||||
int *numfound;
|
||||
size_t *numfound;
|
||||
{
|
||||
char *fmt = this.fmt;
|
||||
int len;
|
||||
char *fmt = item->fmt;
|
||||
size_t len;
|
||||
|
||||
*numfound = 0;
|
||||
while (*fmt) {
|
||||
|
@ -280,14 +280,14 @@ finddata(this, line, found, numfound )
|
|||
static char *
|
||||
strndup(str, len)
|
||||
char *str;
|
||||
int len;
|
||||
size_t len;
|
||||
{
|
||||
int alen;
|
||||
size_t alen;
|
||||
char *val;
|
||||
|
||||
alen = strlen(str);
|
||||
alen = len < alen ? len + 1 : alen + 1;
|
||||
val = (char *)malloc(alen);
|
||||
val = malloc(alen);
|
||||
if (!val)
|
||||
return NULL;
|
||||
strncpy(val, str, alen-1);
|
||||
|
|
|
@ -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.
|
||||
|
@ -55,9 +55,9 @@ struct lookfor {
|
|||
char *fmt; /* Expected format. */
|
||||
char *todo; /* What to do ... */
|
||||
void *var; /* Possible var */
|
||||
int nument; /* Number of entries in the "array" */
|
||||
int size; /* size of string variables */
|
||||
void (*func) (struct data *list, int num); /* function to call */
|
||||
size_t nument; /* Number of entries in the "array" */
|
||||
size_t size; /* size of string variables */
|
||||
void (*func) (struct data *list, size_t num); /* function to call */
|
||||
};
|
||||
|
||||
/* Format string for the expected string:
|
||||
|
@ -79,7 +79,7 @@ struct lookfor {
|
|||
|
||||
/* 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! */
|
||||
|
|
|
@ -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.
|
||||
|
@ -117,13 +117,13 @@ distribution_sets_exist_p(path)
|
|||
void
|
||||
get_ramsize()
|
||||
{
|
||||
long len = sizeof(long);
|
||||
size_t len = sizeof(ramsize);
|
||||
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. */
|
||||
rammb = (ramsize + MEG - 1) / MEG;
|
||||
rammb = (unsigned int)((ramsize + MEG - 1) / MEG);
|
||||
}
|
||||
|
||||
static int asked = 0;
|
||||
|
@ -160,7 +160,7 @@ run_makedev()
|
|||
msg_display(MSG_makedev);
|
||||
sleep (1);
|
||||
|
||||
owd = getcwd(NULL,0);
|
||||
owd = getcwd(NULL, 0);
|
||||
|
||||
/* make /dev, in case the user didn't extract it. */
|
||||
make_target_dir("/dev");
|
||||
|
@ -181,7 +181,7 @@ get_via_floppy()
|
|||
char distname[STRSIZE];
|
||||
char fddev[STRSIZE] = "/dev/fd0a";
|
||||
char fname[STRSIZE];
|
||||
char fullname[STRSIZE];
|
||||
char full_name[STRSIZE];
|
||||
char catcmd[STRSIZE];
|
||||
distinfo *list;
|
||||
char post[4];
|
||||
|
@ -199,9 +199,9 @@ get_via_floppy()
|
|||
snprintf(distname, STRSIZE, "%s%s", list->name, dist_postfix);
|
||||
while (list->getit && strcmp(&post[1],list->fdlast) <= 0) {
|
||||
snprintf(fname, STRSIZE, "%s%s", list->name, post);
|
||||
snprintf(fullname, STRSIZE, "/mnt2/%s", fname);
|
||||
snprintf(full_name, STRSIZE, "/mnt2/%s", fname);
|
||||
first = 1;
|
||||
while (!mounted || stat(fullname, &sb)) {
|
||||
while (!mounted || stat(full_name, &sb)) {
|
||||
if (mounted)
|
||||
run_prog(0, NULL, "/sbin/umount /mnt2");
|
||||
if (first)
|
||||
|
@ -223,7 +223,7 @@ get_via_floppy()
|
|||
first = 0;
|
||||
}
|
||||
sprintf(catcmd, "/bin/cat %s >> %s",
|
||||
fullname, distname);
|
||||
full_name, distname);
|
||||
if (logging)
|
||||
(void)fprintf(logfp, "%s\n", catcmd);
|
||||
if (scripting)
|
||||
|
@ -860,6 +860,7 @@ sanity_check()
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
/* set reverse to 1 to default to no */
|
||||
int askyesno(int reverse)
|
||||
{
|
||||
|
@ -880,7 +881,7 @@ int askyesno(int reverse)
|
|||
waddstr(yesnowin, "Yes or No: [Y]");
|
||||
|
||||
wrefresh(yesnowin);
|
||||
while ((c = getchar())) {
|
||||
while ((c = getchar()) != 0) {
|
||||
if (c == 'y' || c == 'Y') {
|
||||
found = 1;
|
||||
break;
|
||||
|
@ -901,6 +902,7 @@ int askyesno(int reverse)
|
|||
refresh();
|
||||
return(found);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some globals to pass things back from callbacks
|
||||
|
@ -933,6 +935,7 @@ set_timezone_select(menudesc *m)
|
|||
* Alarm-handler to update example-display
|
||||
*/
|
||||
static void
|
||||
/*ARGSUSED*/
|
||||
timezone_sig(int sig)
|
||||
{
|
||||
set_timezone_select(NULL);
|
||||
|
@ -949,10 +952,8 @@ set_timezone()
|
|||
char localtime_target[STRSIZE];
|
||||
int rc;
|
||||
time_t t;
|
||||
sig_t oldalrm;
|
||||
FTS *tree;
|
||||
FTSENT *entry;
|
||||
int rval;
|
||||
char *argv[2];
|
||||
int skip;
|
||||
struct stat sb;
|
||||
|
@ -960,7 +961,7 @@ set_timezone()
|
|||
int menu_no;
|
||||
menu_ent *tz_menu;
|
||||
|
||||
oldalrm = signal(SIGALRM, timezone_sig);
|
||||
signal(SIGALRM, timezone_sig);
|
||||
alarm(1);
|
||||
|
||||
strncpy(zoneinfo_dir, target_expand("/usr/share/zoneinfo"), STRSIZE);
|
||||
|
@ -1012,10 +1013,12 @@ set_timezone()
|
|||
return 1; /* error - skip timezone setting */
|
||||
}
|
||||
n = 0;
|
||||
for (rval = 0; (entry = fts_read(tree)) != NULL; ) {
|
||||
for (; (entry = fts_read(tree)) != NULL; ) {
|
||||
stat(entry->fts_accpath, &sb);
|
||||
if (S_ISREG(sb.st_mode)) {
|
||||
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_flags = 0;
|
||||
tz_menu[n].opt_action = set_timezone_select;
|
||||
|
@ -1153,6 +1156,7 @@ add_rc_conf(const char *fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
/*
|
||||
* check that there is at least a / somewhere.
|
||||
*/
|
||||
|
@ -1185,6 +1189,7 @@ set_sizemultname_meg()
|
|||
sizemult = MEG / sectorsize;
|
||||
multname = msg_string(MSG_megname);
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
check_lfs_progs()
|
||||
|
|
Loading…
Reference in New Issue