o remove __P

o Use ANSI function definitions
o unifdef -D__STDC__
This commit is contained in:
Warner Losh 2002-03-20 22:49:40 +00:00
parent 97ec1da11a
commit 2db673ab00
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92837
16 changed files with 376 additions and 694 deletions

View File

@ -90,58 +90,54 @@ long dev_bsize; /* block size of underlying disk device */
int dev_bshift; /* log2(dev_bsize) */ int dev_bshift; /* log2(dev_bsize) */
int tp_bshift; /* log2(TP_BSIZE) */ int tp_bshift; /* log2(TP_BSIZE) */
#ifndef __P
#include <sys/cdefs.h>
#endif
/* operator interface functions */ /* operator interface functions */
void broadcast __P((char *message)); void broadcast(const char *message);
void infosch __P((int)); void infosch(int);
void lastdump __P((int arg)); /* int should be char */ void lastdump(int arg); /* int should be char */
void msg __P((const char *fmt, ...)) __printflike(1, 2); void msg(const char *fmt, ...) __printflike(1, 2);
void msgtail __P((const char *fmt, ...)) __printflike(1, 2); void msgtail(const char *fmt, ...) __printflike(1, 2);
int query __P((char *question)); int query(const char *question);
void quit __P((const char *fmt, ...)) __printflike(1, 2); void quit(const char *fmt, ...) __printflike(1, 2);
void timeest __P((void)); void timeest(void);
time_t unctime __P((char *str)); time_t unctime(char *str);
/* mapping rouintes */ /* mapping rouintes */
struct dinode; struct dinode;
long blockest __P((struct dinode *dp)); long blockest(struct dinode *dp);
int mapfiles __P((ino_t maxino, long *tapesize)); int mapfiles(ino_t maxino, long *tapesize);
int mapdirs __P((ino_t maxino, long *tapesize)); int mapdirs(ino_t maxino, long *tapesize);
/* file dumping routines */ /* file dumping routines */
void blksout __P((daddr_t *blkp, int frags, ino_t ino)); void blksout(daddr_t *blkp, int frags, ino_t ino);
void bread __P((daddr_t blkno, char *buf, int size)); void bread(daddr_t blkno, char *buf, int size);
void dumpino __P((struct dinode *dp, ino_t ino)); void dumpino(struct dinode *dp, ino_t ino);
void dumpmap __P((char *map, int type, ino_t ino)); void dumpmap(char *map, int type, ino_t ino);
void writeheader __P((ino_t ino)); void writeheader(ino_t ino);
/* tape writing routines */ /* tape writing routines */
int alloctape __P((void)); int alloctape(void);
void close_rewind __P((void)); void close_rewind(void);
void dumpblock __P((daddr_t blkno, int size)); void dumpblock(daddr_t blkno, int size);
void startnewtape __P((int top)); void startnewtape(int top);
void trewind __P((void)); void trewind(void);
void writerec __P((char *dp, int isspcl)); void writerec(char *dp, int isspcl);
void Exit __P((int status)) __dead2; void Exit(int status) __dead2;
void dumpabort __P((int signo)); void dumpabort(int signo);
void getfstab __P((void)); void getfstab(void);
char *rawname __P((char *cp)); char *rawname(char *cp);
struct dinode *getino __P((ino_t inum)); struct dinode *getino(ino_t inum);
/* rdump routines */ /* rdump routines */
#ifdef RDUMP #ifdef RDUMP
void rmtclose __P((void)); void rmtclose(void);
int rmthost __P((char *host)); int rmthost(const char *host);
int rmtopen __P((char *tape, int mode)); int rmtopen(const char *tape, int mode);
int rmtwrite __P((char *buf, int count)); int rmtwrite(const char *buf, int count);
#endif /* RDUMP */ #endif /* RDUMP */
void interrupt __P((int signo)); /* in case operator bangs on console */ void interrupt(int signo); /* in case operator bangs on console */
/* /*
* Exit status codes * Exit status codes
@ -153,7 +149,7 @@ void interrupt __P((int signo)); /* in case operator bangs on console */
#define OPGRENT "operator" /* group entry to notify */ #define OPGRENT "operator" /* group entry to notify */
struct fstab *fstabsearch __P((char *key)); /* search fs_file and fs_spec */ struct fstab *fstabsearch(const char *key); /* search fs_file and fs_spec */
#ifndef NAME_MAX #ifndef NAME_MAX
#define NAME_MAX 255 #define NAME_MAX 255
@ -171,25 +167,13 @@ struct dumpdates {
int nddates; /* number of records (might be zero) */ int nddates; /* number of records (might be zero) */
int ddates_in; /* we have read the increment file */ int ddates_in; /* we have read the increment file */
struct dumpdates **ddatev; /* the arrayfied version */ struct dumpdates **ddatev; /* the arrayfied version */
void initdumptimes __P((void)); void initdumptimes(void);
void getdumptime __P((void)); void getdumptime(void);
void putdumptime __P((void)); void putdumptime(void);
#define ITITERATE(i, ddp) \ #define ITITERATE(i, ddp) \
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i]) for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
void sig __P((int signo)); void sig(int signo);
/*
* Compatibility with old systems.
*/
#ifdef COMPAT
#include <sys/file.h>
#define strchr(a,b) index(a,b)
#define strrchr(a,b) rindex(a,b)
extern char *strdup(), *ctime();
extern int read(), write();
extern int errno;
#endif
#ifndef _PATH_UTMP #ifndef _PATH_UTMP
#define _PATH_UTMP "/etc/utmp" #define _PATH_UTMP "/etc/utmp"

View File

