diff options
author | imp <imp@FreeBSD.org> | 2002-03-20 22:49:40 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-03-20 22:49:40 +0000 |
commit | 69763106f0fd2b6bc5d1d93ba49d88ca38ea3c56 (patch) | |
tree | 07ff12515683ef4e24a284e242c874bd8b92d427 /sbin/restore | |
parent | 2e58ec02712d7b8dffd130dacaad2ad7c24c592b (diff) | |
download | FreeBSD-src-69763106f0fd2b6bc5d1d93ba49d88ca38ea3c56.zip FreeBSD-src-69763106f0fd2b6bc5d1d93ba49d88ca38ea3c56.tar.gz |
o remove __P
o Use ANSI function definitions
o unifdef -D__STDC__
Diffstat (limited to 'sbin/restore')
-rw-r--r-- | sbin/restore/dirs.c | 90 | ||||
-rw-r--r-- | sbin/restore/extern.h | 146 | ||||
-rw-r--r-- | sbin/restore/interactive.c | 56 | ||||
-rw-r--r-- | sbin/restore/main.c | 12 | ||||
-rw-r--r-- | sbin/restore/restore.c | 45 | ||||
-rw-r--r-- | sbin/restore/symtab.c | 53 | ||||
-rw-r--r-- | sbin/restore/tape.c | 139 | ||||
-rw-r--r-- | sbin/restore/utilities.c | 65 |
8 files changed, 221 insertions, 385 deletions
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c index 46cd7f3..32da860 100644 --- a/sbin/restore/dirs.c +++ b/sbin/restore/dirs.c @@ -120,16 +120,16 @@ struct odirect { char d_name[ODIRSIZ]; }; -static struct inotab *allocinotab __P((ino_t, struct dinode *, long)); -static void dcvt __P((struct odirect *, struct direct *)); -static void flushent __P((void)); -static struct inotab *inotablookup __P((ino_t)); -static RST_DIR *opendirfile __P((const char *)); -static void putdir __P((char *, long)); -static void putent __P((struct direct *)); -static void rst_seekdir __P((RST_DIR *, long, long)); -static long rst_telldir __P((RST_DIR *)); -static struct direct *searchdir __P((ino_t, char *)); +static struct inotab *allocinotab(ino_t, struct dinode *, long); +static void dcvt(struct odirect *, struct direct *); +static void flushent(void); +static struct inotab *inotablookup(ino_t); +static RST_DIR *opendirfile(const char *); +static void putdir(char *, long); +static void putent(struct direct *); +static void rst_seekdir(RST_DIR *, long, long); +static long rst_telldir(RST_DIR *); +static struct direct *searchdir(ino_t, char *); /* * Extract directory contents, building up a directory structure @@ -138,8 +138,7 @@ static struct direct *searchdir __P((ino_t, char *)); * directories on the tape. */ void -extractdirs(genmode) - int genmode; +extractdirs(int genmode) { int i; struct dinode *ip; @@ -211,7 +210,7 @@ extractdirs(genmode) * skip over all the directories on the tape */ void -skipdirs() +skipdirs(void) { while (curfile.dip && (curfile.dip->di_mode & IFMT) == IFDIR) { @@ -224,10 +223,7 @@ skipdirs() * pname and pass them off to be processed. */ void -treescan(pname, ino, todo) - char *pname; - ino_t ino; - long (*todo) __P((char *, ino_t, int)); +treescan(char *pname, ino_t ino, long (*todo)(char *, ino_t, int)) { struct inotab *itp; struct direct *dp; @@ -291,8 +287,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; @@ -317,9 +312,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; @@ -342,9 +335,7 @@ searchdir(inum, name) * Put the directory entries in the directory file */ static void -putdir(buf, size) - char *buf; - long size; +putdir(char *buf, long size) { struct direct cvtbuf; struct odirect *odp; @@ -414,8 +405,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) { @@ -433,7 +423,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); @@ -442,9 +432,7 @@ flushent() } static void -dcvt(odp, ndp) - struct odirect *odp; - struct direct *ndp; +dcvt(struct odirect *odp, struct direct *ndp) { memset(ndp, 0, (long)(sizeof *ndp)); @@ -463,9 +451,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)) @@ -483,8 +469,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; @@ -524,8 +509,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; @@ -544,8 +528,7 @@ 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); @@ -557,8 +540,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); @@ -568,8 +550,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; @@ -589,8 +570,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; @@ -654,9 +634,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; @@ -699,8 +677,7 @@ genliteraldir(name, ino) * Determine the type of an inode */ int -inodetype(ino) - ino_t ino; +inodetype(ino_t ino) { struct inotab *itp; @@ -715,10 +692,7 @@ inodetype(ino) * If requested, save its pertinent mode, owner, and time info. */ static struct inotab * -allocinotab(ino, dip, seekpt) - ino_t ino; - struct dinode *dip; - long seekpt; +allocinotab(ino_t ino, struct dinode *dip, long seekpt) { struct inotab *itp; struct modeinfo node; @@ -749,8 +723,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; @@ -764,8 +737,7 @@ inotablookup(ino) * Clean up and exit */ void -done(exitcode) - int exitcode; +done(int exitcode) { closemt(); diff --git a/sbin/restore/extern.h b/sbin/restore/extern.h index 0724850..4a4a2d8 100644 --- a/sbin/restore/extern.h +++ b/sbin/restore/extern.h @@ -34,78 +34,78 @@ * $FreeBSD$ */ -struct entry *addentry __P((char *, ino_t, int)); -long addfile __P((char *, ino_t, int)); -int addwhiteout __P((char *)); -void badentry __P((struct entry *, char *)); -void canon __P((char *, char *, int)); -void checkrestore __P((void)); -void closemt __P((void)); -void createfiles __P((void)); -void createleaves __P((char *)); -void createlinks __P((void)); -long deletefile __P((char *, ino_t, int)); -void deleteino __P((ino_t)); -void delwhiteout __P((struct entry *)); -ino_t dirlookup __P((const char *)); -void done __P((int)) __dead2; -void dumpsymtable __P((char *, long)); -void extractdirs __P((int)); -int extractfile __P((char *)); -void findunreflinks __P((void)); -char *flagvalues __P((struct entry *)); -void freeentry __P((struct entry *)); -void freename __P((char *)); -int genliteraldir __P((char *, ino_t)); -char *gentempname __P((struct entry *)); -void getfile __P((void (*)(char *, long), void (*)(char *, long))); -void getvol __P((long)); -void initsymtable __P((char *)); -int inodetype __P((ino_t)); -int linkit __P((char *, char *, int)); -struct entry *lookupino __P((ino_t)); -struct entry *lookupname __P((char *)); -long listfile __P((char *, ino_t, int)); -ino_t lowerbnd __P((ino_t)); -void mktempname __P((struct entry *)); -void moveentry __P((struct entry *, char *)); -void msg __P((const char *, ...)) __printflike(1, 2); -char *myname __P((struct entry *)); -void newnode __P((struct entry *)); -void newtapebuf __P((long)); -long nodeupdates __P((char *, ino_t, int)); -void onintr __P((int)); -void panic __P((const char *, ...)) __printflike(1, 2); -void pathcheck __P((char *)); -struct direct *pathsearch __P((const char *)); -void printdumpinfo __P((void)); -void removeleaf __P((struct entry *)); -void removenode __P((struct entry *)); -void removeoldleaves __P((void)); -void removeoldnodes __P((void)); -void renameit __P((char *, char *)); -int reply __P((char *)); -RST_DIR *rst_opendir __P((const char *)); -struct direct *rst_readdir __P((RST_DIR *)); -void rst_closedir __P((RST_DIR *dirp)); -void runcmdshell __P((void)); -char *savename __P((char *)); -void setdirmodes __P((int)); -void setinput __P((char *)); -void setup __P((void)); -void skipdirs __P((void)); -void skipfile __P((void)); -void skipmaps __P((void)); -void swabst __P((u_char *, u_char *)); -void treescan __P((char *, ino_t, long (*)(char *, ino_t, int))); -ino_t upperbnd __P((ino_t)); -long verifyfile __P((char *, ino_t, int)); -void xtrnull __P((char *, long)); +struct entry *addentry(char *, ino_t, int); +long addfile(char *, ino_t, int); +int addwhiteout(char *); +void badentry(struct entry *, char *); +void canon(char *, char *, int); +void checkrestore(void); +void closemt(void); +void createfiles(void); +void createleaves(char *); +void createlinks(void); +long deletefile(char *, ino_t, int); +void deleteino(ino_t); +void delwhiteout(struct entry *); +ino_t dirlookup(const char *); +void done(int) __dead2; +void dumpsymtable(char *, long); +void extractdirs(int); +int extractfile(char *); +void findunreflinks(void); +char *flagvalues(struct entry *); +void freeentry(struct entry *); +void freename(char *); +int genliteraldir(char *, ino_t); +char *gentempname(struct entry *); +void getfile(void (*)(char *, long), void (*)(char *, long)); +void getvol(long); +void initsymtable(char *); +int inodetype(ino_t); +int linkit(char *, char *, int); +struct entry *lookupino(ino_t); +struct entry *lookupname(char *); +long listfile(char *, ino_t, int); +ino_t lowerbnd(ino_t); +void mktempname(struct entry *); +void moveentry(struct entry *, char *); +void msg(const char *, ...) __printflike(1, 2); +char *myname(struct entry *); +void newnode(struct entry *); +void newtapebuf(long); +long nodeupdates(char *, ino_t, int); +void onintr(int); +void panic(const char *, ...) __printflike(1, 2); +void pathcheck(char *); +struct direct *pathsearch(const char *); +void printdumpinfo(void); +void removeleaf(struct entry *); +void removenode(struct entry *); +void removeoldleaves(void); +void removeoldnodes(void); +void renameit(char *, char *); +int reply(char *); +RST_DIR *rst_opendir(const char *); +struct direct *rst_readdir(RST_DIR *); +void rst_closedir(RST_DIR *dirp); +void runcmdshell(void); +char *savename(char *); +void setdirmodes(int); +void setinput(char *); +void setup(void); +void skipdirs(void); +void skipfile(void); +void skipmaps(void); +void swabst(u_char *, u_char *); +void treescan(char *, ino_t, long (*)(char *, ino_t, int)); +ino_t upperbnd(ino_t); +long verifyfile(char *, ino_t, int); +void xtrnull(char *, long); /* From ../dump/dumprmt.c */ -void rmtclose __P((void)); -int rmthost __P((char *)); -int rmtioctl __P((int, int)); -int rmtopen __P((char *, int)); -int rmtread __P((char *, int)); -int rmtseek __P((int, int)); +void rmtclose(void); +int rmthost(char *); +int rmtioctl(int, int); +int rmtopen(char *, int); +int rmtread(char *, int); +int rmtseek(int, int); diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index e04f48e..54f16e3 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -81,20 +81,20 @@ struct arglist { char *cmd; /* the current command */ }; -static char *copynext __P((char *, char *)); -static int fcmp __P((const void *, const void *)); -static void formatf __P((struct afile *, int)); -static void getcmd __P((char *, char *, char *, int, struct arglist *)); -struct dirent *glob_readdir __P((RST_DIR *dirp)); -static int glob_stat __P((const char *, struct stat *)); -static void mkentry __P((char *, struct direct *, struct afile *)); -static void printlist __P((char *, char *)); +static char *copynext(char *, char *); +static int fcmp(const void *, const void *); +static void formatf(struct afile *, int); +static void getcmd(char *, char *, char *, int, struct arglist *); +struct dirent *glob_readdir(RST_DIR *dirp); +static int glob_stat(const char *, struct stat *); +static void mkentry(char *, struct direct *, struct afile *); +static void printlist(char *, char *); /* * Read and execute commands from the terminal. */ void -runcmdshell() +runcmdshell(void) { struct entry *np; ino_t ino; @@ -302,10 +302,7 @@ loop: * eliminate any embedded ".." components. */ static void -getcmd(curdir, cmd, name, size, ap) - char *curdir, *cmd, *name; - struct arglist *ap; - int size; +getcmd(char *curdir, char *cmd, char *name, int size, struct arglist *ap) { char *cp; static char input[BUFSIZ]; @@ -390,8 +387,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; @@ -440,9 +436,7 @@ copynext(input, output) * remove any embedded "." and ".." components. */ void -canon(rawname, canonname, len) - char *rawname, *canonname; - int len; +canon(char *rawname, char *canonname, int len) { char *cp, *np; @@ -496,9 +490,7 @@ canon(rawname, canonname, len) * 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; struct direct *dp; @@ -580,10 +572,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; @@ -643,9 +632,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; @@ -716,8 +703,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; @@ -740,9 +726,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; @@ -761,8 +745,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)); @@ -772,8 +755,7 @@ fcmp(f1, f2) * respond to interrupts */ void -onintr(signo) - int signo; +onintr(int signo) { if (command == 'i' && runshell) longjmp(reset, 1); diff --git a/sbin/restore/main.c b/sbin/restore/main.c index 2980b11..6682ee3 100644 --- a/sbin/restore/main.c +++ b/sbin/restore/main.c @@ -76,13 +76,11 @@ time_t dumptime; time_t dumpdate; FILE *terminal; -static void obsolete __P((int *, char **[])); -static void usage __P((void)); +static void obsolete(int *, char **[]); +static void usage(void) __dead2; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; ino_t ino; @@ -308,9 +306,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 61cd432..614fa01 100644 --- a/sbin/restore/restore.c +++ b/sbin/restore/restore.c @@ -49,17 +49,14 @@ static const char rcsid[] = #include "restore.h" #include "extern.h" -static char *keyval __P((int)); +static char *keyval(int); /* * This implements the 't' option. * 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; @@ -502,8 +490,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]; @@ -524,7 +511,7 @@ keyval(key) * Find unreferenced link names. */ void -findunreflinks() +findunreflinks(void) { struct entry *ep, *np; ino_t i; @@ -572,7 +559,7 @@ findunreflinks() * time O(N). */ void -removeoldnodes() +removeoldnodes(void) { struct entry *ep, **prev; long change; @@ -601,8 +588,7 @@ removeoldnodes() * Extract new leaves. */ void -createleaves(symtabfile) - char *symtabfile; +createleaves(char *symtabfile) { struct entry *ep; ino_t first; @@ -681,7 +667,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; @@ -777,7 +763,7 @@ createfiles() * Add links. */ void -createlinks() +createlinks(void) { struct entry *np, *ep; ino_t i; @@ -817,7 +803,7 @@ createlinks() * that no temporary names remain. */ void -checkrestore() +checkrestore(void) { struct entry *ep; ino_t i; @@ -839,10 +825,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 ee7b1f7..3dd55f8 100644 --- a/sbin/restore/symtab.c +++ b/sbin/restore/symtab.c @@ -74,16 +74,15 @@ static const char rcsid[] = static struct entry **entry; static long entrytblsize; -static void addino __P((ino_t, struct entry *)); -static struct entry *lookupparent __P((char *)); -static void removeentry __P((struct entry *)); +static void addino(ino_t, struct entry *); +static struct entry *lookupparent(char *); +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; @@ -99,9 +98,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; @@ -121,8 +118,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; @@ -145,8 +141,7 @@ deleteino(inum) * Look up an entry by name */ struct entry * -lookupname(name) - char *name; +lookupname(char *name) { struct entry *ep; char *np, *cp; @@ -175,8 +170,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; @@ -198,8 +192,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]; @@ -226,10 +219,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; @@ -277,8 +267,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; @@ -321,9 +310,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; @@ -351,8 +338,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; @@ -397,8 +383,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; @@ -425,8 +410,7 @@ savename(name) * appropriate free list. */ void -freename(name) - char *name; +freename(char *name) { struct strhdr *tp, *np; @@ -453,9 +437,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; @@ -541,8 +523,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 982a4e1..7b6f62c 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -91,23 +91,23 @@ static int Qcvt; /* Swap quads (for sun) */ #define FLUSHTAPEBUF() blkcnt = ntrec + 1 -static void accthdr __P((struct s_spcl *)); -static int checksum __P((int *)); -static void findinode __P((struct s_spcl *)); -static void findtapeblksize __P((void)); -static int gethead __P((struct s_spcl *)); -static void readtape __P((char *)); -static void setdumpnum __P((void)); -static u_long swabl __P((u_long)); -static u_char *swablong __P((u_char *, int)); -static u_char *swabshort __P((u_char *, int)); -static void terminateinput __P((void)); -static void xtrfile __P((char *, long)); -static void xtrlnkfile __P((char *, long)); -static void xtrlnkskip __P((char *, long)); -static void xtrmap __P((char *, long)); -static void xtrmapskip __P((char *, long)); -static void xtrskip __P((char *, long)); +static void accthdr(struct s_spcl *); +static int checksum(int *); +static void findinode(struct s_spcl *); +static void findtapeblksize(void); +static int gethead(struct s_spcl *); +static void readtape(char *); +static void setdumpnum(void); +static u_long swabl(u_long); +static u_char *swablong(u_char *, int); +static u_char *swabshort(u_char *, int); +static void terminateinput(void); +static void xtrfile(char *, long); +static void xtrlnkfile(char *, long); +static void xtrlnkskip(char *, long); +static void xtrmap(char *, long); +static void xtrmapskip(char *, long); +static void xtrskip(char *, long); static int readmapflag; @@ -115,8 +115,7 @@ static int readmapflag; * Set up an input source */ void -setinput(source) - char *source; +setinput(char *source) { FLUSHTAPEBUF(); if (bflag) @@ -161,10 +160,9 @@ setinput(source) } void -newtapebuf(size) - long size; +newtapebuf(long size) { - static tapebufsize = -1; + static int tapebufsize = -1; ntrec = size; if (size <= tapebufsize) @@ -184,7 +182,7 @@ newtapebuf(size) * that it actually is a dump tape. */ void -setup() +setup(void) { int i, j, *ip; struct stat stbuf; @@ -296,8 +294,7 @@ setup() * the user when only extracting a subset of the files. */ void -getvol(nextvol) - long nextvol; +getvol(long nextvol) { long newvol, prevtapea, savecnt, i; union u_spcl tmpspcl; @@ -469,7 +466,7 @@ gethdr: * Handle unexpected EOF. */ static void -terminateinput() +terminateinput(void) { if (gettingfile && curfile.action == USING) { @@ -491,7 +488,7 @@ terminateinput() * appropriate one. */ static void -setdumpnum() +setdumpnum(void) { struct mtop tcom; @@ -513,7 +510,7 @@ setdumpnum() } void -printdumpinfo() +printdumpinfo(void) { time_t t; t = _time32_to_time(spcl.c_date); @@ -529,8 +526,7 @@ printdumpinfo() } int -extractfile(name) - char *name; +extractfile(char *name) { int flags; mode_t mode; @@ -652,7 +648,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) @@ -663,7 +659,7 @@ skipmaps() * skip over a file on the tape */ void -skipfile() +skipfile(void) { curfile.action = SKIP; @@ -677,9 +673,7 @@ skipfile() * to the skip function. */ void -getfile(fill, skip) - void (*fill) __P((char *, long)); - void (*skip) __P((char *, long)); +getfile(void (*fill)(char *, long), void (*skip)(char *, long)) { int i; int curblk = 0; @@ -738,9 +732,7 @@ loop: * Write out the next block of a file. */ static void -xtrfile(buf, size) - char *buf; - long size; +xtrfile(char *buf, long size) { if (Nflag) @@ -757,9 +749,7 @@ xtrfile(buf, size) */ /* ARGSUSED */ static void -xtrskip(buf, size) - char *buf; - long size; +xtrskip(char *buf, long size) { if (lseek(ofile, size, SEEK_CUR) == -1) { @@ -774,9 +764,7 @@ xtrskip(buf, size) * Collect the next block of a symbolic link. */ static void -xtrlnkfile(buf, size) - char *buf; - long size; +xtrlnkfile(char *buf, long size) { pathlen += size; @@ -793,9 +781,7 @@ xtrlnkfile(buf, size) */ /* ARGSUSED */ static void -xtrlnkskip(buf, size) - char *buf; - long size; +xtrlnkskip(char *buf, long size) { fprintf(stderr, "unallocated block in symbolic link %s\n", @@ -807,9 +793,7 @@ xtrlnkskip(buf, size) * Collect the next block of a bit map. */ static void -xtrmap(buf, size) - char *buf; - long size; +xtrmap(char *buf, long size) { memmove(map, buf, size); @@ -821,9 +805,7 @@ xtrmap(buf, size) */ /* ARGSUSED */ static void -xtrmapskip(buf, size) - char *buf; - long size; +xtrmapskip(char *buf, long size) { panic("hole in map\n"); @@ -835,9 +817,7 @@ xtrmapskip(buf, size) */ /* ARGSUSED */ void -xtrnull(buf, size) - char *buf; - long size; +xtrnull(char *buf, long size) { return; @@ -848,8 +828,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; @@ -967,7 +946,7 @@ getmore: } static void -findtapeblksize() +findtapeblksize(void) { long i; @@ -996,7 +975,7 @@ findtapeblksize() } void -closemt() +closemt(void) { if (mt < 0) @@ -1016,8 +995,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 { @@ -1165,8 +1143,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; @@ -1223,8 +1200,7 @@ newcalc: * Complain if had to skip. */ static void -findinode(header) - struct s_spcl *header; +findinode(struct s_spcl *header) { static long skipcnt = 0; long i; @@ -1296,8 +1272,7 @@ findinode(header) } static int -checksum(buf) - int *buf; +checksum(int *buf) { int i, j; @@ -1324,36 +1299,20 @@ checksum(buf) } #ifdef RRESTORE -#if __STDC__ #include <stdarg.h> -#else -#include <varargs.h> -#endif void -#if __STDC__ msg(const char *fmt, ...) -#else -msg(fmt, va_alist) - char *fmt; - va_dcl -#endif { va_list ap; -#if __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif (void)vfprintf(stderr, fmt, ap); va_end(ap); } #endif /* RRESTORE */ static u_char * -swabshort(sp, n) - u_char *sp; - int n; +swabshort(u_char *sp, int n) { char c; @@ -1365,9 +1324,7 @@ swabshort(sp, n) } static u_char * -swablong(sp, n) - u_char *sp; - int n; +swablong(u_char *sp, int n) { char c; @@ -1380,8 +1337,7 @@ swablong(sp, n) } void -swabst(cp, sp) - u_char *cp, *sp; +swabst(u_char *cp, u_char *sp) { int n = 0; @@ -1416,8 +1372,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 837213d..3901ad3 100644 --- a/sbin/restore/utilities.c +++ b/sbin/restore/utilities.c @@ -58,8 +58,7 @@ static const char rcsid[] = * 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) { fprintf(stderr, "warning: cannot rename %s to %s: %s\n", @@ -141,8 +137,7 @@ renameit(from, to) * Create a new node (directory). */ void -newnode(np) - struct entry *np; +newnode(struct entry *np) { char *cp; @@ -161,8 +156,7 @@ newnode(np) * Remove an old node (directory). */ void -removenode(ep) - struct entry *ep; +removenode(struct entry *ep) { char *cp; @@ -184,8 +178,7 @@ removenode(ep) * Remove a leaf. */ void -removeleaf(ep) - struct entry *ep; +removeleaf(struct entry *ep) { char *cp; @@ -205,9 +198,7 @@ removeleaf(ep) * Create a link. */ int -linkit(existing, new, type) - char *existing, *new; - int type; +linkit(char *existing, char *new, int type) { /* if we want to unlink first, do it now so *link() won't fail */ @@ -256,8 +247,7 @@ linkit(existing, new, type) * Create a whiteout. */ int -addwhiteout(name) - char *name; +addwhiteout(char *name) { if (!Nflag && mknod(name, S_IFWHT, 0) < 0) { @@ -273,8 +263,7 @@ addwhiteout(name) * Delete a whiteout. */ void -delwhiteout(ep) - struct entry *ep; +delwhiteout(struct entry *ep) { char *name; @@ -295,8 +284,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; @@ -314,8 +302,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; @@ -333,9 +320,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); @@ -360,8 +345,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]; @@ -386,8 +370,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; @@ -403,8 +386,7 @@ dirlookup(name) * Elicit a reply. */ int -reply(question) - char *question; +reply(char *question) { int c; @@ -424,28 +406,13 @@ reply(question) /* * handle unexpected inconsistencies */ -#if __STDC__ #include <stdarg.h> -#else -#include <varargs.h> -#endif void -#if __STDC__ panic(const char *fmt, ...) -#else -panic(fmt, va_alist) - char *fmt; - va_dcl -#endif { va_list ap; -#if __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif - vfprintf(stderr, fmt, ap); if (yflag) return; |