diff options
Diffstat (limited to 'sbin/restore/tape.c')
-rw-r--r-- | sbin/restore/tape.c | 139 |
1 files changed, 47 insertions, 92 deletions
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); |