@ -57,12 +57,10 @@ static const char rcsid[] =
#include <netdb.h> #include <netdb.h>
#include <pwd.h> #include <pwd.h>
#include <stdio.h> #include <stdio.h>
#ifdef __STDC__
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#endif
#include "pathnames.h" #include "pathnames.h"
#include "dump.h" #include "dump.h"
@ -74,15 +72,15 @@ static int rmtstate = TS_CLOSED;
static int rmtape; static int rmtape;
static char *rmtpeer; static char *rmtpeer;
static int okname __P((char *)); static int okname(const char *);
static int rmtcall __P((char *, char *)); static int rmtcall(const char *, const char *);
static void rmtconnaborted __P((/* int, int */)); static void rmtconnaborted(int);
static int rmtgetb __P((void)); static int rmtgetb(void);
static void rmtgetconn __P((void)); static void rmtgetconn(void);
static void rmtgets __P((char *, int)); static void rmtgets(char *, int);
static int rmtreply __P((char *)); static int rmtreply(const char *);
#ifdef KERBEROS #ifdef KERBEROS
int krcmd __P((char **, int /*u_short*/, char *, char *, int *, char *)); int krcmd(char **, int /*u_short*/, char *, char *, int *, char *);
#endif #endif
static int errfd = -1; static int errfd = -1;
@ -90,15 +88,12 @@ extern int dokerberos;
extern int ntrec; /* blocking factor on tape */ extern int ntrec; /* blocking factor on tape */
int int
rmthost(host) rmthost(const char *host)
char *host;
{ {
rmtpeer = malloc(strlen(host) + 1); rmtpeer = strdup(host);
if (rmtpeer) if (rmtpeer == NULL)
strcpy(rmtpeer, host); return (0);
else
rmtpeer = host;
signal(SIGPIPE, rmtconnaborted); signal(SIGPIPE, rmtconnaborted);
rmtgetconn(); rmtgetconn();
if (rmtape < 0) if (rmtape < 0)
@ -107,7 +102,7 @@ rmthost(host)
} }
static void static void
rmtconnaborted() rmtconnaborted(int sig __unused)
{ {
msg("Lost connection to remote host.\n"); msg("Lost connection to remote host.\n");
if (errfd != -1) { if (errfd != -1) {
@ -134,7 +129,7 @@ rmtconnaborted()
} }
void void
rmtgetconn() rmtgetconn(void)
{ {
char *cp; char *cp;
const char *rmt; const char *rmt;
@ -201,10 +196,9 @@ rmtgetconn()
} }
static int static int
okname(cp0) okname(const char *cp0)
char *cp0;
{ {
char *cp; const char *cp;
int c; int c;
for (cp = cp0; *cp; cp++) { for (cp = cp0; *cp; cp++) {
@ -218,9 +212,7 @@ okname(cp0)
} }
int int
rmtopen(tape, mode) rmtopen(const char *tape, int mode)
char *tape;
int mode;
{ {
char buf[256]; char buf[256];
@ -230,7 +222,7 @@ rmtopen(tape, mode)
} }
void void
rmtclose() rmtclose(void)
{ {
if (rmtstate != TS_OPEN) if (rmtstate != TS_OPEN)
@ -240,9 +232,7 @@ rmtclose()
} }
int int
rmtread(buf, count) rmtread(char *buf, int count)
char *buf;
int count;
{ {
char line[30]; char line[30];
int n, i, cc; int n, i, cc;
@ -255,15 +245,13 @@ rmtread(buf, count)
for (i = 0; i < n; i += cc) { for (i = 0; i < n; i += cc) {
cc = read(rmtape, buf+i, n - i); cc = read(rmtape, buf+i, n - i);
if (cc <= 0) if (cc <= 0)
rmtconnaborted(); rmtconnaborted(0);
} }
return (n); return (n);
} }
int int
rmtwrite(buf, count) rmtwrite(const char *buf, int count)
char *buf;
int count;
{ {
char line[30]; char line[30];
@ -274,8 +262,7 @@ rmtwrite(buf, count)
} }
void void
rmtwrite0(count) rmtwrite0(int count)
int count;
{ {
char line[30]; char line[30];
@ -284,24 +271,21 @@ rmtwrite0(count)
} }
void void
rmtwrite1(buf, count) rmtwrite1(const char *buf, int count)
char *buf;
int count;
{ {
write(rmtape, buf, count); write(rmtape, buf, count);
} }
int int
rmtwrite2() rmtwrite2(void)
{ {
return (rmtreply("write")); return (rmtreply("write"));
} }
int int
rmtseek(offset, pos) rmtseek(int offset, int pos) /* XXX off_t ? */
int offset, pos;
{ {
char line[80]; char line[80];
@ -312,7 +296,7 @@ rmtseek(offset, pos)
struct mtget mts; struct mtget mts;
struct mtget * struct mtget *
rmtstatus() rmtstatus(void)
{ {
int i; int i;
char *cp; char *cp;
@ -326,8 +310,7 @@ rmtstatus()
} }
int int
rmtioctl(cmd, count) rmtioctl(int cmd, int count)
int cmd, count;
{ {
char buf[256]; char buf[256];
@ -338,18 +321,16 @@ rmtioctl(cmd, count)
} }
static int static int
rmtcall(cmd, buf) rmtcall(const char *cmd, const char *buf)
char *cmd, *buf;
{ {
if (write(rmtape, buf, strlen(buf)) != strlen(buf)) if (write(rmtape, buf, strlen(buf)) != strlen(buf))
rmtconnaborted(); rmtconnaborted(0);
return (rmtreply(cmd)); return (rmtreply(cmd));
} }
static int static int
rmtreply(cmd) rmtreply(const char *cmd)
char *cmd;
{ {
char *cp; char *cp;
char code[30], emsg[BUFSIZ]; char code[30], emsg[BUFSIZ];
@ -371,26 +352,24 @@ rmtreply(cmd)
msg("Protocol to remote tape server botched (code \"%s\").\n", msg("Protocol to remote tape server botched (code \"%s\").\n",
code); code);
rmtconnaborted(); rmtconnaborted(0);
} }
return (atoi(code + 1)); return (atoi(code + 1));
} }
int int
rmtgetb() rmtgetb(void)
{ {
char c; char c;
if (read(rmtape, &c, 1) != 1) if (read(rmtape, &c, 1) != 1)
rmtconnaborted(); rmtconnaborted(0);
return (c); return (c);
} }
/* Get a line (guaranteed to have a trailing newline). */ /* Get a line (guaranteed to have a trailing newline). */
void void
rmtgets(line, len) rmtgets(char *line, int len)
char *line;
int len;
{ {
char *cp = line; char *cp = line;
@ -406,5 +385,5 @@ rmtgets(line, len)
*cp = '\0'; *cp = '\0';
msg("Protocol to remote tape server botched.\n"); msg("Protocol to remote tape server botched.\n");
msg("(rmtgets got \"%s\").\n", line); msg("(rmtgets got \"%s\").\n", line);
rmtconnaborted(); rmtconnaborted(0);
} }

View File

@ -50,10 +50,8 @@ static const char rcsid[] =
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#ifdef __STDC__
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#endif
#include "dump.h" #include "dump.h"
@ -66,13 +64,13 @@ struct dumpdates **ddatev = 0;
int nddates = 0; int nddates = 0;
int ddates_in = 0; int ddates_in = 0;
static void dumprecout __P((FILE *, struct dumpdates *)); static void dumprecout(FILE *, const struct dumpdates *);
static int getrecord __P((FILE *, struct dumpdates *)); static int getrecord(FILE *, struct dumpdates *);
static int makedumpdate __P((struct dumpdates *, char *)); static int makedumpdate(struct dumpdates *, const char *);
static void readdumptimes __P((FILE *)); static void readdumptimes(FILE *);
void void
initdumptimes() initdumptimes(void)
{ {
FILE *df; FILE *df;
@ -104,8 +102,7 @@ initdumptimes()
} }
static void static void
readdumptimes(df) readdumptimes(FILE *df)
FILE *df;
{ {
int i; int i;
struct dumptime *dtwalk; struct dumptime *dtwalk;
@ -131,7 +128,7 @@ readdumptimes(df)
} }
void void
getdumptime() getdumptime(void)
{ {
struct dumpdates *ddp; struct dumpdates *ddp;
int i; int i;
@ -163,7 +160,7 @@ getdumptime()
} }
void void
putdumptime() putdumptime(void)
{ {
FILE *df; FILE *df;
struct dumpdates *dtwalk; struct dumpdates *dtwalk;
@ -225,24 +222,18 @@ putdumptime()
} }
static void static void
dumprecout(file, what) dumprecout(FILE *file, const struct dumpdates *what)
FILE *file;
struct dumpdates *what;
{ {
if (fprintf(file, DUMPOUTFMT, if (fprintf(file, DUMPOUTFMT, what->dd_name,
what->dd_name, what->dd_level, ctime(&what->dd_ddate)) < 0)
what->dd_level,
ctime(&what->dd_ddate)) < 0)
quit("%s: %s\n", dumpdates, strerror(errno)); quit("%s: %s\n", dumpdates, strerror(errno));
} }
int recno; int recno;
static int static int
getrecord(df, ddatep) getrecord(FILE *df, struct dumpdates *ddatep)
FILE *df;
struct dumpdates *ddatep;
{ {
char tbuf[BUFSIZ]; char tbuf[BUFSIZ];
@ -262,9 +253,7 @@ getrecord(df, ddatep)
} }
static int static int
makedumpdate(ddp, tbuf) makedumpdate(struct dumpdates *ddp, const char *tbuf)
struct dumpdates *ddp;
char *tbuf;
{ {
char un_buf[128]; char un_buf[128];

View File

@ -82,14 +82,12 @@ long dev_bsize = 1; /* recalculated below */
long blocksperfile; /* output blocks per file */ long blocksperfile; /* output blocks per file */
char *host = NULL; /* remote host (if any) */ char *host = NULL; /* remote host (if any) */
static long numarg __P((char *, long, long)); static long numarg(const char *, long, long);
static void obsolete __P((int *, char **[])); static void obsolete(int *, char **[]);
static void usage __P((void)); static void usage(void) __dead2;
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
struct stat sb; struct stat sb;
ino_t ino; ino_t ino;
@ -513,7 +511,7 @@ main(argc, argv)
} }
static void static void
usage() usage(void)
{ {
fprintf(stderr, fprintf(stderr,
"usage: dump [-0123456789ac" "usage: dump [-0123456789ac"
@ -532,9 +530,7 @@ usage()
* range (except that a vmax of 0 means unlimited). * range (except that a vmax of 0 means unlimited).
*/ */
static long static long
numarg(meaning, vmin, vmax) numarg(const char *meaning, long vmin, long vmax)
char *meaning;
long vmin, vmax;
{ {
char *p; char *p;
long val; long val;
@ -548,8 +544,7 @@ numarg(meaning, vmin, vmax)
} }
void void
sig(signo) sig(int signo)
int signo;
{ {
switch(signo) { switch(signo) {
case SIGALRM: case SIGALRM:
@ -575,8 +570,7 @@ sig(signo)
} }
char * char *
rawname(cp) rawname(char *cp)
char *cp;
{ {
static char rawbuf[MAXPATHLEN]; static char rawbuf[MAXPATHLEN];
char *dp; char *dp;
@ -596,11 +590,10 @@ rawname(cp)
if (dp == NULL) if (dp == NULL)
return (NULL); return (NULL);
*dp = '\0'; *dp = '\0';
(void)strncpy(rawbuf, cp, MAXPATHLEN - 1); (void)strlcpy(rawbuf, cp, MAXPATHLEN - 1);
rawbuf[MAXPATHLEN-1] = '\0';
*dp = '/'; *dp = '/';
(void)strncat(rawbuf, "/r", MAXPATHLEN - 1 - strlen(rawbuf)); (void)strlcat(rawbuf, "/r", MAXPATHLEN - 1 - strlen(rawbuf));
(void)strncat(rawbuf, dp + 1, MAXPATHLEN - 1 - strlen(rawbuf)); (void)strlcat(rawbuf, dp + 1, MAXPATHLEN - 1 - strlen(rawbuf));
return (rawbuf); return (rawbuf);
} }
@ -610,9 +603,7 @@ rawname(cp)
* getopt(3) will like. * getopt(3) will like.
*/ */
static void static void
obsolete(argcp, argvp) obsolete(int *argcp, char **argvp[])
int *argcp;
char **argvp[];
{ {
int argc, flags; int argc, flags;
char *ap, **argv, *flagsp, **nargv, *p; char *ap, **argv, *flagsp, **nargv, *p;

View File

@ -58,8 +58,8 @@ static const char rcsid[] =
#include "dump.h" #include "dump.h"
#include "pathnames.h" #include "pathnames.h"
void alarmcatch __P((/* int, int */)); void alarmcatch(int);
int datesort __P((const void *, const void *)); int datesort(const void *, const void *);
/* /*
* Query the operator; This previously-fascist piece of code * Query the operator; This previously-fascist piece of code
@ -73,11 +73,10 @@ int datesort __P((const void *, const void *));
* that dump needs attention. * that dump needs attention.
*/ */
static int timeout; static int timeout;
static char *attnmessage; /* attention message */ static const char *attnmessage; /* attention message */
int int
query(question) query(const char *question)
char *question;
{ {
char replybuffer[64]; char replybuffer[64];
int back, errcount; int back, errcount;
@ -87,7 +86,7 @@ query(question)
quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno)); quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno));
attnmessage = question; attnmessage = question;
timeout = 0; timeout = 0;
alarmcatch(); alarmcatch(0);
back = -1; back = -1;
errcount = 0; errcount = 0;
do { do {
@ -124,7 +123,7 @@ char lastmsg[BUFSIZ];
* sleep for 2 minutes in case nobody comes to satisfy dump * sleep for 2 minutes in case nobody comes to satisfy dump
*/ */
void void
alarmcatch() alarmcatch(int sig __unused)
{ {
if (notify == 0) { if (notify == 0) {
if (timeout == 0) if (timeout == 0)
@ -150,8 +149,7 @@ alarmcatch()
* Here if an inquisitive operator interrupts the dump program * Here if an inquisitive operator interrupts the dump program
*/ */
void void
interrupt(signo) interrupt(int signo __unused)
int signo;
{ {
msg("Interrupt received.\n"); msg("Interrupt received.\n");
if (query("Do you want to abort dump?")) if (query("Do you want to abort dump?"))
@ -162,8 +160,7 @@ interrupt(signo)
* We now use wall(1) to do the actual broadcasting. * We now use wall(1) to do the actual broadcasting.
*/ */
void void
broadcast(message) broadcast(const char *message)
char *message;
{ {
FILE *fp; FILE *fp;
char buf[sizeof(_PATH_WALL) + sizeof(OPGRENT) + 3]; char buf[sizeof(_PATH_WALL) + sizeof(OPGRENT) + 3];
@ -191,7 +188,7 @@ broadcast(message)
time_t tschedule = 0; time_t tschedule = 0;
void void
timeest() timeest(void)
{ {
double percent; double percent;
time_t tnow; time_t tnow;
@ -219,20 +216,13 @@ timeest()
* Schedule a printout of the estimate in the next call to timeest(). * Schedule a printout of the estimate in the next call to timeest().
*/ */
void void
infosch(signal) infosch(int signal __unused)
int signal;
{ {
tschedule = 0; tschedule = 0;
} }
void void
#if __STDC__
msg(const char *fmt, ...) msg(const char *fmt, ...)
#else
msg(fmt, va_alist)
char *fmt;
va_dcl
#endif
{ {
va_list ap; va_list ap;
@ -240,11 +230,7 @@ msg(fmt, va_alist)
#ifdef TDEBUG #ifdef TDEBUG
(void) fprintf(stderr, "pid=%d ", getpid()); (void) fprintf(stderr, "pid=%d ", getpid());
#endif #endif
#if __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else
va_start(ap);
#endif
(void) vfprintf(stderr, fmt, ap); (void) vfprintf(stderr, fmt, ap);
(void) fflush(stdout); (void) fflush(stdout);
(void) fflush(stderr); (void) fflush(stderr);
@ -253,32 +239,16 @@ msg(fmt, va_alist)
} }
void void
#if __STDC__
msgtail(const char *fmt, ...) msgtail(const char *fmt, ...)
#else
msgtail(fmt, va_alist)
char *fmt;
va_dcl
#endif
{ {
va_list ap; va_list ap;
#if __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else
va_start(ap);
#endif
(void) vfprintf(stderr, fmt, ap); (void) vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
} }
void void
#if __STDC__
quit(const char *fmt, ...) quit(const char *fmt, ...)
#else
quit(fmt, va_alist)
char *fmt;
va_dcl
#endif
{ {
va_list ap; va_list ap;
@ -286,11 +256,7 @@ quit(fmt, va_alist)
#ifdef TDEBUG #ifdef TDEBUG
(void) fprintf(stderr, "pid=%d ", getpid()); (void) fprintf(stderr, "pid=%d ", getpid());
#endif #endif
#if __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else
va_start(ap);
#endif
(void) vfprintf(stderr, fmt, ap); (void) vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
(void) fflush(stdout); (void) fflush(stdout);
@ -304,8 +270,7 @@ quit(fmt, va_alist)
*/ */
struct fstab * struct fstab *
allocfsent(fs) allocfsent(const struct fstab *fs)
struct fstab *fs;
{ {
struct fstab *new; struct fstab *new;
@ -328,7 +293,7 @@ struct pfstab {
static SLIST_HEAD(, pfstab) table; static SLIST_HEAD(, pfstab) table;
void void
getfstab() getfstab(void)
{ {
struct fstab *fs; struct fstab *fs;
struct pfstab *pf; struct pfstab *pf;
@ -359,8 +324,7 @@ getfstab()
* The file name can omit the leading '/'. * The file name can omit the leading '/'.
*/ */
struct fstab * struct fstab *
fstabsearch(key) fstabsearch(const char *key)
char *key;
{ {
struct pfstab *pf; struct pfstab *pf;
struct fstab *fs; struct fstab *fs;
@ -390,8 +354,7 @@ fstabsearch(key)
* Tell the operator what to do * Tell the operator what to do
*/ */
void void
lastdump(arg) lastdump(int arg) /* w ==> just what to do; W ==> most recent dumps */
char arg; /* w ==> just what to do; W ==> most recent dumps */
{ {
int i; int i;
struct fstab *dt; struct fstab *dt;
@ -438,8 +401,7 @@ lastdump(arg)
} }
int int
datesort(a1, a2) datesort(const void *a1, const void *a2)
const void *a1, *a2;
{ {
struct dumpdates *d1 = *(struct dumpdates **)a1; struct dumpdates *d1 = *(struct dumpdates **)a1;
struct dumpdates *d2 = *(struct dumpdates **)a2; struct dumpdates *d2 = *(struct dumpdates **)a2;

View File

@ -55,13 +55,9 @@ static const char rcsid[] =
#include <setjmp.h> #include <setjmp.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#ifdef __STDC__
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#else
int write(), read();
#endif
#include "dump.h" #include "dump.h"
@ -75,12 +71,12 @@ extern int cartridge;
extern char *host; extern char *host;
char *nexttape; char *nexttape;
static int atomic __P((ssize_t (*)(), int, char *, int)); static int atomic(ssize_t (*)(), int, char *, int);
static void doslave __P((int, int)); static void doslave(int, int);
static void enslave __P((void)); static void enslave(void);
static void flushtape __P((void)); static void flushtape(void);
static void killall __P((void)); static void killall(void);
static void rollforward __P((void)); static void rollforward(void);
/* /*
* Concurrent dump mods (Caltech) - disk block reading and tape writing * Concurrent dump mods (Caltech) - disk block reading and tape writing
@ -122,7 +118,7 @@ static jmp_buf jmpbuf; /* where to jump to if we are ready when the */
/* SIGUSR2 arrives from the previous slave */ /* SIGUSR2 arrives from the previous slave */
int int
alloctape() alloctape(void)
{ {
int pgoff = getpagesize() - 1; int pgoff = getpagesize() - 1;
char *buf; char *buf;
@ -162,18 +158,13 @@ alloctape()
} }
void void
writerec(dp, isspcl) writerec(char *dp, int isspcl)
char *dp;
int isspcl;
{ {
slp->req[trecno].dblk = (daddr_t)0; slp->req[trecno].dblk = (daddr_t)0;
slp->req[trecno].count = 1; slp->req[trecno].count = 1;
#ifndef __alpha__ /* Can't do a structure assignment due to alignment problems */
*(union u_spcl *)(*(nextblock)++) = *(union u_spcl *)dp;
#else
bcopy(dp, *(nextblock)++, sizeof (union u_spcl)); bcopy(dp, *(nextblock)++, sizeof (union u_spcl));
#endif
if (isspcl) if (isspcl)
lastspclrec = spcl.c_tapea; lastspclrec = spcl.c_tapea;
trecno++; trecno++;
@ -183,9 +174,7 @@ writerec(dp, isspcl)
} }
void void
dumpblock(blkno, size) dumpblock(daddr_t blkno, int size)
daddr_t blkno;
int size;
{ {
int avail, tpblks, dblkno; int avail, tpblks, dblkno;
@ -206,8 +195,7 @@ dumpblock(blkno, size)
int nogripe = 0; int nogripe = 0;
void void
tperror(signo) tperror(int signo __unused)
int signo;
{ {
if (pipeout) { if (pipeout) {
@ -228,15 +216,14 @@ tperror(signo)
} }
void void
sigpipe(signo) sigpipe(int signo __unused)
int signo;
{ {
quit("Broken pipe\n"); quit("Broken pipe\n");
} }
static void static void
flushtape() flushtape(void)
{ {
int i, blks, got; int i, blks, got;
long lastfirstrec; long lastfirstrec;
@ -313,7 +300,7 @@ flushtape()
} }
void void
trewind() trewind(void)
{ {
struct stat sb; struct stat sb;
int f; int f;
@ -394,7 +381,7 @@ close_rewind()
} }
void void
rollforward() rollforward(void)
{ {
struct req *p, *q, *prev; struct req *p, *q, *prev;
struct slave *tslp; struct slave *tslp;
@ -509,8 +496,7 @@ rollforward()
* everything continues as if nothing had happened. * everything continues as if nothing had happened.
*/ */
void void
startnewtape(top) startnewtape(int top)
int top;
{ {
int parentpid; int parentpid;
int childpid; int childpid;
@ -642,8 +628,7 @@ startnewtape(top)
} }
void void
dumpabort(signo) dumpabort(int signo __unused)
int signo;
{ {
if (master != 0 && master != getpid()) if (master != 0 && master != getpid())
@ -674,8 +659,7 @@ Exit(status)
* proceed - handler for SIGUSR2, used to synchronize IO between the slaves. * proceed - handler for SIGUSR2, used to synchronize IO between the slaves.
*/ */
void void
proceed(signo) proceed(int signo __unused)
int signo;
{ {
if (ready) if (ready)
@ -684,7 +668,7 @@ proceed(signo)
} }
void void
enslave() enslave(void)
{ {
int cmd[2]; int cmd[2];
int i, j; int i, j;
@ -728,7 +712,7 @@ enslave()
} }
void void
killall() killall(void)
{ {
int i; int i;
@ -747,9 +731,7 @@ killall()
* get the lock back for the next cycle by swapping descriptors. * get the lock back for the next cycle by swapping descriptors.
*/ */
static void static void
doslave(cmd, slave_number) doslave(int cmd, int slave_number)
int cmd;
int slave_number;
{ {
int nread; int nread;
int nextslave, size, wrote, eot_count; int nextslave, size, wrote, eot_count;
@ -863,11 +845,7 @@ doslave(cmd, slave_number)
* loop until the count is satisfied (or error). * loop until the count is satisfied (or error).
*/ */
static int static int
atomic(func, fd, buf, count) atomic(ssize_t (*func)(), int fd, char *buf, int count)
ssize_t (*func)();
int fd;
char *buf;
int count;
{ {
int got, need = count; int got, need = count;

View File

@ -50,11 +50,9 @@ static const char rcsid[] =
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#ifdef __STDC__
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#endif
#include "dump.h" #include "dump.h"
@ -67,11 +65,11 @@ typedef quad_t fsizeT;
typedef long fsizeT; typedef long fsizeT;
#endif #endif
static int dirindir __P((ino_t ino, daddr_t blkno, int level, long *size, static int dirindir(ino_t ino, daddr_t blkno, int level, long *size,
long *tapesize, int nodump)); long *tapesize, int nodump);
static void dmpindir __P((ino_t ino, daddr_t blk, int level, fsizeT *size)); static void dmpindir(ino_t ino, daddr_t blk, int level, fsizeT *size);
static int searchdir __P((ino_t ino, daddr_t blkno, long size, long filesize, static int searchdir(ino_t ino, daddr_t blkno, long size, long filesize,
long *tapesize, int nodump)); long *tapesize, int nodump);
/* /*
* This is an estimation of the number of TP_BSIZE blocks in the file. * This is an estimation of the number of TP_BSIZE blocks in the file.
@ -81,8 +79,7 @@ static int searchdir __P((ino_t ino, daddr_t blkno, long size, long filesize,
* hence the estimate may be high. * hence the estimate may be high.
*/ */
long long
blockest(dp) blockest(struct dinode *dp)
struct dinode *dp;
{ {
long blkest, sizeest; long blkest, sizeest;
@ -134,9 +131,7 @@ blockest(dp)
* the directories in the filesystem. * the directories in the filesystem.
*/ */
int int
mapfiles(maxino, tapesize) mapfiles(ino_t maxino, long *tapesize)
ino_t maxino;
long *tapesize;
{ {
int mode; int mode;
ino_t ino; ino_t ino;
@ -191,9 +186,7 @@ mapfiles(maxino, tapesize)
* pass using this algorithm. * pass using this algorithm.
*/ */
int int
mapdirs(maxino, tapesize) mapdirs(ino_t maxino, long *tapesize)
ino_t maxino;
long *tapesize;
{ {
struct dinode *dp; struct dinode *dp;
int i, isdir, nodump; int i, isdir, nodump;
@ -263,13 +256,8 @@ mapdirs(maxino, tapesize)
* require the directory to be dumped. * require the directory to be dumped.
*/ */
static int static int
dirindir(ino, blkno, ind_level, filesize, tapesize, nodump) dirindir(ino_t ino, daddr_t blkno, int ind_level, long *filesize,
ino_t ino; long *tapesize, int nodump)
daddr_t blkno;
int ind_level;
long *filesize;
long *tapesize;
int nodump;
{ {
int ret = 0; int ret = 0;
int i; int i;
@ -305,13 +293,8 @@ dirindir(ino, blkno, ind_level, filesize, tapesize, nodump)
* contains any subdirectories. * contains any subdirectories.
*/ */
static int static int
searchdir(ino, blkno, size, filesize, tapesize, nodump) searchdir(ino_t ino, daddr_t blkno, long size, long filesize,
ino_t ino; long *tapesize, int nodump)
daddr_t blkno;
long size;
long filesize;
long *tapesize;
int nodump;
{ {
struct direct *dp; struct direct *dp;
struct dinode *ip; struct dinode *ip;
@ -373,9 +356,7 @@ searchdir(ino, blkno, size, filesize, tapesize, nodump)
* Dump the contents of an inode to tape. * Dump the contents of an inode to tape.
*/ */
void void
dumpino(dp, ino) dumpino(struct dinode *dp, ino_t ino)
struct dinode *dp;
ino_t ino;
{ {
int ind_level, cnt; int ind_level, cnt;
fsizeT size; fsizeT size;
@ -450,11 +431,7 @@ dumpino(dp, ino)
* Read indirect blocks, and pass the data blocks to be dumped. * Read indirect blocks, and pass the data blocks to be dumped.
*/ */
static void static void
dmpindir(ino, blk, ind_level, size) dmpindir(ino_t ino, daddr_t blk, int ind_level, fsizeT *size)
ino_t ino;
daddr_t blk;
int ind_level;
fsizeT *size;
{ {
int i, cnt; int i, cnt;
daddr_t idblk[MAXNINDIR]; daddr_t idblk[MAXNINDIR];
@ -484,10 +461,7 @@ dmpindir(ino, blk, ind_level, size)
* Collect up the data into tape record sized buffers and output them. * Collect up the data into tape record sized buffers and output them.
*/ */
void void
blksout(blkp, frags, ino) blksout(daddr_t *blkp, int frags, ino_t ino)
daddr_t *blkp;
int frags;
ino_t ino;
{ {
daddr_t *bp; daddr_t *bp;
int i, j, count, blks, tbperdb; int i, j, count, blks, tbperdb;
@ -522,10 +496,7 @@ blksout(blkp, frags, ino)
* Dump a map to the tape. * Dump a map to the tape.
*/ */
void void
dumpmap(map, type, ino) dumpmap(char *map, int type, ino_t ino)
char *map;
int type;
ino_t ino;
{ {
int i; int i;
char *cp; char *cp;
@ -541,8 +512,7 @@ dumpmap(map, type, ino)
* Write a header record to the dump tape. * Write a header record to the dump tape.
*/ */
void void
writeheader(ino) writeheader(ino_t ino)
ino_t ino;
{ {
int32_t sum, cnt, *lp; int32_t sum, cnt, *lp;
@ -563,8 +533,7 @@ writeheader(ino)
} }
struct dinode * struct dinode *
getino(inum) getino(ino_t inum)
ino_t inum;
{ {
static daddr_t minino, maxino; static daddr_t minino, maxino;
static struct dinode inoblock[MAXINOPB]; static struct dinode inoblock[MAXINOPB];
@ -589,10 +558,7 @@ int breaderrors = 0;
#define BREADEMAX 32 #define BREADEMAX 32
void void
bread(blkno, buf, size) bread(daddr_t blkno, char *buf, int size)
daddr_t blkno;
char *buf;
int size;
{ {
int cnt, i; int cnt, i;

View File

@ -47,11 +47,8 @@ static const char rcsid[] =
* *
* Return -1 if the string is not in ctime format. * Return -1 if the string is not in ctime format.
*/ */
time_t time_t
unctime(str) unctime(char *str)
char *str;
{ {
struct tm then; struct tm then;

View File

@ -120,16 +120,16 @@ struct odirect {
char d_name[ODIRSIZ]; char d_name[ODIRSIZ];
}; };
static struct inotab *allocinotab __P((ino_t, struct dinode *, long)); static struct inotab *allocinotab(ino_t, struct dinode *, long);
static void dcvt __P((struct odirect *, struct direct *)); static void dcvt(struct odirect *, struct direct *);
static void flushent __P((void)); static void flushent(void);
static struct inotab *inotablookup __P((ino_t)); static struct inotab *inotablookup(ino_t);
static RST_DIR *opendirfile __P((const char *)); static RST_DIR *opendirfile(const char *);
static void putdir __P((char *, long)); static void putdir(char *, long);
static void putent __P((struct direct *)); static void putent(struct direct *);
static void rst_seekdir __P((RST_DIR *, long, long)); static void rst_seekdir(RST_DIR *, long, long);
static long rst_telldir __P((RST_DIR *)); static long rst_telldir(RST_DIR *);
static struct direct *searchdir __P((ino_t, char *)); static struct direct *searchdir(ino_t, char *);
/* /*
* Extract directory contents, building up a directory structure * Extract directory contents, building up a directory structure
@ -138,8 +138,7 @@ static struct direct *searchdir __P((ino_t, char *));
* directories on the tape. * directories on the tape.
*/ */
void void
extractdirs(genmode) extractdirs(int genmode)
int genmode;
{ {
int i; int i;
struct dinode *ip; struct dinode *ip;
@ -211,7 +210,7 @@ extractdirs(genmode)
* skip over all the directories on the tape * skip over all the directories on the tape
*/ */
void void
skipdirs() skipdirs(void)
{ {
while (curfile.dip && (curfile.dip->di_mode & IFMT) == IFDIR) { while (curfile.dip && (curfile.dip->di_mode & IFMT) == IFDIR) {
@ -224,10 +223,7 @@ skipdirs()
* pname and pass them off to be processed. * pname and pass them off to be processed.
*/ */
void void
treescan(pname, ino, todo) treescan(char *pname, ino_t ino, long (*todo)(char *, ino_t, int))
char *pname;
ino_t ino;
long (*todo) __P((char *, ino_t, int));
{ {
struct inotab *itp; struct inotab *itp;
struct direct *dp; struct direct *dp;
@ -291,8 +287,7 @@ treescan(pname, ino, todo)
* Lookup a pathname which is always assumed to start from the ROOTINO. * Lookup a pathname which is always assumed to start from the ROOTINO.
*/ */
struct direct * struct direct *
pathsearch(pathname) pathsearch(const char *pathname)
const char *pathname;
{ {
ino_t ino; ino_t ino;
struct direct *dp; struct direct *dp;
@ -317,9 +312,7 @@ pathsearch(pathname)
* Return its inode number if found, zero if it does not exist. * Return its inode number if found, zero if it does not exist.
*/ */
static struct direct * static struct direct *
searchdir(inum, name) searchdir(ino_t inum, char *name)
ino_t inum;
char *name;
{ {
struct direct *dp; struct direct *dp;
struct inotab *itp; struct inotab *itp;
@ -342,9 +335,7 @@ searchdir(inum, name)
* Put the directory entries in the directory file * Put the directory entries in the directory file
*/ */
static void static void
putdir(buf, size) putdir(char *buf, long size)
char *buf;
long size;
{ {
struct direct cvtbuf; struct direct cvtbuf;
struct odirect *odp; struct odirect *odp;
@ -414,8 +405,7 @@ long prev = 0;
* add a new directory entry to a file. * add a new directory entry to a file.
*/ */
static void static void
putent(dp) putent(struct direct *dp)
struct direct *dp;
{ {
dp->d_reclen = DIRSIZ(0, dp); dp->d_reclen = DIRSIZ(0, dp);
if (dirloc + dp->d_reclen > DIRBLKSIZ) { if (dirloc + dp->d_reclen > DIRBLKSIZ) {
@ -433,7 +423,7 @@ putent(dp)
* flush out a directory that is finished. * flush out a directory that is finished.
*/ */
static void static void
flushent() flushent(void)
{ {
((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev; ((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev;
(void) fwrite(dirbuf, (int)dirloc, 1, df); (void) fwrite(dirbuf, (int)dirloc, 1, df);
@ -442,9 +432,7 @@ flushent()
} }
static void static void
dcvt(odp, ndp) dcvt(struct odirect *odp, struct direct *ndp)
struct odirect *odp;
struct direct *ndp;
{ {
memset(ndp, 0, (long)(sizeof *ndp)); memset(ndp, 0, (long)(sizeof *ndp));
@ -463,9 +451,7 @@ dcvt(odp, ndp)
* the desired seek offset into it. * the desired seek offset into it.
*/ */
static void static void
rst_seekdir(dirp, loc, base) rst_seekdir(RST_DIR *dirp, long loc, long base)
RST_DIR *dirp;
long loc, base;
{ {
if (loc == rst_telldir(dirp)) if (loc == rst_telldir(dirp))
@ -483,8 +469,7 @@ rst_seekdir(dirp, loc, base)
* get next entry in a directory. * get next entry in a directory.
*/ */
struct direct * struct direct *
rst_readdir(dirp) rst_readdir(RST_DIR *dirp)
RST_DIR *dirp;
{ {
struct direct *dp; struct direct *dp;
@ -524,8 +509,7 @@ rst_readdir(dirp)
* Simulate the opening of a directory * Simulate the opening of a directory
*/ */
RST_DIR * RST_DIR *
rst_opendir(name) rst_opendir(const char *name)
const char *name;
{ {
struct inotab *itp; struct inotab *itp;
RST_DIR *dirp; RST_DIR *dirp;
@ -544,8 +528,7 @@ rst_opendir(name)
* In our case, there is nothing to do when closing a directory. * In our case, there is nothing to do when closing a directory.
*/ */
void void
rst_closedir(dirp) rst_closedir(RST_DIR *dirp)
RST_DIR *dirp;
{ {
(void)close(dirp->dd_fd); (void)close(dirp->dd_fd);
@ -557,8 +540,7 @@ rst_closedir(dirp)
* Simulate finding the current offset in the directory. * Simulate finding the current offset in the directory.
*/ */
static long static long
rst_telldir(dirp) rst_telldir(RST_DIR *dirp)
RST_DIR *dirp;
{ {
return ((long)lseek(dirp->dd_fd, return ((long)lseek(dirp->dd_fd,
(off_t)0, SEEK_CUR) - dirp->dd_size + dirp->dd_loc); (off_t)0, SEEK_CUR) - dirp->dd_size + dirp->dd_loc);
@ -568,8 +550,7 @@ rst_telldir(dirp)
* Open a directory file. * Open a directory file.
*/ */
static RST_DIR * static RST_DIR *
opendirfile(name) opendirfile(const char *name)
const char *name;
{ {
RST_DIR *dirp; RST_DIR *dirp;
int fd; int fd;
@ -589,8 +570,7 @@ opendirfile(name)
* Set the mode, owner, and times for all new or changed directories * Set the mode, owner, and times for all new or changed directories
*/ */
void void
setdirmodes(flags) setdirmodes(int flags)
int flags;
{ {
FILE *mf; FILE *mf;
struct modeinfo node; struct modeinfo node;
@ -654,9 +634,7 @@ setdirmodes(flags)
* Generate a literal copy of a directory. * Generate a literal copy of a directory.
*/ */
int int
genliteraldir(name, ino) genliteraldir(char *name, ino_t ino)
char *name;
ino_t ino;
{ {
struct inotab *itp; struct inotab *itp;
int ofile, dp, i, size; int ofile, dp, i, size;
@ -699,8 +677,7 @@ genliteraldir(name, ino)
* Determine the type of an inode * Determine the type of an inode
*/ */
int int
inodetype(ino) inodetype(ino_t ino)
ino_t ino;
{ {
struct inotab *itp; struct inotab *itp;
@ -715,10 +692,7 @@ inodetype(ino)
* If requested, save its pertinent mode, owner, and time info. * If requested, save its pertinent mode, owner, and time info.
*/ */
static struct inotab * static struct inotab *
allocinotab(ino, dip, seekpt) allocinotab(ino_t ino, struct dinode *dip, long seekpt)
ino_t ino;
struct dinode *dip;
long seekpt;
{ {
struct inotab *itp; struct inotab *itp;
struct modeinfo node; struct modeinfo node;
@ -749,8 +723,7 @@ allocinotab(ino, dip, seekpt)
* Look up an inode in the table of directories * Look up an inode in the table of directories
*/ */
static struct inotab * static struct inotab *
inotablookup(ino) inotablookup(ino_t ino)
ino_t ino;
{ {
struct inotab *itp; struct inotab *itp;
@ -764,8 +737,7 @@ inotablookup(ino)
* Clean up and exit * Clean up and exit
*/ */
void void
done(exitcode) done(int exitcode)
int exitcode;
{ {
closemt(); closemt();

View File

@ -34,78 +34,78 @@
* $FreeBSD$ * $FreeBSD$
*/ */
struct entry *addentry __P((char *, ino_t, int)); struct entry *addentry(char *, ino_t, int);
long addfile __P((char *, ino_t, int)); long addfile(char *, ino_t, int);
int addwhiteout __P((char *)); int addwhiteout(char *);
void badentry __P((struct entry *, char *)); void badentry(struct entry *, char *);
void canon __P((char *, char *, int)); void canon(char *, char *, int);
void checkrestore __P((void)); void checkrestore(void);
void closemt __P((void)); void closemt(void);
void createfiles __P((void)); void createfiles(void);
void createleaves __P((char *)); void createleaves(char *);
void createlinks __P((void)); void createlinks(void);
long deletefile __P((char *, ino_t, int)); long deletefile(char *, ino_t, int);
void deleteino __P((ino_t)); void deleteino(ino_t);
void delwhiteout __P((struct entry *)); void delwhiteout(struct entry *);
ino_t dirlookup __P((const char *)); ino_t dirlookup(const char *);
void done __P((int)) __dead2; void done(int) __dead2;
void dumpsymtable __P((char *, long)); void dumpsymtable(char *, long);
void extractdirs __P((int)); void extractdirs(int);
int extractfile __P((char *)); int extractfile(char *);
void findunreflinks __P((void)); void findunreflinks(void);
char *flagvalues __P((struct entry *)); char *flagvalues(struct entry *);
void freeentry __P((struct entry *)); void freeentry(struct entry *);
void freename __P((char *)); void freename(char *);
int genliteraldir __P((char *, ino_t)); int genliteraldir(char *, ino_t);
char *gentempname __P((struct entry *)); char *gentempname(struct entry *);
void getfile __P((void (*)(char *, long), void (*)(char *, long))); void getfile(void (*)(char *, long), void (*)(char *, long));
void getvol __P((long)); void getvol(long);
void initsymtable __P((char *)); void initsymtable(char *);
int inodetype __P((ino_t)); int inodetype(ino_t);
int linkit __P((char *, char *, int)); int linkit(char *, char *, int);
struct entry *lookupino __P((ino_t)); struct entry *lookupino(ino_t);
struct entry *lookupname __P((char *)); struct entry *lookupname(char *);
long listfile __P((char *, ino_t, int)); long listfile(char *, ino_t, int);
ino_t lowerbnd __P((ino_t)); ino_t lowerbnd(ino_t);
void mktempname __P((struct entry *)); void mktempname(struct entry *);
void moveentry __P((struct entry *, char *)); void moveentry(struct entry *, char *);
void msg __P((const char *, ...)) __printflike(1, 2); void msg(const char *, ...) __printflike(1, 2);
char *myname __P((struct entry *)); char *myname(struct entry *);
void newnode __P((struct entry *)); void newnode(struct entry *);
void newtapebuf __P((long)); void newtapebuf(long);
long nodeupdates __P((char *, ino_t, int)); long nodeupdates(char *, ino_t, int);
void onintr __P((int)); void onintr(int);
void panic __P((const char *, ...)) __printflike(1, 2); void panic(const char *, ...) __printflike(1, 2);
void pathcheck __P((char *)); void pathcheck(char *);
struct direct *pathsearch __P((const char *)); struct direct *pathsearch(const char *);
void printdumpinfo __P((void)); void printdumpinfo(void);
void removeleaf __P((struct entry *)); void removeleaf(struct entry *);
void removenode __P((struct entry *)); void removenode(struct entry *);
void removeoldleaves __P((void)); void removeoldleaves(void);
void removeoldnodes __P((void)); void removeoldnodes(void);
void renameit __P((char *, char *)); void renameit(char *, char *);
int reply __P((char *)); int reply(char *);
RST_DIR *rst_opendir __P((const char *)); RST_DIR *rst_opendir(const char *);
struct direct *rst_readdir __P((RST_DIR *)); struct direct *rst_readdir(RST_DIR *);
void rst_closedir __P((RST_DIR *dirp)); void rst_closedir(RST_DIR *dirp);
void runcmdshell __P((void)); void runcmdshell(void);
char *savename __P((char *)); char *savename(char *);
void setdirmodes __P((int)); void setdirmodes(int);
void setinput __P((char *)); void setinput(char *);
void setup __P((void)); void setup(void);
void skipdirs __P((void)); void skipdirs(void);
void skipfile __P((void)); void skipfile(void);
void skipmaps __P((void)); void skipmaps(void);
void swabst __P((u_char *, u_char *)); void swabst(u_char *, u_char *);
void treescan __P((char *, ino_t, long (*)(char *, ino_t, int))); void treescan(char *, ino_t, long (*)(char *, ino_t, int));
ino_t upperbnd __P((ino_t)); ino_t upperbnd(ino_t);
long verifyfile __P((char *, ino_t, int)); long verifyfile(char *, ino_t, int);
void xtrnull __P((char *, long)); void xtrnull(char *, long);
/* From ../dump/dumprmt.c */ /* From ../dump/dumprmt.c */
void rmtclose __P((void)); void rmtclose(void);
int rmthost __P((char *)); int rmthost(char *);
int rmtioctl __P((int, int)); int rmtioctl(int, int);
int rmtopen __P((char *, int)); int rmtopen(char *, int);
int rmtread __P((char *, int)); int rmtread(char *, int);
int rmtseek __P((int, int)); int rmtseek(int, int);

View File

@ -81,20 +81,20 @@ struct arglist {
char *cmd; /* the current command */ char *cmd; /* the current command */
}; };
static char *copynext __P((char *, char *)); static char *copynext(char *, char *);
static int fcmp __P((const void *, const void *)); static int fcmp(const void *, const void *);
static void formatf __P((struct afile *, int)); static void formatf(struct afile *, int);
static void getcmd __P((char *, char *, char *, int, struct arglist *)); static void getcmd(char *, char *, char *, int, struct arglist *);
struct dirent *glob_readdir __P((RST_DIR *dirp)); struct dirent *glob_readdir(RST_DIR *dirp);
static int glob_stat __P((const char *, struct stat *)); static int glob_stat(const char *, struct stat *);
static void mkentry __P((char *, struct direct *, struct afile *)); static void mkentry(char *, struct direct *, struct afile *);
static void printlist __P((char *, char *)); static void printlist(char *, char *);
/* /*
* Read and execute commands from the terminal. * Read and execute commands from the terminal.
*/ */
void void
runcmdshell() runcmdshell(void)
{ {
struct entry *np; struct entry *np;
ino_t ino; ino_t ino;
@ -302,10 +302,7 @@ runcmdshell()
* eliminate any embedded ".." components. * eliminate any embedded ".." components.
*/ */
static void static void
getcmd(curdir, cmd, name, size, ap) getcmd(char *curdir, char *cmd, char *name, int size, struct arglist *ap)
char *curdir, *cmd, *name;
struct arglist *ap;
int size;
{ {
char *cp; char *cp;
static char input[BUFSIZ]; static char input[BUFSIZ];
@ -390,8 +387,7 @@ getcmd(curdir, cmd, name, size, ap)
* Strip off the next token of the input. * Strip off the next token of the input.
*/ */
static char * static char *
copynext(input, output) copynext(char *input, char *output)
char *input, *output;
{ {
char *cp, *bp; char *cp, *bp;
char quote; char quote;
@ -440,9 +436,7 @@ copynext(input, output)
* remove any embedded "." and ".." components. * remove any embedded "." and ".." components.
*/ */
void void
canon(rawname, canonname, len) canon(char *rawname, char *canonname, int len)
char *rawname, *canonname;
int len;
{ {
char *cp, *np; char *cp, *np;
@ -496,9 +490,7 @@ canon(rawname, canonname, len)
* Do an "ls" style listing of a directory * Do an "ls" style listing of a directory
*/ */
static void static void
printlist(name, basename) printlist(char *name, char *basename)
char *name;
char *basename;
{ {
struct afile *fp, *list, *listp; struct afile *fp, *list, *listp;
struct direct *dp; struct direct *dp;
@ -580,10 +572,7 @@ printlist(name, basename)
* Read the contents of a directory. * Read the contents of a directory.
*/ */
static void static void
mkentry(name, dp, fp) mkentry(char *name, struct direct *dp, struct afile *fp)
char *name;
struct direct *dp;
struct afile *fp;
{ {
char *cp; char *cp;
struct entry *np; struct entry *np;
@ -643,9 +632,7 @@ mkentry(name, dp, fp)
* Print out a pretty listing of a directory * Print out a pretty listing of a directory
*/ */
static void static void
formatf(list, nentry) formatf(struct afile *list, int nentry)
struct afile *list;
int nentry;
{ {
struct afile *fp, *endlist; struct afile *fp, *endlist;
int width, bigino, haveprefix, havepostfix; int width, bigino, haveprefix, havepostfix;
@ -716,8 +703,7 @@ formatf(list, nentry)
#undef d_ino #undef d_ino
struct dirent * struct dirent *
glob_readdir(dirp) glob_readdir(RST_DIR *dirp)
RST_DIR *dirp;
{ {
struct direct *dp; struct direct *dp;
static struct dirent adirent; static struct dirent adirent;
@ -740,9 +726,7 @@ glob_readdir(dirp)
* Return st_mode information in response to stat or lstat calls * Return st_mode information in response to stat or lstat calls
*/ */
static int static int
glob_stat(name, stp) glob_stat(const char *name, struct stat *stp)
const char *name;
struct stat *stp;
{ {
struct direct *dp; struct direct *dp;
@ -761,8 +745,7 @@ glob_stat(name, stp)
* Comparison routine for qsort. * Comparison routine for qsort.
*/ */
static int static int
fcmp(f1, f2) fcmp(const void *f1, const void *f2)
const void *f1, *f2;
{ {
return (strcmp(((struct afile *)f1)->fname, return (strcmp(((struct afile *)f1)->fname,
((struct afile *)f2)->fname)); ((struct afile *)f2)->fname));
@ -772,8 +755,7 @@ fcmp(f1, f2)
* respond to interrupts * respond to interrupts
*/ */
void void
onintr(signo) onintr(int signo)
int signo;
{ {
if (command == 'i' && runshell) if (command == 'i' && runshell)
longjmp(reset, 1); longjmp(reset, 1);

View File

@ -76,13 +76,11 @@ time_t dumptime;
time_t dumpdate; time_t dumpdate;
FILE *terminal; FILE *terminal;
static void obsolete __P((int *, char **[])); static void obsolete(int *, char **[]);
static void usage __P((void)); static void usage(void) __dead2;
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int ch; int ch;
ino_t ino; ino_t ino;
@ -308,9 +306,7 @@ usage()
* getopt(3) will like. * getopt(3) will like.
*/ */
static void static void
obsolete(argcp, argvp) obsolete(int *argcp, char **argvp[])
int *argcp;
char **argvp[];
{ {
int argc, flags; int argc, flags;
char *ap, **argv, *flagsp, **nargv, *p; char *ap, **argv, *flagsp, **nargv, *p;

View File

@ -49,17 +49,14 @@ static const char rcsid[] =
#include "restore.h" #include "restore.h"
#include "extern.h" #include "extern.h"
static char *keyval __P((int)); static char *keyval(int);
/* /*
* This implements the 't' option. * This implements the 't' option.
* List entries on the tape. * List entries on the tape.
*/ */
long long
listfile(name, ino, type) listfile(char *name, ino_t ino, int type)
char *name;
ino_t ino;
int type;
{ {
long descend = hflag ? GOOD : FAIL; long descend = hflag ? GOOD : FAIL;
@ -75,10 +72,7 @@ listfile(name, ino, type)
* Request that new entries be extracted. * Request that new entries be extracted.
*/ */
long long
addfile(name, ino, type) addfile(char *name, ino_t ino, int type)
char *name;
ino_t ino;
int type;
{ {
struct entry *ep; struct entry *ep;
long descend = hflag ? GOOD : FAIL; long descend = hflag ? GOOD : FAIL;
@ -119,10 +113,7 @@ addfile(name, ino, type)
*/ */
/* ARGSUSED */ /* ARGSUSED */
long long
deletefile(name, ino, type) deletefile(char *name, ino_t ino, int type)
char *name;
ino_t ino;
int type;
{ {
long descend = hflag ? GOOD : FAIL; long descend = hflag ? GOOD : FAIL;
struct entry *ep; struct entry *ep;
@ -160,7 +151,7 @@ static struct entry *removelist;
* Remove directories from the lookup chains. * Remove directories from the lookup chains.
*/ */
void void
removeoldleaves() removeoldleaves(void)
{ {
struct entry *ep, *nextep; struct entry *ep, *nextep;
ino_t i, mydirino; ino_t i, mydirino;
@ -213,10 +204,7 @@ removeoldleaves()
* Renames are done at the same time. * Renames are done at the same time.
*/ */
long long
nodeupdates(name, ino, type) nodeupdates(char *name, ino_t ino, int type)
char *name;
ino_t ino;
int type;
{ {
struct entry *ep, *np, *ip; struct entry *ep, *np, *ip;
long descend = GOOD; long descend = GOOD;
@ -502,8 +490,7 @@ nodeupdates(name, ino, type)
* Calculate the active flags in a key. * Calculate the active flags in a key.
*/ */
static char * static char *
keyval(key) keyval(int key)
int key;
{ {
static char keybuf[32]; static char keybuf[32];
@ -524,7 +511,7 @@ keyval(key)
* Find unreferenced link names. * Find unreferenced link names.
*/ */
void void
findunreflinks() findunreflinks(void)
{ {
struct entry *ep, *np; struct entry *ep, *np;
ino_t i; ino_t i;
@ -572,7 +559,7 @@ findunreflinks()
* time O(N). * time O(N).
*/ */
void void
removeoldnodes() removeoldnodes(void)
{ {
struct entry *ep, **prev; struct entry *ep, **prev;
long change; long change;
@ -601,8 +588,7 @@ removeoldnodes()
* Extract new leaves. * Extract new leaves.
*/ */
void void
createleaves(symtabfile) createleaves(char *symtabfile)
char *symtabfile;
{ {
struct entry *ep; struct entry *ep;
ino_t first; ino_t first;
@ -681,7 +667,7 @@ createleaves(symtabfile)
* Efficiently extract a subset of the files on a tape. * Efficiently extract a subset of the files on a tape.
*/ */
void void
createfiles() createfiles(void)
{ {
ino_t first, next, last; ino_t first, next, last;
struct entry *ep; struct entry *ep;
@ -777,7 +763,7 @@ createfiles()
* Add links. * Add links.
*/ */
void void
createlinks() createlinks(void)
{ {
struct entry *np, *ep; struct entry *np, *ep;
ino_t i; ino_t i;
@ -817,7 +803,7 @@ createlinks()
* that no temporary names remain. * that no temporary names remain.
*/ */
void void
checkrestore() checkrestore(void)
{ {
struct entry *ep; struct entry *ep;
ino_t i; ino_t i;
@ -839,10 +825,7 @@ checkrestore()
* A paranoid check that things are as they should be. * A paranoid check that things are as they should be.
*/ */
long long
verifyfile(name, ino, type) verifyfile(char *name, ino_t ino, int type)
char *name;
ino_t ino;
int type;
{ {
struct entry *np, *ep; struct entry *np, *ep;
long descend = GOOD; long descend = GOOD;

View File

@ -74,16 +74,15 @@ static const char rcsid[] =
static struct entry **entry; static struct entry **entry;
static long entrytblsize; static long entrytblsize;
static void addino __P((ino_t, struct entry *)); static void addino(ino_t, struct entry *);
static struct entry *lookupparent __P((char *)); static struct entry *lookupparent(char *);
static void removeentry __P((struct entry *)); static void removeentry(struct entry *);
/* /*
* Look up an entry by inode number * Look up an entry by inode number
*/ */
struct entry * struct entry *
lookupino(inum) lookupino(ino_t inum)
ino_t inum;
{ {
struct entry *ep; struct entry *ep;
@ -99,9 +98,7 @@ lookupino(inum)
* Add an entry into the entry table * Add an entry into the entry table
*/ */
static void static void
addino(inum, np) addino(ino_t inum, struct entry *np)
ino_t inum;
struct entry *np;
{ {
struct entry **epp; struct entry **epp;
@ -121,8 +118,7 @@ addino(inum, np)
* Delete an entry from the entry table * Delete an entry from the entry table
*/ */
void void
deleteino(inum) deleteino(ino_t inum)
ino_t inum;
{ {
struct entry *next; struct entry *next;
struct entry **prev; struct entry **prev;
@ -145,8 +141,7 @@ deleteino(inum)
* Look up an entry by name * Look up an entry by name
*/ */
struct entry * struct entry *
lookupname(name) lookupname(char *name)
char *name;
{ {
struct entry *ep; struct entry *ep;
char *np, *cp; char *np, *cp;
@ -175,8 +170,7 @@ lookupname(name)
* Look up the parent of a pathname * Look up the parent of a pathname
*/ */
static struct entry * static struct entry *
lookupparent(name) lookupparent(char *name)
char *name;
{ {
struct entry *ep; struct entry *ep;
char *tailindex; char *tailindex;
@ -198,8 +192,7 @@ lookupparent(name)
* Determine the current pathname of a node or leaf * Determine the current pathname of a node or leaf
*/ */
char * char *
myname(ep) myname(struct entry *ep)
struct entry *ep;
{ {
char *cp; char *cp;
static char namebuf[MAXPATHLEN]; static char namebuf[MAXPATHLEN];
@ -226,10 +219,7 @@ static struct entry *freelist = NULL;
* add an entry to the symbol table * add an entry to the symbol table
*/ */
struct entry * struct entry *
addentry(name, inum, type) addentry(char *name, ino_t inum, int type)
char *name;
ino_t inum;
int type;
{ {
struct entry *np, *ep; struct entry *np, *ep;
@ -277,8 +267,7 @@ addentry(name, inum, type)
* delete an entry from the symbol table * delete an entry from the symbol table
*/ */
void void
freeentry(ep) freeentry(struct entry *ep)
struct entry *ep;
{ {
struct entry *np; struct entry *np;
ino_t inum; ino_t inum;
@ -321,9 +310,7 @@ freeentry(ep)
* Relocate an entry in the tree structure * Relocate an entry in the tree structure
*/ */
void void
moveentry(ep, newname) moveentry(struct entry *ep, char *newname)
struct entry *ep;
char *newname;
{ {
struct entry *np; struct entry *np;
char *cp; char *cp;
@ -351,8 +338,7 @@ moveentry(ep, newname)
* Remove an entry in the tree structure * Remove an entry in the tree structure
*/ */
static void static void
removeentry(ep) removeentry(struct entry *ep)
struct entry *ep;
{ {
struct entry *np; 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. * has an appropriate sized entry, and if not allocates a new one.
*/ */
char * char *
savename(name) savename(char *name)
char *name;
{ {
struct strhdr *np; struct strhdr *np;
long len; long len;
@ -425,8 +410,7 @@ savename(name)
* appropriate free list. * appropriate free list.
*/ */
void void
freename(name) freename(char *name)
char *name;
{ {
struct strhdr *tp, *np; struct strhdr *tp, *np;
@ -453,9 +437,7 @@ struct symtableheader {
* dump a snapshot of the symbol table * dump a snapshot of the symbol table
*/ */
void void
dumpsymtable(filename, checkpt) dumpsymtable(char *filename, long checkpt)
char *filename;
long checkpt;
{ {
struct entry *ep, *tep; struct entry *ep, *tep;
ino_t i; ino_t i;
@ -541,8 +523,7 @@ dumpsymtable(filename, checkpt)
* Initialize a symbol table from a file * Initialize a symbol table from a file
*/ */
void void
initsymtable(filename) initsymtable(char *filename)
char *filename;
{ {
char *base; char *base;
long tblsize; long tblsize;

View File

@ -91,23 +91,23 @@ static int Qcvt; /* Swap quads (for sun) */
#define FLUSHTAPEBUF() blkcnt = ntrec + 1 #define FLUSHTAPEBUF() blkcnt = ntrec + 1
static void accthdr __P((struct s_spcl *)); static void accthdr(struct s_spcl *);
static int checksum __P((int *)); static int checksum(int *);
static void findinode __P((struct s_spcl *)); static void findinode(struct s_spcl *);
static void findtapeblksize __P((void)); static void findtapeblksize(void);
static int gethead __P((struct s_spcl *)); static int gethead(struct s_spcl *);
static void readtape __P((char *)); static void readtape(char *);
static void setdumpnum __P((void)); static void setdumpnum(void);
static u_long swabl __P((u_long)); static u_long swabl(u_long);
static u_char *swablong __P((u_char *, int)); static u_char *swablong(u_char *, int);
static u_char *swabshort __P((u_char *, int)); static u_char *swabshort(u_char *, int);
static void terminateinput __P((void)); static void terminateinput(void);
static void xtrfile __P((char *, long)); static void xtrfile(char *, long);
static void xtrlnkfile __P((char *, long)); static void xtrlnkfile(char *, long);
static void xtrlnkskip __P((char *, long)); static void xtrlnkskip(char *, long);
static void xtrmap __P((char *, long)); static void xtrmap(char *, long);
static void xtrmapskip __P((char *, long)); static void xtrmapskip(char *, long);
static void xtrskip __P((char *, long)); static void xtrskip(char *, long);
static int readmapflag; static int readmapflag;
@ -115,8 +115,7 @@ static int readmapflag;
* Set up an input source * Set up an input source
*/ */
void void
setinput(source) setinput(char *source)
char *source;
{ {
FLUSHTAPEBUF(); FLUSHTAPEBUF();
if (bflag) if (bflag)
@ -161,10 +160,9 @@ setinput(source)
} }
void void
newtapebuf(size) newtapebuf(long size)
long size;
{ {
static tapebufsize = -1; static int tapebufsize = -1;
ntrec = size; ntrec = size;
if (size <= tapebufsize) if (size <= tapebufsize)
@ -184,7 +182,7 @@ newtapebuf(size)
* that it actually is a dump tape. * that it actually is a dump tape.
*/ */
void void
setup() setup(void)
{ {
int i, j, *ip; int i, j, *ip;
struct stat stbuf; struct stat stbuf;
@ -296,8 +294,7 @@ setup()
* the user when only extracting a subset of the files. * the user when only extracting a subset of the files.
*/ */
void void
getvol(nextvol) getvol(long nextvol)
long nextvol;
{ {
long newvol, prevtapea, savecnt, i; long newvol, prevtapea, savecnt, i;
union u_spcl tmpspcl; union u_spcl tmpspcl;
@ -469,7 +466,7 @@ getvol(nextvol)
* Handle unexpected EOF. * Handle unexpected EOF.
*/ */
static void static void
terminateinput() terminateinput(void)
{ {
if (gettingfile && curfile.action == USING) { if (gettingfile && curfile.action == USING) {
@ -491,7 +488,7 @@ terminateinput()
* appropriate one. * appropriate one.
*/ */
static void static void
setdumpnum() setdumpnum(void)
{ {
struct mtop tcom; struct mtop tcom;
@ -513,7 +510,7 @@ setdumpnum()
} }
void void
printdumpinfo() printdumpinfo(void)
{ {
time_t t; time_t t;
t = _time32_to_time(spcl.c_date); t = _time32_to_time(spcl.c_date);
@ -529,8 +526,7 @@ printdumpinfo()
} }
int int
extractfile(name) extractfile(char *name)
char *name;
{ {
int flags; int flags;
mode_t mode; mode_t mode;
@ -652,7 +648,7 @@ extractfile(name)
* skip over bit maps on the tape * skip over bit maps on the tape
*/ */
void void
skipmaps() skipmaps(void)
{ {
while (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI) while (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI)
@ -663,7 +659,7 @@ skipmaps()
* skip over a file on the tape * skip over a file on the tape
*/ */
void void
skipfile() skipfile(void)
{ {
curfile.action = SKIP; curfile.action = SKIP;
@ -677,9 +673,7 @@ skipfile()
* to the skip function. * to the skip function.
*/ */
void void
getfile(fill, skip) getfile(void (*fill)(char *, long), void (*skip)(char *, long))
void (*fill) __P((char *, long));
void (*skip) __P((char *, long));
{ {
int i; int i;
int curblk = 0; int curblk = 0;
@ -738,9 +732,7 @@ getfile(fill, skip)
* Write out the next block of a file. * Write out the next block of a file.
*/ */
static void static void
xtrfile(buf, size) xtrfile(char *buf, long size)
char *buf;
long size;
{ {
if (Nflag) if (Nflag)
@ -757,9 +749,7 @@ xtrfile(buf, size)
*/ */
/* ARGSUSED */ /* ARGSUSED */
static void static void
xtrskip(buf, size) xtrskip(char *buf, long size)
char *buf;
long size;
{ {
if (lseek(ofile, size, SEEK_CUR) == -1) { if (lseek(ofile, size, SEEK_CUR) == -1) {
@ -774,9 +764,7 @@ xtrskip(buf, size)
* Collect the next block of a symbolic link. * Collect the next block of a symbolic link.
*/ */
static void static void
xtrlnkfile(buf, size) xtrlnkfile(char *buf, long size)
char *buf;
long size;
{ {
pathlen += size; pathlen += size;
@ -793,9 +781,7 @@ xtrlnkfile(buf, size)
*/ */
/* ARGSUSED */ /* ARGSUSED */
static void static void
xtrlnkskip(buf, size) xtrlnkskip(char *buf, long size)
char *buf;
long size;
{ {
fprintf(stderr, "unallocated block in symbolic link %s\n", fprintf(stderr, "unallocated block in symbolic link %s\n",
@ -807,9 +793,7 @@ xtrlnkskip(buf, size)
* Collect the next block of a bit map. * Collect the next block of a bit map.
*/ */
static void static void
xtrmap(buf, size) xtrmap(char *buf, long size)
char *buf;
long size;
{ {
memmove(map, buf, size); memmove(map, buf, size);
@ -821,9 +805,7 @@ xtrmap(buf, size)
*/ */
/* ARGSUSED */ /* ARGSUSED */
static void static void
xtrmapskip(buf, size) xtrmapskip(char *buf, long size)
char *buf;
long size;
{ {
panic("hole in map\n"); panic("hole in map\n");
@ -835,9 +817,7 @@ xtrmapskip(buf, size)
*/ */
/* ARGSUSED */ /* ARGSUSED */
void void
xtrnull(buf, size) xtrnull(char *buf, long size)
char *buf;
long size;
{ {
return; return;
@ -848,8 +828,7 @@ xtrnull(buf, size)
* Handle read errors, and end of media. * Handle read errors, and end of media.
*/ */
static void static void
readtape(buf) readtape(char *buf)
char *buf;
{ {
long rd, newvol, i; long rd, newvol, i;
int cnt, seek_failed; int cnt, seek_failed;
@ -967,7 +946,7 @@ readtape(buf)
} }
static void static void
findtapeblksize() findtapeblksize(void)
{ {
long i; long i;
@ -996,7 +975,7 @@ findtapeblksize()
} }
void void
closemt() closemt(void)
{ {
if (mt < 0) if (mt < 0)
@ -1016,8 +995,7 @@ closemt()
* If it is not any valid header, return an error. * If it is not any valid header, return an error.
*/ */
static int static int
gethead(buf) gethead(struct s_spcl *buf)
struct s_spcl *buf;
{ {
long i; long i;
union { union {
@ -1165,8 +1143,7 @@ gethead(buf)
* Check that a header is where it belongs and predict the next header * Check that a header is where it belongs and predict the next header
*/ */
static void static void
accthdr(header) accthdr(struct s_spcl *header)
struct s_spcl *header;
{ {
static ino_t previno = 0x7fffffff; static ino_t previno = 0x7fffffff;
static int prevtype; static int prevtype;
@ -1223,8 +1200,7 @@ accthdr(header)
* Complain if had to skip. * Complain if had to skip.
*/ */
static void static void
findinode(header) findinode(struct s_spcl *header)
struct s_spcl *header;
{ {
static long skipcnt = 0; static long skipcnt = 0;
long i; long i;
@ -1296,8 +1272,7 @@ findinode(header)
} }
static int static int
checksum(buf) checksum(int *buf)
int *buf;
{ {
int i, j; int i, j;
@ -1324,36 +1299,20 @@ checksum(buf)
} }
#ifdef RRESTORE #ifdef RRESTORE
#if __STDC__
#include <stdarg.h> #include <stdarg.h>
#else
#include <varargs.h>
#endif
void void
#if __STDC__
msg(const char *fmt, ...) msg(const char *fmt, ...)
#else
msg(fmt, va_alist)
char *fmt;
va_dcl
#endif
{ {
va_list ap; va_list ap;
#if __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else
va_start(ap);
#endif
(void)vfprintf(stderr, fmt, ap); (void)vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
} }
#endif /* RRESTORE */ #endif /* RRESTORE */
static u_char * static u_char *
swabshort(sp, n) swabshort(u_char *sp, int n)
u_char *sp;
int n;
{ {
char c; char c;
@ -1365,9 +1324,7 @@ swabshort(sp, n)
} }
static u_char * static u_char *
swablong(sp, n) swablong(u_char *sp, int n)
u_char *sp;
int n;
{ {
char c; char c;
@ -1380,8 +1337,7 @@ swablong(sp, n)
} }
void void
swabst(cp, sp) swabst(u_char *cp, u_char *sp)
u_char *cp, *sp;
{ {
int n = 0; int n = 0;
@ -1416,8 +1372,7 @@ swabst(cp, sp)
} }
static u_long static u_long
swabl(x) swabl(u_long x)
u_long x;
{ {
swabst((u_char *)"l", (u_char *)&x); swabst((u_char *)"l", (u_char *)&x);
return (x); return (x);

View File

@ -58,8 +58,7 @@ static const char rcsid[] =
* Insure that all the components of a pathname exist. * Insure that all the components of a pathname exist.
*/ */
void void
pathcheck(name) pathcheck(char *name)
char *name;
{ {
char *cp; char *cp;
struct entry *ep; struct entry *ep;
@ -87,8 +86,7 @@ pathcheck(name)
* Change a name to a unique temporary name. * Change a name to a unique temporary name.
*/ */
void void
mktempname(ep) mktempname(struct entry *ep)
struct entry *ep;
{ {
char oldname[MAXPATHLEN]; char oldname[MAXPATHLEN];
@ -106,8 +104,7 @@ mktempname(ep)
* Generate a temporary name for an entry. * Generate a temporary name for an entry.
*/ */
char * char *
gentempname(ep) gentempname(struct entry *ep)
struct entry *ep;
{ {
static char name[MAXPATHLEN]; static char name[MAXPATHLEN];
struct entry *np; struct entry *np;
@ -126,8 +123,7 @@ gentempname(ep)
* Rename a file or directory. * Rename a file or directory.
*/ */
void void
renameit(from, to) renameit(char *from, char *to)
char *from, *to;
{ {
if (!Nflag && rename(from, to) < 0) { if (!Nflag && rename(from, to) < 0) {
fprintf(stderr, "warning: cannot rename %s to %s: %s\n", fprintf(stderr, "warning: cannot rename %s to %s: %s\n",
@ -141,8 +137,7 @@ renameit(from, to)
* Create a new node (directory). * Create a new node (directory).
*/ */
void void
newnode(np) newnode(struct entry *np)
struct entry *np;
{ {
char *cp; char *cp;
@ -161,8 +156,7 @@ newnode(np)
* Remove an old node (directory). * Remove an old node (directory).
*/ */
void void
removenode(ep) removenode(struct entry *ep)
struct entry *ep;
{ {
char *cp; char *cp;
@ -184,8 +178,7 @@ removenode(ep)
* Remove a leaf. * Remove a leaf.
*/ */
void void
removeleaf(ep) removeleaf(struct entry *ep)
struct entry *ep;
{ {
char *cp; char *cp;
@ -205,9 +198,7 @@ removeleaf(ep)
* Create a link. * Create a link.
*/ */
int int
linkit(existing, new, type) linkit(char *existing, char *new, int type)
char *existing, *new;
int type;
{ {
/* if we want to unlink first, do it now so *link() won't fail */ /* 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. * Create a whiteout.
*/ */
int int
addwhiteout(name) addwhiteout(char *name)
char *name;
{ {
if (!Nflag && mknod(name, S_IFWHT, 0) < 0) { if (!Nflag && mknod(name, S_IFWHT, 0) < 0) {
@ -273,8 +263,7 @@ addwhiteout(name)
* Delete a whiteout. * Delete a whiteout.
*/ */
void void
delwhiteout(ep) delwhiteout(struct entry *ep)
struct entry *ep;
{ {
char *name; char *name;
@ -295,8 +284,7 @@ delwhiteout(ep)
* find lowest number file (above "start") that needs to be extracted * find lowest number file (above "start") that needs to be extracted
*/ */
ino_t ino_t
lowerbnd(start) lowerbnd(ino_t start)
ino_t start;
{ {
struct entry *ep; struct entry *ep;
@ -314,8 +302,7 @@ lowerbnd(start)
* find highest number file (below "start") that needs to be extracted * find highest number file (below "start") that needs to be extracted
*/ */
ino_t ino_t
upperbnd(start) upperbnd(ino_t start)
ino_t start;
{ {
struct entry *ep; struct entry *ep;
@ -333,9 +320,7 @@ upperbnd(start)
* report on a badly formed entry * report on a badly formed entry
*/ */
void void
badentry(ep, msg) badentry(struct entry *ep, char *msg)
struct entry *ep;
char *msg;
{ {
fprintf(stderr, "bad entry: %s\n", 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. * Construct a string indicating the active flag bits of an entry.
*/ */
char * char *
flagvalues(ep) flagvalues(struct entry *ep)
struct entry *ep;
{ {
static char flagbuf[BUFSIZ]; static char flagbuf[BUFSIZ];
@ -386,8 +370,7 @@ flagvalues(ep)
* Check to see if a name is on a dump tape. * Check to see if a name is on a dump tape.
*/ */
ino_t ino_t
dirlookup(name) dirlookup(const char *name)
const char *name;
{ {
struct direct *dp; struct direct *dp;
ino_t ino; ino_t ino;
@ -403,8 +386,7 @@ dirlookup(name)
* Elicit a reply. * Elicit a reply.
*/ */
int int
reply(question) reply(char *question)
char *question;
{ {
int c; int c;
@ -424,28 +406,13 @@ reply(question)
/* /*
* handle unexpected inconsistencies * handle unexpected inconsistencies
*/ */
#if __STDC__
#include <stdarg.h> #include <stdarg.h>
#else
#include <varargs.h>
#endif
void void
#if __STDC__
panic(const char *fmt, ...) panic(const char *fmt, ...)
#else
panic(fmt, va_alist)
char *fmt;
va_dcl
#endif
{ {
va_list ap; va_list ap;
#if __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else
va_start(ap);
#endif
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
if (yflag) if (yflag)
return; return;