diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-17 02:14:34 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-17 02:14:34 +0000 |
commit | 777e443a4907c980d426ece9a6f7cdb21fea4f1b (patch) | |
tree | c7899405ab91d9f045012553ebfb1b8f7300f21b /sbin | |
parent | 5757b9a265e6ab7af9c725d74bf16cbf90747d02 (diff) |
some ansi; khalek@linuxgamers.net
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dumplfs/dumplfs.c | 51 | ||||
-rw-r--r-- | sbin/dumplfs/misc.c | 10 | ||||
-rw-r--r-- | sbin/fsck_msdos/boot.c | 12 | ||||
-rw-r--r-- | sbin/fsck_msdos/check.c | 7 | ||||
-rw-r--r-- | sbin/fsck_msdos/dir.c | 77 | ||||
-rw-r--r-- | sbin/fsck_msdos/fat.c | 57 | ||||
-rw-r--r-- | sbin/fsck_msdos/main.c | 10 | ||||
-rw-r--r-- | sbin/newlfs/lfs.c | 42 | ||||
-rw-r--r-- | sbin/newlfs/misc.c | 7 | ||||
-rw-r--r-- | sbin/newlfs/newfs.c | 22 | ||||
-rw-r--r-- | sbin/raidctl/raidctl.c | 102 | ||||
-rw-r--r-- | sbin/raidctl/rf_configure.c | 34 | ||||
-rw-r--r-- | sbin/restore/dirs.c | 74 | ||||
-rw-r--r-- | sbin/restore/interactive.c | 47 | ||||
-rw-r--r-- | sbin/restore/main.c | 14 | ||||
-rw-r--r-- | sbin/restore/restore.c | 47 | ||||
-rw-r--r-- | sbin/restore/symtab.c | 51 | ||||
-rw-r--r-- | sbin/restore/tape.c | 93 | ||||
-rw-r--r-- | sbin/restore/utilities.c | 54 |
19 files changed, 243 insertions, 568 deletions
diff --git a/sbin/dumplfs/dumplfs.c b/sbin/dumplfs/dumplfs.c index cb4e41836b1..1c5f0ca2fac 100644 --- a/sbin/dumplfs/dumplfs.c +++ b/sbin/dumplfs/dumplfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dumplfs.c,v 1.9 2003/06/02 20:06:14 millert Exp $ */ +/* $OpenBSD: dumplfs.c,v 1.10 2004/07/17 02:14:32 deraadt Exp $ */ /* $NetBSD: dumplfs.c,v 1.7 1995/12/14 22:36:34 thorpej Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dumplfs.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: dumplfs.c,v 1.9 2003/06/02 20:06:14 millert Exp $"; +static char rcsid[] = "$OpenBSD: dumplfs.c,v 1.10 2004/07/17 02:14:32 deraadt Exp $"; #endif #endif /* not lint */ @@ -106,9 +106,7 @@ char *special; (void)printf("%d\tINUSE\t%d\t%8X \n", \ i, ip->if_version, ip->if_daddr) int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct lfs lfs_sb1, lfs_sb2, *lfs_master; daddr_t seg_addr; @@ -184,10 +182,7 @@ main(argc, argv) * printed out rather than making this code incredibly efficient. */ static void -dump_ifile(fd, lfsp, do_ientries) - int fd; - struct lfs *lfsp; - int do_ientries; +dump_ifile(int fd, struct lfs *lfsp, int do_ientries) { IFILE *ipage; struct dinode *dip, *dpage; @@ -312,10 +307,7 @@ e0: free(dpage); } static int -dump_ipage_ifile(i, pp, tot) - int i; - IFILE *pp; - int tot; +dump_ipage_ifile(int i, IFILE *pp, int tot) { IFILE *ip; int cnt, max; @@ -328,11 +320,7 @@ dump_ipage_ifile(i, pp, tot) } static int -dump_ipage_segusage(lfsp, i, pp, tot) - struct lfs *lfsp; - int i; - IFILE *pp; - int tot; +dump_ipage_segusage(struct lfs *lfsp, int i, IFILE *pp, int tot) { SEGUSE *sp; int cnt, max; @@ -348,8 +336,7 @@ dump_ipage_segusage(lfsp, i, pp, tot) } static void -dump_dinode(dip) - struct dinode *dip; +dump_dinode(struct dinode *dip) { int i; time_t at, mt, ct; @@ -381,11 +368,7 @@ dump_dinode(dip) } static int -dump_sum(fd, lfsp, sp, segnum, addr) - struct lfs *lfsp; - SEGSUM *sp; - int fd, segnum; - daddr_t addr; +dump_sum(int fd, struct lfs *lfsp, SEGSUM *sp, int segnum, daddr_t addr) { FINFO *fp; u_int32_t *dp; @@ -453,11 +436,7 @@ dump_sum(fd, lfsp, sp, segnum, addr) } static void -dump_segment(fd, segnum, addr, lfsp, dump_sb) - int fd, segnum; - daddr_t addr; - struct lfs *lfsp; - int dump_sb; +dump_segment(int fd, int segnum, daddr_t addr, struct lfs *lfsp, int dump_sb) { struct lfs lfs_sb, *sbp; SEGSUM *sump; @@ -506,8 +485,7 @@ dump_segment(fd, segnum, addr, lfsp, dump_sb) } static void -dump_super(lfsp) - struct lfs *lfsp; +dump_super(struct lfs *lfsp) { int i; @@ -591,8 +569,7 @@ dump_super(lfsp) } static void -addseg(arg) - char *arg; +addseg(char *arg) { SEGLIST *p; @@ -604,9 +581,7 @@ addseg(arg) } static void -dump_cleaner_info(lfsp, ipage) - struct lfs *lfsp; - void *ipage; +dump_cleaner_info(struct lfs *lfsp, void *ipage) { CLEANERINFO *cip; @@ -616,7 +591,7 @@ dump_cleaner_info(lfsp, ipage) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: dumplfs [-ai] [-s segnum] file\n"); exit(1); diff --git a/sbin/dumplfs/misc.c b/sbin/dumplfs/misc.c index 34bb1e49c09..a9fcb9ccbad 100644 --- a/sbin/dumplfs/misc.c +++ b/sbin/dumplfs/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.3 2003/06/02 20:06:14 millert Exp $ */ +/* $OpenBSD: misc.c,v 1.4 2004/07/17 02:14:32 deraadt Exp $ */ /* $NetBSD: misc.c,v 1.3 1995/03/18 14:55:23 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: misc.c,v 1.3 2003/06/02 20:06:14 millert Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.4 2004/07/17 02:14:32 deraadt Exp $"; #endif #endif /* not lint */ @@ -49,11 +49,7 @@ static char rcsid[] = "$OpenBSD: misc.c,v 1.3 2003/06/02 20:06:14 millert Exp $" #include "extern.h" void -get(fd, off, p, len) - int fd; - off_t off; - void *p; - size_t len; +get(int fd, off_t off, void *p, size_t len) { int rbytes; diff --git a/sbin/fsck_msdos/boot.c b/sbin/fsck_msdos/boot.c index 8605e4086ba..c552bd4d1f2 100644 --- a/sbin/fsck_msdos/boot.c +++ b/sbin/fsck_msdos/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.9 2003/07/29 18:38:35 deraadt Exp $ */ +/* $OpenBSD: boot.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: boot.c,v 1.5 1997/10/17 11:19:23 ws Exp $ */ /* @@ -35,7 +35,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: boot.c,v 1.9 2003/07/29 18:38:35 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: boot.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -47,9 +47,7 @@ static char rcsid[] = "$OpenBSD: boot.c,v 1.9 2003/07/29 18:38:35 deraadt Exp $" #include "ext.h" int -readboot(dosfs, boot) - int dosfs; - struct bootblock *boot; +readboot(int dosfs, struct bootblock *boot) { u_char block[DOSBOOTBLOCKSIZE]; u_char fsinfo[2 * DOSBOOTBLOCKSIZE]; @@ -227,9 +225,7 @@ readboot(dosfs, boot) } int -writefsinfo(dosfs, boot) - int dosfs; - struct bootblock *boot; +writefsinfo(int dosfs, struct bootblock *boot) { u_char fsinfo[2 * DOSBOOTBLOCKSIZE]; diff --git a/sbin/fsck_msdos/check.c b/sbin/fsck_msdos/check.c index 991ff747091..3ddf010528c 100644 --- a/sbin/fsck_msdos/check.c +++ b/sbin/fsck_msdos/check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check.c,v 1.9 2003/07/29 18:38:35 deraadt Exp $ */ +/* $OpenBSD: check.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: check.c,v 1.8 1997/10/17 11:19:29 ws Exp $ */ /* @@ -35,7 +35,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: check.c,v 1.9 2003/07/29 18:38:35 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: check.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -48,8 +48,7 @@ static char rcsid[] = "$OpenBSD: check.c,v 1.9 2003/07/29 18:38:35 deraadt Exp $ #include "ext.h" int -checkfilesys(fname) - const char *fname; +checkfilesys(const char *fname) { int dosfs; struct bootblock boot; diff --git a/sbin/fsck_msdos/dir.c b/sbin/fsck_msdos/dir.c index b3a48146c68..589dfddd212 100644 --- a/sbin/fsck_msdos/dir.c +++ b/sbin/fsck_msdos/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.18 2003/07/29 18:38:35 deraadt Exp $ */ +/* $OpenBSD: dir.c,v 1.19 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: dir.c,v 1.11 1997/10/17 11:19:35 ws Exp $ */ /* @@ -37,7 +37,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: dir.c,v 1.18 2003/07/29 18:38:35 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: dir.c,v 1.19 2004/07/17 02:14:33 deraadt Exp $"; #endif /* not lint */ #include <stdio.h> @@ -112,7 +112,7 @@ static int readDosDirSection(int, struct bootblock *, struct fatEntry *, static struct dosDirEntry *freede; static struct dosDirEntry * -newDosDirEntry() +newDosDirEntry(void) { struct dosDirEntry *de; @@ -125,8 +125,7 @@ newDosDirEntry() } static void -freeDosDirEntry(de) - struct dosDirEntry *de; +freeDosDirEntry(struct dosDirEntry *de) { de->next = freede; freede = de; @@ -138,7 +137,7 @@ freeDosDirEntry(de) static struct dirTodoNode *freedt; static struct dirTodoNode * -newDirTodo() +newDirTodo(void) { struct dirTodoNode *dt; @@ -151,8 +150,7 @@ newDirTodo() } static void -freeDirTodo(dt) - struct dirTodoNode *dt; +freeDirTodo(struct dirTodoNode *dt) { dt->next = freedt; freedt = dt; @@ -167,8 +165,7 @@ struct dirTodoNode *pendingDirectories = NULL; * Return the full pathname for a directory entry. */ static char * -fullpath(dir) - struct dosDirEntry *dir; +fullpath(struct dosDirEntry *dir) { static char namebuf[MAXPATHLEN + 1]; char *cp, *np; @@ -198,8 +195,7 @@ fullpath(dir) * Calculate a checksum over an 8.3 alias name */ static u_char -calcShortSum(p) - u_char *p; +calcShortSum(u_char *p) { u_char sum = 0; int i; @@ -226,9 +222,7 @@ static struct dosDirEntry *lostDir; * Init internal state for a new directory scan. */ int -resetDosDirSection(boot, fat) - struct bootblock *boot; - struct fatEntry *fat; +resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) { int b1, b2; cl_t cl; @@ -281,7 +275,7 @@ resetDosDirSection(boot, fat) * Cleanup after a directory scan */ void -finishDosDirSection() +finishDosDirSection(void) { struct dirTodoNode *p, *np; struct dosDirEntry *d, *nd; @@ -311,15 +305,8 @@ finishDosDirSection() * Delete directory entries between startcl, startoff and endcl, endoff. */ static int -delete(f, boot, fat, startcl, startoff, endcl, endoff, notlast) - int f; - struct bootblock *boot; - struct fatEntry *fat; - cl_t startcl; - int startoff; - cl_t endcl; - int endoff; - int notlast; +delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl, + int startoff, cl_t endcl, int endoff, int notlast) { u_char *s, *e; off_t off; @@ -358,17 +345,8 @@ delete(f, boot, fat, startcl, startoff, endcl, endoff, notlast) } static int -removede(f, boot, fat, start, end, startcl, endcl, curcl, path, type) - int f; - struct bootblock *boot; - struct fatEntry *fat; - u_char *start; - u_char *end; - cl_t startcl; - cl_t endcl; - cl_t curcl; - char *path; - int type; +removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start, + u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, char *path, int type) { switch (type) { case 0: @@ -402,11 +380,8 @@ removede(f, boot, fat, start, end, startcl, endcl, curcl, path, type) * Check an in-memory file entry */ static int -checksize(boot, fat, p, dir) - struct bootblock *boot; - struct fatEntry *fat; - u_char *p; - struct dosDirEntry *dir; +checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p, + struct dosDirEntry *dir) { /* * Check size on ordinary files @@ -457,11 +432,8 @@ checksize(boot, fat, p, dir) * - push directories onto the todo-stack */ static int -readDosDirSection(f, boot, fat, dir) - int f; - struct bootblock *boot; - struct fatEntry *fat; - struct dosDirEntry *dir; +readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat, + struct dosDirEntry *dir) { struct dosDirEntry dirent, *d; u_char *p, *vallfn, *invlfn, *empty; @@ -880,10 +852,7 @@ readDosDirSection(f, boot, fat, dir) } int -handleDirTree(dosfs, boot, fat) - int dosfs; - struct bootblock *boot; - struct fatEntry *fat; +handleDirTree(int dosfs, struct bootblock *boot, struct fatEntry *fat) { int mod; @@ -937,11 +906,7 @@ static cl_t lfcl; static off_t lfoff; int -reconnect(dosfs, boot, fat, head) - int dosfs; - struct bootblock *boot; - struct fatEntry *fat; - cl_t head; +reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head) { struct dosDirEntry d; u_char *p; @@ -1023,7 +988,7 @@ reconnect(dosfs, boot, fat, head) } void -finishlf() +finishlf(void) { if (lfbuf) free(lfbuf); diff --git a/sbin/fsck_msdos/fat.c b/sbin/fsck_msdos/fat.c index 5093653f224..e3dbeaf7e89 100644 --- a/sbin/fsck_msdos/fat.c +++ b/sbin/fsck_msdos/fat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fat.c,v 1.11 2003/07/29 18:38:35 deraadt Exp $ */ +/* $OpenBSD: fat.c,v 1.12 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: fat.c,v 1.8 1997/10/17 11:19:53 ws Exp $ */ /* @@ -35,7 +35,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: fat.c,v 1.11 2003/07/29 18:38:35 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: fat.c,v 1.12 2004/07/17 02:14:33 deraadt Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -54,11 +54,7 @@ static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *); * Check a cluster number for valid value */ static int -checkclnum(boot, fat, cl, next) - struct bootblock *boot; - int fat; - cl_t cl; - cl_t *next; +checkclnum(struct bootblock *boot, int fat, cl_t cl, cl_t *next) { if (*next >= (CLUST_RSRVD&boot->ClustMask)) *next |= ~boot->ClustMask; @@ -89,11 +85,7 @@ checkclnum(boot, fat, cl, next) * Read a FAT and decode it into internal format */ int -readfat(fs, boot, no, fp) - int fs; - struct bootblock *boot; - int no; - struct fatEntry **fp; +readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp) { struct fatEntry *fat; u_char *buffer, *p; @@ -207,8 +199,7 @@ readfat(fs, boot, no, fp) * Get type of reserved cluster */ char * -rsrvdcltype(cl) - cl_t cl; +rsrvdcltype(cl_t cl) { if (cl == CLUST_FREE) return ("free"); @@ -220,11 +211,7 @@ rsrvdcltype(cl) } static int -clustdiffer(cl, cp1, cp2, fatnum) - cl_t cl; - cl_t *cp1; - cl_t *cp2; - int fatnum; +clustdiffer(cl_t cl, cl_t *cp1, cl_t *cp2, int fatnum) { if (*cp1 == CLUST_FREE || *cp1 >= CLUST_RSRVD) { if (*cp2 == CLUST_FREE || *cp2 >= CLUST_RSRVD) { @@ -294,11 +281,8 @@ clustdiffer(cl, cp1, cp2, fatnum) * into the first one. */ int -comparefat(boot, first, second, fatnum) - struct bootblock *boot; - struct fatEntry *first; - struct fatEntry *second; - int fatnum; +comparefat(struct bootblock *boot, struct fatEntry *first, + struct fatEntry *second, int fatnum) { cl_t cl; int ret = FSOK; @@ -310,10 +294,7 @@ comparefat(boot, first, second, fatnum) } void -clearchain(boot, fat, head) - struct bootblock *boot; - struct fatEntry *fat; - cl_t head; +clearchain(struct bootblock *boot, struct fatEntry *fat, cl_t head) { cl_t p, q; @@ -327,11 +308,7 @@ clearchain(boot, fat, head) } int -tryclear(boot, fat, head, trunc) - struct bootblock *boot; - struct fatEntry *fat; - cl_t head; - cl_t *trunc; +tryclear(struct bootblock *boot, struct fatEntry *fat, cl_t head, cl_t *trunc) { if (ask(0, "Clear chain starting at %u", head)) { clearchain(boot, fat, head); @@ -347,9 +324,7 @@ tryclear(boot, fat, head, trunc) * Check a complete FAT in-memory for crosslinks */ int -checkfat(boot, fat) - struct bootblock *boot; - struct fatEntry *fat; +checkfat(struct bootblock *boot, struct fatEntry *fat) { cl_t head, p, h, n; u_int len; @@ -444,10 +419,7 @@ checkfat(boot, fat) * Write out FATs encoding them from the internal format */ int -writefat(fs, boot, fat) - int fs; - struct bootblock *boot; - struct fatEntry *fat; +writefat(int fs, struct bootblock *boot, struct fatEntry *fat) { u_char *buffer, *p; cl_t cl; @@ -526,10 +498,7 @@ writefat(fs, boot, fat) * Check a complete in-memory FAT for lost cluster chains */ int -checklost(dosfs, boot, fat) - int dosfs; - struct bootblock *boot; - struct fatEntry *fat; +checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat) { cl_t head; int mod = FSOK; diff --git a/sbin/fsck_msdos/main.c b/sbin/fsck_msdos/main.c index 1482181da2e..7957a231d70 100644 --- a/sbin/fsck_msdos/main.c +++ b/sbin/fsck_msdos/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.12 2002/02/19 19:39:38 millert Exp $ */ +/* $OpenBSD: main.c,v 1.13 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: main.c,v 1.8 1996/10/17 20:29:53 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: main.c,v 1.12 2002/02/19 19:39:38 millert Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.13 2004/07/17 02:14:33 deraadt Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -57,15 +57,13 @@ static void usage(void); int main(int, char **); static void -usage() +usage(void) { errexit("Usage: fsck_msdos [-fnpy] filesystem ... \n"); } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { int ret = 0, erg; int ch; diff --git a/sbin/newlfs/lfs.c b/sbin/newlfs/lfs.c index 6d145f307f7..def2fc304fd 100644 --- a/sbin/newlfs/lfs.c +++ b/sbin/newlfs/lfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs.c,v 1.8 2003/07/29 18:38:36 deraadt Exp $ */ +/* $OpenBSD: lfs.c,v 1.9 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: lfs.c,v 1.8 1995/06/19 21:30:36 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95"; #else -static char rcsid[] = "$OpenBSD: lfs.c,v 1.8 2003/07/29 18:38:36 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: lfs.c,v 1.9 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -169,14 +169,8 @@ static void make_dir( void *, struct direct *, int); static void put(int, off_t, void *, size_t); int -make_lfs(fd, lp, partp, minfree, block_size, frag_size, seg_size) - int fd; - struct disklabel *lp; - struct partition *partp; - int minfree; - int block_size; - int frag_size; - int seg_size; +make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, + int block_size, int frag_size, int seg_size) { struct dinode *dip; /* Pointer to a disk inode */ struct dinode *dpagep; /* Pointer to page of disk inodes */ @@ -602,11 +596,7 @@ make_lfs(fd, lp, partp, minfree, block_size, frag_size, seg_size) } static void -put(fd, off, p, len) - int fd; - off_t off; - void *p; - size_t len; +put(int fd, off_t off, void *p, size_t len) { int wbytes; @@ -624,16 +614,19 @@ put(fd, off, p, len) */ void -lfsinit() +lfsinit(void) {} +/* + * ino : inode we're creating + * dip : disk inode + * nblocks: number of blocks in file + * saddr : starting block address + * lfsp : superblock + */ static daddr_t -make_dinode(ino, dip, nblocks, saddr, lfsp) - ino_t ino; /* inode we're creating */ - struct dinode *dip; /* disk inode */ - int nblocks; /* number of blocks in file */ - daddr_t saddr; /* starting block address */ - struct lfs *lfsp; /* superblock */ +make_dinode(ino_t ino, struct dinode *dip, int nblocks, daddr_t saddr, + struct lfs *lfsp) { int db_per_fb, i; @@ -664,10 +657,7 @@ make_dinode(ino, dip, nblocks, saddr, lfsp) * entries in protodir fir in the first DIRBLKSIZ. */ static void -make_dir(bufp, protodir, entries) - void *bufp; - struct direct *protodir; - int entries; +make_dir(void *bufp, struct direct *protodir, int entries) { char *cp; int i, spcleft; diff --git a/sbin/newlfs/misc.c b/sbin/newlfs/misc.c index a2f3bfa8737..c3e5ede59fe 100644 --- a/sbin/newlfs/misc.c +++ b/sbin/newlfs/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.7 2003/11/15 00:18:38 tedu Exp $ */ +/* $OpenBSD: misc.c,v 1.8 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: misc.c,v 1.2 1995/03/18 14:58:51 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: misc.c,v 1.7 2003/11/15 00:18:38 tedu Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.8 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -46,8 +46,7 @@ static char rcsid[] = "$OpenBSD: misc.c,v 1.7 2003/11/15 00:18:38 tedu Exp $"; #include "extern.h" u_int -log2(num) - u_int num; +log2(u_int num) { u_int i, limit; diff --git a/sbin/newlfs/newfs.c b/sbin/newlfs/newfs.c index 614bb81f9fd..f901875b05c 100644 --- a/sbin/newlfs/newfs.c +++ b/sbin/newlfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.14 2003/06/25 21:24:25 deraadt Exp $ */ +/* $OpenBSD: newfs.c,v 1.15 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: newfs.c,v 1.5 1996/05/16 07:17:50 thorpej Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)newfs.c 8.5 (Berkeley) 5/24/95"; #else -static char rcsid[] = "$OpenBSD: newfs.c,v 1.14 2003/06/25 21:24:25 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: newfs.c,v 1.15 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -120,9 +120,7 @@ static void rewritelabel(char *, int, struct disklabel *); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; struct partition *pp; @@ -337,9 +335,7 @@ char lmsg[] = "%s: can't read disk label"; #endif static struct disklabel * -getdisklabel(s, fd) - char *s; - int fd; +getdisklabel(char *s, int fd) { static struct disklabel lab; @@ -364,8 +360,7 @@ getdisklabel(s, fd) static struct disklabel * -debug_readlabel(fd) - int fd; +debug_readlabel(int fd) { static struct disklabel lab; int n; @@ -379,10 +374,7 @@ debug_readlabel(fd) } static void -rewritelabel(s, fd, lp) - char *s; - int fd; - struct disklabel *lp; +rewritelabel(char *s, int fd, struct disklabel *lp) { #ifdef COMPAT if (unlabeled) @@ -433,7 +425,7 @@ rewritelabel(s, fd, lp) } void -usage() +usage(void) { if (mfs) { fprintf(stderr, diff --git a/sbin/raidctl/raidctl.c b/sbin/raidctl/raidctl.c index 8027bee89c8..01f31748596 100644 --- a/sbin/raidctl/raidctl.c +++ b/sbin/raidctl/raidctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raidctl.c,v 1.22 2004/06/21 15:27:18 avsm Exp $ */ +/* $OpenBSD: raidctl.c,v 1.23 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: raidctl.c,v 1.27 2001/07/10 01:30:52 lukem Exp $ */ /*- @@ -101,9 +101,7 @@ int verbose; int do_all; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; int num_options; @@ -365,11 +363,7 @@ main(argc, argv) } void -do_ioctl(fd, command, arg, ioctl_name) - int fd; - unsigned long command; - void *arg; - const char *ioctl_name; +do_ioctl(int fd, unsigned long command, void *arg, const char *ioctl_name) { if (ioctl(fd, command, arg) < 0) errx(1, "ioctl (%s) failed", ioctl_name); @@ -377,10 +371,7 @@ do_ioctl(fd, command, arg, ioctl_name) static void -rf_configure(fds, config_file, force) - fdidpair *fds; - char *config_file; - int force; +rf_configure(fdidpair *fds, char *config_file, int force) { void *generic; RF_Config_t cfg; @@ -401,8 +392,7 @@ rf_configure(fds, config_file, force) } static const char * -device_status(status) - RF_DiskStatus_t status; +device_status(RF_DiskStatus_t status) { switch (status) { @@ -427,9 +417,7 @@ device_status(status) } static void -rf_get_device_status(fds, nfd) - fdidpair *fds; - int nfd; +rf_get_device_status(fdidpair *fds, int nfd) { RF_DeviceConfig_t device_config; void *cfg_ptr; @@ -502,9 +490,7 @@ rf_get_device_status(fds, nfd) } static void -rf_output_configuration(fds, nfd) - fdidpair *fds; - int nfd; +rf_output_configuration(fdidpair *fds, int nfd) { RF_DeviceConfig_t device_config; void *cfg_ptr; @@ -579,11 +565,8 @@ rf_output_configuration(fds, nfd) } static void -get_component_number(fds, component_name, component_number, num_columns) - fdidpair *fds; - char *component_name; - int *component_number; - int *num_columns; +get_component_number(fdidpair *fds, char *component_name, int *component_number, + int *num_columns) { RF_DeviceConfig_t device_config; void *cfg_ptr; @@ -626,10 +609,7 @@ get_component_number(fds, component_name, component_number, num_columns) } static void -rf_fail_disk(fds, component_to_fail, do_recon) - fdidpair *fds; - char *component_to_fail; - int do_recon; +rf_fail_disk(fdidpair *fds, char *component_to_fail, int do_recon) { struct rf_recon_req recon_request; int component_num; @@ -654,9 +634,7 @@ rf_fail_disk(fds, component_to_fail, do_recon) } static void -get_component_label(fds, component) - fdidpair *fds; - char *component; +get_component_label(fdidpair *fds, char *component) { RF_ComponentLabel_t component_label; void *label_ptr; @@ -699,9 +677,7 @@ get_component_label(fds, component) } static void -set_component_label(fds, component) - fdidpair *fds; - char *component; +set_component_label(fdidpair *fds, char *component) { RF_ComponentLabel_t component_label; int component_num; @@ -727,9 +703,7 @@ set_component_label(fds, component) static void -init_component_labels(fds, serial_number) - fdidpair *fds; - int serial_number; +init_component_labels(fdidpair *fds, int serial_number) { RF_ComponentLabel_t component_label; @@ -748,9 +722,7 @@ init_component_labels(fds, serial_number) } static void -set_autoconfig(fds, autoconf) - fdidpair *fds; - char *autoconf; +set_autoconfig(fdidpair *fds, char *autoconf) { int auto_config; int root_config; @@ -783,9 +755,7 @@ set_autoconfig(fds, autoconf) } static void -add_hot_spare(fds, component) - fdidpair *fds; - char *component; +add_hot_spare(fdidpair *fds, char *component) { RF_SingleComponent_t hot_spare; @@ -799,9 +769,7 @@ add_hot_spare(fds, component) } static void -remove_hot_spare(fds, component) - fdidpair *fds; - char *component; +remove_hot_spare(fdidpair *fds, char *component) { RF_SingleComponent_t hot_spare; int component_num; @@ -820,9 +788,7 @@ remove_hot_spare(fds, component) } static void -rebuild_in_place(fds, component) - fdidpair *fds; - char *component; +rebuild_in_place(fdidpair *fds, char *component) { RF_SingleComponent_t comp; int component_num; @@ -846,10 +812,7 @@ rebuild_in_place(fds, component) } static void -check_parity(fds, nfd, do_rewrite) - fdidpair *fds; - int nfd; - int do_rewrite; +check_parity(fdidpair *fds, int nfd, int do_rewrite) { int i, is_clean, all_dirty, was_dirty; int percent_done; @@ -912,10 +875,7 @@ check_parity(fds, nfd, do_rewrite) static void -check_status(fds, nfd, meter) - fdidpair *fds; - int nfd; - int meter; +check_status(fdidpair *fds, int nfd, int meter) { int i; int recon_percent_done = 0; @@ -976,10 +936,7 @@ check_status(fds, nfd, meter) const char *tbits = "|/-\\"; static void -do_meter(fds, nfd, option) - fdidpair *fds; - int nfd; - u_long option; +do_meter(fdidpair *fds, int nfd, u_long option) { int percent_done; int start_value; @@ -1120,10 +1077,7 @@ const char stars[] = "****************************************" " "; static void -get_bar(string, percent, max_strlen) - char *string; - double percent; - int max_strlen; +get_bar(char *string, double percent, int max_strlen) { int offset; @@ -1138,9 +1092,7 @@ get_bar(string, percent, max_strlen) } static void -get_time_string(string, simple_time) - char *string; - int simple_time; +get_time_string(char *string, int simple_time) { int minutes, seconds, hours; char hours_buffer[5]; @@ -1174,9 +1126,7 @@ get_time_string(string, simple_time) } static int -open_device(devfd, name) - fdidpair **devfd; - char *name; +open_device(fdidpair **devfd, char *name) { int nfd, i; struct stat st; @@ -1228,9 +1178,7 @@ open_device(devfd, name) } static int -get_all_devices(diskarray, genericname) - char ***diskarray; - const char *genericname; +get_all_devices(char ***diskarray, const char *genericname) { int i, numdevs, mib[2]; size_t len; @@ -1271,7 +1219,7 @@ get_all_devices(diskarray, genericname) } static void -usage() +usage(void) { fprintf(stderr, "usage: raidctl [-v] [-afFgrR component] [-BGipPsSu] [-cC config_file]\n"); diff --git a/sbin/raidctl/rf_configure.c b/sbin/raidctl/rf_configure.c index f9b63bcf13b..a69507437f9 100644 --- a/sbin/raidctl/rf_configure.c +++ b/sbin/raidctl/rf_configure.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_configure.c,v 1.11 2003/03/13 09:09:27 deraadt Exp $ */ +/* $OpenBSD: rf_configure.c,v 1.12 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: rf_configure.c,v 1.14 2001/02/04 21:05:42 christos Exp $ */ /* @@ -153,9 +153,7 @@ int rf_get_next_nonblank_line(char *buf, int len, FILE *fp, * the system via ioctl. */ int -rf_MakeConfig(configname, cfgPtr) - char *configname; - RF_Config_t *cfgPtr; +rf_MakeConfig(char *configname, RF_Config_t *cfgPtr) { int numscanned, val, r, c, retcode, aa, bb, cc; char buf[256], buf1[256], *cp; @@ -311,10 +309,8 @@ out: * information to be passed into the configuration code. */ int -rf_MakeLayoutSpecificNULL(fp, cfgPtr, ignored) - FILE *fp ATTRIBUTE_UNUSED; - RF_Config_t *cfgPtr; - void *ignored ATTRIBUTE_UNUSED; +rf_MakeLayoutSpecificNULL(FILE *fp ATTRIBUTE_UNUSED, RF_Config_t *cfgPtr, + void *ignored ATTRIBUTE_UNUSED) { cfgPtr->layoutSpecificSize = 0; cfgPtr->layoutSpecific = NULL; @@ -322,10 +318,7 @@ rf_MakeLayoutSpecificNULL(fp, cfgPtr, ignored) } int -rf_MakeLayoutSpecificDeclustered(configfp, cfgPtr, arg) - FILE *configfp; - RF_Config_t *cfgPtr; - void *arg; +rf_MakeLayoutSpecificDeclustered(FILE *configfp, RF_Config_t *cfgPtr, void *arg) { int b, v, k, r, lambda, norotate, i, val, distSpare; char *cfgBuf, *bdfile, *p, *smname; @@ -446,11 +439,7 @@ rf_find_white(char *p) * specified as a parameter */ int -rf_search_file_for_start_of(string, buf, len, fp) - const char *string; - char *buf; - int len; - FILE *fp; +rf_search_file_for_start_of(const char *string, char *buf, int len, FILE *fp) { char *p; @@ -469,11 +458,8 @@ rf_search_file_for_start_of(string, buf, len, fp) /* reads from file fp into buf until it finds an interesting line */ int -rf_get_next_nonblank_line(buf, len, fp, errmsg) - char *buf; - int len ATTRIBUTE_UNUSED; - FILE *fp; - const char *errmsg; +rf_get_next_nonblank_line(char *buf, int len ATTRIBUTE_UNUSED, FILE *fp, + const char *errmsg) { char *p; @@ -503,9 +489,7 @@ rf_get_next_nonblank_line(buf, len, fp, errmsg) * */ void * -rf_ReadSpareTable(req, fname) - RF_SparetWait_t *req; - char *fname; +rf_ReadSpareTable(RF_SparetWait_t *req, char *fname) { int i, j, numFound, linecount, tableNum, tupleNum, spareDisk, spareBlkOffset; diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c index 50f44fe1bc2..e8c50942575 100644 --- a/sbin/restore/dirs.c +++ b/sbin/restore/dirs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dirs.c,v 1.27 2004/04/13 21:51:18 henning Exp $ */ +/* $OpenBSD: dirs.c,v 1.28 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: dirs.c,v 1.26 1997/07/01 05:37:49 lukem Exp $ */ /* @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)dirs.c 8.5 (Berkeley) 8/31/94"; #else -static const char rcsid[] = "$OpenBSD: dirs.c,v 1.27 2004/04/13 21:51:18 henning Exp $"; +static const char rcsid[] = "$OpenBSD: dirs.c,v 1.28 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -139,8 +139,7 @@ static struct direct *searchdir(ino_t, char *); * directories on the tape. */ void -extractdirs(genmode) - int genmode; +extractdirs(int genmode) { int i; struct ufs1_dinode *ip; @@ -209,7 +208,7 @@ extractdirs(genmode) * skip over all the directories on the tape */ void -skipdirs() +skipdirs(void) { while (curfile.dip && (curfile.dip->di_mode & IFMT) == IFDIR) { @@ -222,10 +221,7 @@ skipdirs() * pname and pass them off to be processed. */ void -treescan(pname, ino, todo) - char *pname; - ino_t ino; - long (*todo)(char *, ino_t, int); +treescan(char *pname, ino_t ino, long (*todo)(char *, ino_t, int)) { struct inotab *itp; struct direct *dp; @@ -288,8 +284,7 @@ treescan(pname, ino, todo) * Lookup a pathname which is always assumed to start from the ROOTINO. */ struct direct * -pathsearch(pathname) - const char *pathname; +pathsearch(const char *pathname) { ino_t ino; struct direct *dp; @@ -314,9 +309,7 @@ pathsearch(pathname) * Return its inode number if found, zero if it does not exist. */ static struct direct * -searchdir(inum, name) - ino_t inum; - char *name; +searchdir(ino_t inum, char *name) { struct direct *dp; struct inotab *itp; @@ -339,9 +332,7 @@ searchdir(inum, name) * Put the directory entries in the directory file */ static void -putdir(buf, size) - char *buf; - size_t size; +putdir(char *buf, size_t size) { struct direct cvtbuf; struct odirect *odp; @@ -412,8 +403,7 @@ long prev = 0; * add a new directory entry to a file. */ static void -putent(dp) - struct direct *dp; +putent(struct direct *dp) { dp->d_reclen = DIRSIZ(0, dp); if (dirloc + dp->d_reclen > DIRBLKSIZ) { @@ -431,7 +421,7 @@ putent(dp) * flush out a directory that is finished. */ static void -flushent() +flushent(void) { ((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev; (void)fwrite(dirbuf, (int)dirloc, 1, df); @@ -440,9 +430,7 @@ flushent() } static void -dcvt(odp, ndp) - struct odirect *odp; - struct direct *ndp; +dcvt(struct odirect *odp, struct direct *ndp) { memset(ndp, 0, (size_t)(sizeof *ndp)); @@ -461,9 +449,7 @@ dcvt(odp, ndp) * the desired seek offset into it. */ static void -rst_seekdir(dirp, loc, base) - RST_DIR *dirp; - long loc, base; +rst_seekdir(RST_DIR *dirp, long loc, long base) { if (loc == rst_telldir(dirp)) @@ -481,8 +467,7 @@ rst_seekdir(dirp, loc, base) * get next entry in a directory. */ struct direct * -rst_readdir(dirp) - RST_DIR *dirp; +rst_readdir(RST_DIR *dirp) { struct direct *dp; @@ -522,8 +507,7 @@ rst_readdir(dirp) * Simulate the opening of a directory */ RST_DIR * -rst_opendir(name) - const char *name; +rst_opendir(const char *name) { struct inotab *itp; RST_DIR *dirp; @@ -542,10 +526,8 @@ rst_opendir(name) * In our case, there is nothing to do when closing a directory. */ void -rst_closedir(dirp) - RST_DIR *dirp; +rst_closedir(RST_DIR *dirp) { - (void)close(dirp->dd_fd); free(dirp); return; @@ -555,8 +537,7 @@ rst_closedir(dirp) * Simulate finding the current offset in the directory. */ static long -rst_telldir(dirp) - RST_DIR *dirp; +rst_telldir(RST_DIR *dirp) { return ((long)lseek(dirp->dd_fd, (off_t)0, SEEK_CUR) - dirp->dd_size + dirp->dd_loc); @@ -566,8 +547,7 @@ rst_telldir(dirp) * Open a directory file. */ static RST_DIR * -opendirfile(name) - const char *name; +opendirfile(const char *name) { RST_DIR *dirp; int fd; @@ -587,8 +567,7 @@ opendirfile(name) * Set the mode, owner, and times for all new or changed directories */ void -setdirmodes(flags) - int flags; +setdirmodes(int flags) { FILE *mf; struct modeinfo node; @@ -648,9 +627,7 @@ setdirmodes(flags) * Generate a literal copy of a directory. */ int -genliteraldir(name, ino) - char *name; - ino_t ino; +genliteraldir(char *name, ino_t ino) { struct inotab *itp; int ofile, dp, i, size; @@ -688,8 +665,7 @@ genliteraldir(name, ino) * Determine the type of an inode */ int -inodetype(ino) - ino_t ino; +inodetype(ino_t ino) { struct inotab *itp; @@ -704,10 +680,7 @@ inodetype(ino) * If requested, save its pertinent mode, owner, and time info. */ static struct inotab * -allocinotab(ino, dip, seekpt) - ino_t ino; - struct ufs1_dinode *dip; - long seekpt; +allocinotab(ino_t ino, struct ufs1_dinode *dip, long seekpt) { struct inotab *itp; struct modeinfo node; @@ -738,8 +711,7 @@ allocinotab(ino, dip, seekpt) * Look up an inode in the table of directories */ static struct inotab * -inotablookup(ino) - ino_t ino; +inotablookup(ino_t ino) { struct inotab *itp; @@ -753,7 +725,7 @@ inotablookup(ino) * Clean up and exit */ void -cleanup() +cleanup(void) { closemt(); diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index 63127b90e28..6503a2e13db 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interactive.c,v 1.19 2003/07/28 06:13:26 tedu Exp $ */ +/* $OpenBSD: interactive.c,v 1.20 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: interactive.c,v 1.10 1997/03/19 08:42:52 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)interactive.c 8.3 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: interactive.c,v 1.19 2003/07/28 06:13:26 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: interactive.c,v 1.20 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -97,7 +97,7 @@ static void printlist(char *, char *); * Read and execute commands from the terminal. */ void -runcmdshell() +runcmdshell(void) { struct entry *np; ino_t ino; @@ -305,12 +305,8 @@ loop: * eliminate any embedded ".." components. */ static void -getcmd(curdir, cmd, cmdlen, name, namelen, ap) - char *curdir, *cmd; - size_t cmdlen; - char *name; - size_t namelen; - struct arglist *ap; +getcmd(char *curdir, char *cmd, size_t cmdlen, char *name, size_t namelen, + struct arglist *ap) { char *cp; static char input[BUFSIZ]; @@ -413,8 +409,7 @@ retnext: * Strip off the next token of the input. */ static char * -copynext(input, output) - char *input, *output; +copynext(char *input, char *output) { char *cp, *bp; char quote; @@ -463,9 +458,7 @@ copynext(input, output) * remove any imbedded "." and ".." components. */ void -canon(rawname, canonname, canonnamelen) - char *rawname, *canonname; - size_t canonnamelen; +canon(char *rawname, char *canonname, size_t canonnamelen) { char *cp, *np; @@ -514,9 +507,7 @@ canon(rawname, canonname, canonnamelen) * Do an "ls" style listing of a directory */ static void -printlist(name, basename) - char *name; - char *basename; +printlist(char *name, char *basename) { struct afile *fp, *list, *listp = NULL; struct direct *dp; @@ -598,10 +589,7 @@ printlist(name, basename) * Read the contents of a directory. */ static void -mkentry(name, dp, fp) - char *name; - struct direct *dp; - struct afile *fp; +mkentry(char *name, struct direct *dp, struct afile *fp) { char *cp; struct entry *np; @@ -661,9 +649,7 @@ mkentry(name, dp, fp) * Print out a pretty listing of a directory */ static void -formatf(list, nentry) - struct afile *list; - int nentry; +formatf(struct afile *list, int nentry) { struct afile *fp, *endlist; int width, bigino, haveprefix, havepostfix; @@ -734,8 +720,7 @@ formatf(list, nentry) #undef d_ino struct dirent * -glob_readdir(dirp) - RST_DIR *dirp; +glob_readdir(RST_DIR *dirp) { struct direct *dp; static struct dirent adirent; @@ -758,9 +743,7 @@ glob_readdir(dirp) * Return st_mode information in response to stat or lstat calls */ static int -glob_stat(name, stp) - const char *name; - struct stat *stp; +glob_stat(const char *name, struct stat *stp) { struct direct *dp; @@ -779,8 +762,7 @@ glob_stat(name, stp) * Comparison routine for qsort. */ static int -fcmp(f1, f2) - const void *f1, *f2; +fcmp(const void *f1, const void *f2) { return (strcmp(((struct afile *)f1)->fname, ((struct afile *)f2)->fname)); @@ -790,8 +772,7 @@ fcmp(f1, f2) * respond to interrupts */ void -onintr(signo) - int signo; +onintr(int signo) { int save_errno = errno; diff --git a/sbin/restore/main.c b/sbin/restore/main.c index 4d2ad3e1541..6a92716d765 100644 --- a/sbin/restore/main.c +++ b/sbin/restore/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.14 2003/07/28 06:13:26 tedu Exp $ */ +/* $OpenBSD: main.c,v 1.15 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: main.c,v 1.13 1997/07/01 05:37:51 lukem Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: main.c,v 1.14 2003/07/28 06:13:26 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: main.c,v 1.15 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -80,9 +80,7 @@ static void obsolete(int *, char **[]); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; ino_t ino; @@ -285,7 +283,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: %s -i [-chmvy] [-b blocksize] [-f file] [-s fileno]\n", __progname); @@ -302,9 +300,7 @@ usage() * getopt(3) will like. */ static void -obsolete(argcp, argvp) - int *argcp; - char **argvp[]; +obsolete(int *argcp, char **argvp[]) { int argc, flags; char *ap, **argv, *flagsp, **nargv, *p; diff --git a/sbin/restore/restore.c b/sbin/restore/restore.c index 9b8d38be8c2..60b460d2895 100644 --- a/sbin/restore/restore.c +++ b/sbin/restore/restore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: restore.c,v 1.12 2003/07/29 18:38:36 deraadt Exp $ */ +/* $OpenBSD: restore.c,v 1.13 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: restore.c,v 1.9 1997/06/18 07:10:16 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: restore.c,v 1.12 2003/07/29 18:38:36 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: restore.c,v 1.13 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -56,10 +56,7 @@ static char *keyval(int); * List entries on the tape. */ long -listfile(name, ino, type) - char *name; - ino_t ino; - int type; +listfile(char *name, ino_t ino, int type) { long descend = hflag ? GOOD : FAIL; @@ -75,10 +72,7 @@ listfile(name, ino, type) * Request that new entries be extracted. */ long -addfile(name, ino, type) - char *name; - ino_t ino; - int type; +addfile(char *name, ino_t ino, int type) { struct entry *ep; long descend = hflag ? GOOD : FAIL; @@ -119,10 +113,7 @@ addfile(name, ino, type) */ /* ARGSUSED */ long -deletefile(name, ino, type) - char *name; - ino_t ino; - int type; +deletefile(char *name, ino_t ino, int type) { long descend = hflag ? GOOD : FAIL; struct entry *ep; @@ -160,7 +151,7 @@ static struct entry *removelist; * Remove directories from the lookup chains. */ void -removeoldleaves() +removeoldleaves(void) { struct entry *ep, *nextep; ino_t i, mydirino; @@ -213,10 +204,7 @@ removeoldleaves() * Renames are done at the same time. */ long -nodeupdates(name, ino, type) - char *name; - ino_t ino; - int type; +nodeupdates(char *name, ino_t ino, int type) { struct entry *ep, *np, *ip; long descend = GOOD; @@ -503,8 +491,7 @@ nodeupdates(name, ino, type) * Calculate the active flags in a key. */ static char * -keyval(key) - int key; +keyval(int key) { static char keybuf[32]; @@ -525,7 +512,7 @@ keyval(key) * Find unreferenced link names. */ void -findunreflinks() +findunreflinks(void) { struct entry *ep, *np; ino_t i; @@ -573,7 +560,7 @@ findunreflinks() * time O(N). */ void -removeoldnodes() +removeoldnodes(void) { struct entry *ep, **prev; long change; @@ -602,8 +589,7 @@ removeoldnodes() * Extract new leaves. */ void -createleaves(symtabfile) - char *symtabfile; +createleaves(char *symtabfile) { struct entry *ep; ino_t first; @@ -682,7 +668,7 @@ createleaves(symtabfile) * Efficiently extract a subset of the files on a tape. */ void -createfiles() +createfiles(void) { ino_t first, next, last; struct entry *ep; @@ -770,7 +756,7 @@ createfiles() * Add links. */ void -createlinks() +createlinks(void) { struct entry *np, *ep; ino_t i; @@ -810,7 +796,7 @@ createlinks() * that no temporary names remain. */ void -checkrestore() +checkrestore(void) { struct entry *ep; ino_t i; @@ -832,10 +818,7 @@ checkrestore() * A paranoid check that things are as they should be. */ long -verifyfile(name, ino, type) - char *name; - ino_t ino; - int type; +verifyfile(char *name, ino_t ino, int type) { struct entry *np, *ep; long descend = GOOD; diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c index 547f15a5c60..314c11b29e8 100644 --- a/sbin/restore/symtab.c +++ b/sbin/restore/symtab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: symtab.c,v 1.13 2003/11/08 19:17:28 jmc Exp $ */ +/* $OpenBSD: symtab.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: symtab.c,v 1.10 1997/03/19 08:42:54 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)symtab.c 8.2 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: symtab.c,v 1.13 2003/11/08 19:17:28 jmc Exp $"; +static const char rcsid[] = "$OpenBSD: symtab.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -81,8 +81,7 @@ static void removeentry(struct entry *); * Look up an entry by inode number */ struct entry * -lookupino(inum) - ino_t inum; +lookupino(ino_t inum) { struct entry *ep; @@ -98,9 +97,7 @@ lookupino(inum) * Add an entry into the entry table */ static void -addino(inum, np) - ino_t inum; - struct entry *np; +addino(ino_t inum, struct entry *np) { struct entry **epp; @@ -120,8 +117,7 @@ addino(inum, np) * Delete an entry from the entry table */ void -deleteino(inum) - ino_t inum; +deleteino(ino_t inum) { struct entry *next; struct entry **prev; @@ -144,8 +140,7 @@ deleteino(inum) * Look up an entry by name */ struct entry * -lookupname(name) - char *name; +lookupname(char *name) { struct entry *ep; char *np, *cp; @@ -174,8 +169,7 @@ lookupname(name) * Look up the parent of a pathname */ static struct entry * -lookupparent(name) - char *name; +lookupparent(char *name) { struct entry *ep; char *tailindex; @@ -197,8 +191,7 @@ lookupparent(name) * Determine the current pathname of a node or leaf */ char * -myname(ep) - struct entry *ep; +myname(struct entry *ep) { char *cp; static char namebuf[MAXPATHLEN]; @@ -225,10 +218,7 @@ static struct entry *freelist = NULL; * add an entry to the symbol table */ struct entry * -addentry(name, inum, type) - char *name; - ino_t inum; - int type; +addentry(char *name, ino_t inum, int type) { struct entry *np, *ep; @@ -276,8 +266,7 @@ addentry(name, inum, type) * delete an entry from the symbol table */ void -freeentry(ep) - struct entry *ep; +freeentry(struct entry *ep) { struct entry *np; ino_t inum; @@ -320,9 +309,7 @@ freeentry(ep) * Relocate an entry in the tree structure */ void -moveentry(ep, newname) - struct entry *ep; - char *newname; +moveentry(struct entry *ep, char *newname) { struct entry *np; char *cp; @@ -350,8 +337,7 @@ moveentry(ep, newname) * Remove an entry in the tree structure */ static void -removeentry(ep) - struct entry *ep; +removeentry(struct entry *ep) { struct entry *np; @@ -396,8 +382,7 @@ static struct strhdr strtblhdr[allocsize(NAME_MAX) / STRTBLINCR]; * has an appropriate sized entry, and if not allocates a new one. */ char * -savename(name) - char *name; +savename(char *name) { struct strhdr *np; long len; @@ -424,8 +409,7 @@ savename(name) * appropriate free list. */ void -freename(name) - char *name; +freename(char *name) { struct strhdr *tp, *np; @@ -452,9 +436,7 @@ struct symtableheader { * dump a snapshot of the symbol table */ void -dumpsymtable(filename, checkpt) - char *filename; - long checkpt; +dumpsymtable(char *filename, long checkpt) { struct entry *ep, *tep; ino_t i; @@ -539,8 +521,7 @@ dumpsymtable(filename, checkpt) * Initialize a symbol table from a file */ void -initsymtable(filename) - char *filename; +initsymtable(char *filename) { char *base; long tblsize; diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index cc06ec02573..3d993e0197c 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tape.c,v 1.28 2004/04/13 21:51:18 henning Exp $ */ +/* $OpenBSD: tape.c,v 1.29 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: tape.c,v 1.26 1997/04/15 07:12:25 lukem Exp $ */ /* @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)tape.c 8.6 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: tape.c,v 1.28 2004/04/13 21:51:18 henning Exp $"; +static const char rcsid[] = "$OpenBSD: tape.c,v 1.29 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -111,8 +111,7 @@ static void xtrskip(char *, size_t); * Set up an input source */ void -setinput(source) - char *source; +setinput(char *source) { FLUSHTAPEBUF(); if (bflag) @@ -148,8 +147,7 @@ setinput(source) } void -newtapebuf(size) - long size; +newtapebuf(long size) { static long tapebufsize = -1; @@ -169,7 +167,7 @@ newtapebuf(size) * that it actually is a dump tape. */ void -setup() +setup(void) { int i, j, *ip; struct stat stbuf; @@ -265,8 +263,7 @@ setup() * the user when only extracting a subset of the files. */ void -getvol(nextvol) - long nextvol; +getvol(long nextvol) { long newvol = 0, savecnt, wantnext, i; union u_spcl tmpspcl; @@ -432,7 +429,7 @@ gethdr: * Handle unexpected EOF. */ static void -terminateinput() +terminateinput(void) { if (gettingfile && curfile.action == USING) { @@ -454,7 +451,7 @@ terminateinput() * appropriate one. */ static void -setdumpnum() +setdumpnum(void) { struct mtop tcom; @@ -474,7 +471,7 @@ setdumpnum() } void -printdumpinfo() +printdumpinfo(void) { fprintf(stdout, "Dump date: %s", ctime(&spcl.c_date)); fprintf(stdout, "Dumped from: %s", @@ -487,8 +484,7 @@ printdumpinfo() } int -extractfile(name) - char *name; +extractfile(char *name) { u_int flags; mode_t mode; @@ -610,7 +606,7 @@ extractfile(name) * skip over bit maps on the tape */ void -skipmaps() +skipmaps(void) { while (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI) @@ -621,7 +617,7 @@ skipmaps() * skip over a file on the tape */ void -skipfile() +skipfile(void) { curfile.action = SKIP; @@ -638,9 +634,7 @@ skipfile() * and no blocks should be skipped. */ void -getfile(fill, skip) - void (*fill)(char *, size_t); - void (*skip)(char *, size_t); +getfile(void (*fill)(char *, size_t), void (*skip)(char *, size_t)) { int i; volatile int curblk = 0; @@ -701,9 +695,7 @@ loop: * Write out the next block of a file. */ static void -xtrfile(buf, size) - char *buf; - size_t size; +xtrfile(char *buf, size_t size) { if (Nflag) @@ -718,9 +710,7 @@ xtrfile(buf, size) */ /* ARGSUSED */ static void -xtrskip(buf, size) - char *buf; - size_t size; +xtrskip(char *buf, size_t size) { if (lseek(ofile, (off_t)size, SEEK_CUR) == -1) @@ -732,9 +722,7 @@ xtrskip(buf, size) * Collect the next block of a symbolic link. */ static void -xtrlnkfile(buf, size) - char *buf; - size_t size; +xtrlnkfile(char *buf, size_t size) { pathlen += size; @@ -749,9 +737,7 @@ xtrlnkfile(buf, size) */ /* ARGSUSED */ static void -xtrlnkskip(buf, size) - char *buf; - size_t size; +xtrlnkskip(char *buf, size_t size) { errx(1, "unallocated block in symbolic link %s", curfile.name); @@ -761,9 +747,7 @@ xtrlnkskip(buf, size) * Collect the next block of a bit map. */ static void -xtrmap(buf, size) - char *buf; - size_t size; +xtrmap(char *buf, size_t size) { memcpy(map, buf, size); @@ -775,9 +759,7 @@ xtrmap(buf, size) */ /* ARGSUSED */ static void -xtrmapskip(buf, size) - char *buf; - size_t size; +xtrmapskip(char *buf, size_t size) { panic("hole in map\n"); @@ -789,9 +771,7 @@ xtrmapskip(buf, size) */ /* ARGSUSED */ void -xtrnull(buf, size) - char *buf; - size_t size; +xtrnull(char *buf, size_t size) { return; @@ -802,8 +782,7 @@ xtrnull(buf, size) * Handle read errors, and end of media. */ static void -readtape(buf) - char *buf; +readtape(char *buf) { long rd, newvol, i; int cnt, seek_failed; @@ -918,7 +897,7 @@ getmore: } static void -findtapeblksize() +findtapeblksize(void) { long i; @@ -945,7 +924,7 @@ findtapeblksize() } void -closemt() +closemt(void) { if (mt < 0) @@ -965,8 +944,7 @@ closemt() * If it is not any valid header, return an error. */ static int -gethead(buf) - struct s_spcl *buf; +gethead(struct s_spcl *buf) { long i; union { @@ -1104,8 +1082,7 @@ good: * Check that a header is where it belongs and predict the next header */ static void -accthdr(header) - struct s_spcl *header; +accthdr(struct s_spcl *header) { static ino_t previno = 0x7fffffff; static int prevtype; @@ -1173,8 +1150,7 @@ newcalc: * Complain if had to skip, and complain is set. */ static void -findinode(header) - struct s_spcl *header; +findinode(struct s_spcl *header) { static long skipcnt = 0; long i; @@ -1238,8 +1214,7 @@ findinode(header) } static int -checksum(buf) - int *buf; +checksum(int *buf) { int i, j; @@ -1280,9 +1255,7 @@ msg(const char *fmt, ...) #endif /* RRESTORE */ static u_char * -swabshort(sp, n) - u_char *sp; - int n; +swabshort(u_char *sp, int n) { char c; @@ -1294,9 +1267,7 @@ swabshort(sp, n) } static u_char * -swablong(sp, n) - u_char *sp; - int n; +swablong(u_char *sp, int n) { char c; @@ -1309,8 +1280,7 @@ swablong(sp, n) } void -swabst(cp, sp) - u_char *cp, *sp; +swabst(u_char *cp, u_char *sp) { int n = 0; @@ -1345,8 +1315,7 @@ swabst(cp, sp) } static u_long -swabl(x) - u_long x; +swabl(u_long x) { swabst((u_char *)"l", (u_char *)&x); return (x); diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c index 36662c34686..633f54884e9 100644 --- a/sbin/restore/utilities.c +++ b/sbin/restore/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.13 2003/07/28 06:13:26 tedu Exp $ */ +/* $OpenBSD: utilities.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $ */ /* $NetBSD: utilities.c,v 1.11 1997/03/19 08:42:56 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.4 (Berkeley) 10/18/94"; #else -static const char rcsid[] = "$OpenBSD: utilities.c,v 1.13 2003/07/28 06:13:26 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: utilities.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $"; #endif #endif /* not lint */ @@ -58,8 +58,7 @@ static const char rcsid[] = "$OpenBSD: utilities.c,v 1.13 2003/07/28 06:13:26 te * Insure that all the components of a pathname exist. */ void -pathcheck(name) - char *name; +pathcheck(char *name) { char *cp; struct entry *ep; @@ -87,8 +86,7 @@ pathcheck(name) * Change a name to a unique temporary name. */ void -mktempname(ep) - struct entry *ep; +mktempname(struct entry *ep) { char oldname[MAXPATHLEN]; @@ -106,8 +104,7 @@ mktempname(ep) * Generate a temporary name for an entry. */ char * -gentempname(ep) - struct entry *ep; +gentempname(struct entry *ep) { static char name[MAXPATHLEN]; struct entry *np; @@ -126,8 +123,7 @@ gentempname(ep) * Rename a file or directory. */ void -renameit(from, to) - char *from, *to; +renameit(char *from, char *to) { if (!Nflag && rename(from, to) < 0) { warn("cannot rename %s to %s", from, to); @@ -140,8 +136,7 @@ renameit(from, to) * Create a new node (directory). */ void -newnode(np) - struct entry *np; +newnode(struct entry *np) { char *cp; @@ -160,8 +155,7 @@ newnode(np) * Remove an old node (directory). */ void -removenode(ep) - struct entry *ep; +removenode(struct entry *ep) { char *cp; @@ -183,8 +177,7 @@ removenode(ep) * Remove a leaf. */ void -removeleaf(ep) - struct entry *ep; +removeleaf(struct entry *ep) { char *cp; @@ -204,9 +197,7 @@ removeleaf(ep) * Create a link. */ int -linkit(existing, new, type) - char *existing, *new; - int type; +linkit(char *existing, char *new, int type) { if (type == SYMLINK) { @@ -234,8 +225,7 @@ linkit(existing, new, type) * Create a whiteout. */ int -addwhiteout(name) - char *name; +addwhiteout(char *name) { if (!Nflag && mknod(name, S_IFWHT, 0) < 0) { @@ -250,8 +240,7 @@ addwhiteout(name) * Delete a whiteout. */ void -delwhiteout(ep) - struct entry *ep; +delwhiteout(struct entry *ep) { char *name; @@ -271,8 +260,7 @@ delwhiteout(ep) * find lowest number file (above "start") that needs to be extracted */ ino_t -lowerbnd(start) - ino_t start; +lowerbnd(ino_t start) { struct entry *ep; @@ -290,8 +278,7 @@ lowerbnd(start) * find highest number file (below "start") that needs to be extracted */ ino_t -upperbnd(start) - ino_t start; +upperbnd(ino_t start) { struct entry *ep; @@ -309,9 +296,7 @@ upperbnd(start) * report on a badly formed entry */ void -badentry(ep, msg) - struct entry *ep; - char *msg; +badentry(struct entry *ep, char *msg) { fprintf(stderr, "bad entry: %s\n", msg); @@ -336,8 +321,7 @@ badentry(ep, msg) * Construct a string indicating the active flag bits of an entry. */ char * -flagvalues(ep) - struct entry *ep; +flagvalues(struct entry *ep) { static char flagbuf[BUFSIZ]; @@ -362,8 +346,7 @@ flagvalues(ep) * Check to see if a name is on a dump tape. */ ino_t -dirlookup(name) - const char *name; +dirlookup(const char *name) { struct direct *dp; ino_t ino; @@ -379,8 +362,7 @@ dirlookup(name) * Elicit a reply. */ int -reply(question) - char *question; +reply(char *question) { int c; |