Kill __P(), use ANSI function declarations.

This commit is contained in:
xtraeme 2005-02-17 15:00:33 +00:00
parent 6b5872e584
commit f224c38b66
8 changed files with 236 additions and 363 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dirs.c,v 1.42 2005/01/08 14:30:39 fredb Exp $ */
/* $NetBSD: dirs.c,v 1.43 2005/02/17 15:00:33 xtraeme Exp $ */
/*
* Copyright (c) 1983, 1993
@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)dirs.c 8.7 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: dirs.c,v 1.42 2005/01/08 14:30:39 fredb Exp $");
__RCSID("$NetBSD: dirs.c,v 1.43 2005/02/17 15:00:33 xtraeme Exp $");
#endif
#endif /* not lint */
@ -123,16 +123,16 @@ struct odirect {
char d_name[ODIRSIZ];
};
static struct inotab *allocinotab __P((FILE *, struct context *, 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(FILE *, struct context *, 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
@ -141,8 +141,7 @@ static struct direct *searchdir __P((ino_t, char *));
* directories on the tape.
*/
void
extractdirs(genmode)
int genmode;
extractdirs(int genmode)
{
FILE *mf;
int i, dfd, mfd;
@ -214,7 +213,7 @@ extractdirs(genmode)
* skip over all the directories on the tape
*/
void
skipdirs()
skipdirs(void)
{
while (curfile.ino && (curfile.mode & IFMT) == IFDIR) {
@ -227,10 +226,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;
@ -293,8 +289,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;
@ -319,9 +314,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;
@ -344,9 +337,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;
@ -420,8 +411,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, 0);
if (dirloc + dp->d_reclen > DIRBLKSIZ) {
@ -439,7 +429,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);
@ -448,9 +438,7 @@ flushent()
}
static void
dcvt(odp, ndp)
struct odirect *odp;
struct direct *ndp;
dcvt(struct odirect *odp, struct direct *ndp)
{
memset(ndp, 0, (size_t)(sizeof *ndp));
@ -472,9 +460,7 @@ dcvt(odp, ndp)
* the desired seek offset into it.
*/
static void
rst_seekdir(rdirp, loc, base)
RST_DIR *rdirp;
long loc, base;
rst_seekdir(RST_DIR *rdirp, long loc, long base)
{
if (loc == rst_telldir(rdirp))
@ -493,8 +479,7 @@ rst_seekdir(rdirp, loc, base)
* get next entry in a directory.
*/
struct direct *
rst_readdir(rdirp)
RST_DIR *rdirp;
rst_readdir(RST_DIR *rdirp)
{
struct direct *dp;
@ -534,8 +519,7 @@ rst_readdir(rdirp)
* Simulate the opening of a directory
*/
RST_DIR *
rst_opendir(name)
const char *name;
rst_opendir(const char *name)
{
struct inotab *itp;
RST_DIR *rdirp;
@ -554,8 +538,7 @@ rst_opendir(name)
* In our case, there is nothing to do when closing a directory.
*/
void
rst_closedir(rdirp)
RST_DIR *rdirp;
rst_closedir(RST_DIR *rdirp)
{
(void)close(rdirp->dd_fd);
@ -567,8 +550,7 @@ rst_closedir(rdirp)
* Simulate finding the current offset in the directory.
*/
static long
rst_telldir(rdirp)
RST_DIR *rdirp;
rst_telldir(RST_DIR *rdirp)
{
return ((long)lseek(rdirp->dd_fd,
(off_t)0, SEEK_CUR) - rdirp->dd_size + rdirp->dd_loc);
@ -578,8 +560,7 @@ rst_telldir(rdirp)
* Open a directory file.
*/
static RST_DIR *
opendirfile(name)
const char *name;
opendirfile(const char *name)
{
RST_DIR *rdirp;
int fd;
@ -599,8 +580,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;
@ -667,9 +647,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;
@ -712,8 +690,7 @@ genliteraldir(name, ino)
* Determine the type of an inode
*/
int
inodetype(ino)
ino_t ino;
inodetype(ino_t ino)
{
struct inotab *itp;
@ -728,10 +705,7 @@ inodetype(ino)
* If requested, save its pertinent mode, owner, and time info.
*/
static struct inotab *
allocinotab(mf, ctxp, aseekpt)
FILE *mf;
struct context *ctxp;
long aseekpt;
allocinotab(FILE *mf, struct context *ctxp, long aseekpt)
{
struct inotab *itp;
struct modeinfo node;
@ -766,8 +740,7 @@ allocinotab(mf, ctxp, aseekpt)
* Look up an inode in the table of directories
*/
static struct inotab *
inotablookup(ino)
ino_t ino;
inotablookup(ino_t ino)
{
struct inotab *itp;
@ -781,7 +754,7 @@ inotablookup(ino)
* Clean up and exit
*/
void
cleanup()
cleanup(void)
{
closemt();

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.11 2004/10/22 22:38:38 bouyer Exp $ */
/* $NetBSD: extern.h,v 1.12 2005/02/17 15:00:33 xtraeme Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -31,84 +31,84 @@
* @(#)extern.h 8.2 (Berkeley) 1/7/94
*/
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 *));
void checkrestore __P((void));
void cleanup __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 *));
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 *);
void checkrestore(void);
void cleanup(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 *);
const struct digest_desc *
digest_lookup __P((const char *));
ino_t dirlookup __P((const char *));
void dumpsymtable __P((char *, int32_t));
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((int));
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 *, ...))
digest_lookup(const char *);
ino_t dirlookup(const char *);
void dumpsymtable(char *, int32_t);
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(int);
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 *, ...)
__attribute__((__format__(__printf__,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 *, ...))
char *myname(struct entry *);
void newnode(struct entry *);
void newtapebuf(long);
long nodeupdates(char *, ino_t, int);
void onintr(int);
void panic(const char *, ...)
__attribute__((__format__(__printf__,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 *));
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 writemtree __P((const char *, const char *, const uid_t,
const gid_t, const mode_t, const u_long));
void xtrnull __P((char *, long));
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 *);
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 writemtree(const char *, const char *, const uid_t,
const gid_t, const mode_t, const u_long);
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: interactive.c,v 1.20 2005/01/08 14:30:39 fredb Exp $ */
/* $NetBSD: interactive.c,v 1.21 2005/02/17 15:00:33 xtraeme Exp $ */
/*
* Copyright (c) 1985, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)interactive.c 8.5 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: interactive.c,v 1.20 2005/01/08 14:30:39 fredb Exp $");
__RCSID("$NetBSD: interactive.c,v 1.21 2005/02/17 15:00:33 xtraeme Exp $");
#endif
#endif /* not lint */
@ -82,20 +82,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 *, 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 *, 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;
@ -306,9 +306,7 @@ loop:
* eliminate any embedded ".." components.
*/
static void
getcmd(curdir, cmd, name, ap)
char *curdir, *cmd, *name;
struct arglist *ap;
getcmd(char *curdir, char *cmd, char *name, struct arglist *ap)
{
char *cp;
static char input[BUFSIZ];
@ -410,8 +408,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;
@ -460,8 +457,7 @@ copynext(input, output)
* remove any imbedded "." and ".." components.
*/
void
canon(rawname, canonname)
char *rawname, *canonname;
canon(char *rawname, char *canonname)
{
char *cp, *np;
@ -510,9 +506,7 @@ canon(rawname, canonname)
* 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;
@ -593,10 +587,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;
@ -656,9 +647,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;
@ -730,8 +719,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;
@ -754,9 +742,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;
@ -775,8 +761,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));
@ -786,8 +771,7 @@ fcmp(f1, f2)
* respond to interrupts
*/
void
onintr(signo)
int signo;
onintr(int signo)
{
if (command == 'i' && runshell)
longjmp(reset, 1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.29 2005/01/08 14:30:39 fredb Exp $ */
/* $NetBSD: main.c,v 1.30 2005/02/17 15:00:33 xtraeme Exp $ */
/*
* Copyright (c) 1983, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/4/95";
#else
__RCSID("$NetBSD: main.c,v 1.29 2005/01/08 14:30:39 fredb Exp $");
__RCSID("$NetBSD: main.c,v 1.30 2005/02/17 15:00:33 xtraeme Exp $");
#endif
#endif /* not lint */
@ -80,14 +80,11 @@ int dotflag = 0;
FILE *Mtreefile = NULL;
int main __P((int, char *[]));
static void obsolete __P((int *, char **[]));
static void usage __P((void));
static void obsolete(int *, char **[]);
static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int ch;
ino_t ino;
@ -304,7 +301,7 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
const char *progname = getprogname();
@ -332,9 +329,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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: restore.c,v 1.15 2003/10/21 02:34:45 fvdl Exp $ */
/* $NetBSD: restore.c,v 1.16 2005/02/17 15:00:33 xtraeme Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94";
#else
__RCSID("$NetBSD: restore.c,v 1.15 2003/10/21 02:34:45 fvdl Exp $");
__RCSID("$NetBSD: restore.c,v 1.16 2005/02/17 15:00:33 xtraeme Exp $");
#endif
#endif /* not lint */
@ -49,17 +49,14 @@ __RCSID("$NetBSD: restore.c,v 1.15 2003/10/21 02:34:45 fvdl Exp $");
#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;
@ -503,8 +491,7 @@ nodeupdates(name, ino, type)
* Calculate the active flags in a key.
*/
static char *
keyval(key)
int key;
keyval(int key)
{
static char keybuf[32];
@ -525,7 +512,7 @@ keyval(key)
* Find unreferenced link names.
*/
void
findunreflinks()
findunreflinks(void)
{
struct entry *ep, *np;
ino_t i;
@ -573,7 +560,7 @@ findunreflinks()
* time O(N).
*/
void
removeoldnodes()
removeoldnodes(void)
{
struct entry *ep, **prev;
long change;
@ -602,8 +589,7 @@ removeoldnodes()
* Extract new leaves.
*/
void
createleaves(symtabfile)
char *symtabfile;
createleaves(char *symtabfile)
{
struct entry *ep;
ino_t first;
@ -682,7 +668,7 @@ createleaves(symtabfile)
* Efficiently extract a subset of the files on a tape.
*/
void
createfiles()
createfiles(void)
{
ino_t first, next, last;
struct entry *ep;
@ -786,7 +772,7 @@ new_volume:
* Add links.
*/
void
createlinks()
createlinks(void)
{
struct entry *np, *ep;
ino_t i;
@ -826,7 +812,7 @@ createlinks()
* that no temporary names remain.
*/
void
checkrestore()
checkrestore(void)
{
struct entry *ep;
ino_t i;
@ -848,10 +834,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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: symtab.c,v 1.19 2003/08/07 10:04:38 agc Exp $ */
/* $NetBSD: symtab.c,v 1.20 2005/02/17 15:00:33 xtraeme Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)symtab.c 8.3 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: symtab.c,v 1.19 2003/08/07 10:04:38 agc Exp $");
__RCSID("$NetBSD: symtab.c,v 1.20 2005/02/17 15:00:33 xtraeme Exp $");
#endif
#endif /* not lint */
@ -73,16 +73,15 @@ __RCSID("$NetBSD: symtab.c,v 1.19 2003/08/07 10:04:38 agc Exp $");
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;
@ -98,9 +97,7 @@ lookupino(inum)
* Add an entry into the entry table
*/
static void
addino(inum, np)
ino_t inum;
struct entry *np;
addino(ino_t inum, struct entry *np)
{
struct entry **epp;
@ -120,8 +117,7 @@ addino(inum, np)
* Delete an entry from the entry table
*/
void
deleteino(inum)
ino_t inum;
deleteino(ino_t inum)
{
struct entry *next;
struct entry **prev;
@ -144,8 +140,7 @@ deleteino(inum)
* Look up an entry by name
*/
struct entry *
lookupname(name)
char *name;
lookupname(char *name)
{
struct entry *ep;
char *np, *cp;
@ -171,8 +166,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;
@ -194,8 +188,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];
@ -222,10 +215,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;
@ -278,8 +268,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;
@ -322,9 +311,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;
@ -352,8 +339,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;
@ -398,8 +384,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, *tp;
long len, siz;
@ -432,8 +417,7 @@ savename(name)
* appropriate free list.
*/
void
freename(name)
char *name;
freename(char *name)
{
struct strhdr *tp, *np;
@ -460,9 +444,7 @@ struct symtableheader {
* dump a snapshot of the symbol table
*/
void
dumpsymtable(filename, checkpt)
char *filename;
int32_t checkpt;
dumpsymtable(char *filename, int32_t checkpt)
{
struct entry *ep, *tep;
ino_t i;
@ -548,8 +530,7 @@ dumpsymtable(filename, checkpt)
* Initialize a symbol table from a file
*/
void
initsymtable(filename)
char *filename;
initsymtable(char *filename)
{
char *base;
long tblsize;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tape.c,v 1.51 2004/10/22 22:38:38 bouyer Exp $ */
/* $NetBSD: tape.c,v 1.52 2005/02/17 15:00:33 xtraeme Exp $ */
/*
* Copyright (c) 1983, 1993
@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)tape.c 8.9 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: tape.c,v 1.51 2004/10/22 22:38:38 bouyer Exp $");
__RCSID("$NetBSD: tape.c,v 1.52 2005/02/17 15:00:33 xtraeme Exp $");
#endif
#endif /* not lint */
@ -153,26 +153,25 @@ union u_ospcl {
} s_ospcl;
};
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 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 swap_header __P((struct s_spcl *));
static void swap_old_header __P((struct s_ospcl *));
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 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 void swap_header(struct s_spcl *);
static void swap_old_header(struct s_ospcl *);
const struct digest_desc *
digest_lookup(name)
const char *name;
digest_lookup(const char *name)
{
const struct digest_desc *dd;
@ -187,8 +186,7 @@ digest_lookup(name)
* Set up an input source
*/
void
setinput(source)
char *source;
setinput(char *source)
{
FLUSHTAPEBUF();
if (bflag)
@ -228,8 +226,7 @@ setinput(source)
}
void
newtapebuf(size)
long size;
newtapebuf(long size)
{
static int tapebufsize = -1;
@ -251,7 +248,7 @@ newtapebuf(size)
* that it actually is a dump tape.
*/
void
setup()
setup(void)
{
int i, j, *ip;
struct stat stbuf;
@ -360,8 +357,7 @@ setup()
* the user when only extracting a subset of the files.
*/
void
getvol(nextvol)
int nextvol;
getvol(int nextvol)
{
int newvol, savecnt, wantnext, i;
union u_spcl tmpspcl;
@ -532,7 +528,7 @@ gethdr:
* Handle unexpected EOF.
*/
static void
terminateinput()
terminateinput(void)
{
if (gettingfile && curfile.action == USING) {
@ -554,7 +550,7 @@ terminateinput()
* appropriate one.
*/
static void
setdumpnum()
setdumpnum(void)
{
struct mtop tcom;
@ -576,7 +572,7 @@ setdumpnum()
}
void
printdumpinfo()
printdumpinfo(void)
{
time_t ttime;
@ -607,8 +603,7 @@ printdumpinfo()
}
int
extractfile(name)
char *name;
extractfile(char *name)
{
union digest_buffer dbuffer;
int flags;
@ -789,7 +784,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)
@ -800,7 +795,7 @@ skipmaps()
* skip over a file on the tape
*/
void
skipfile()
skipfile(void)
{
curfile.action = SKIP;
@ -814,9 +809,8 @@ skipfile()
* to the skip function.
*/
void
getfile(fill, skip)
void (*fill) __P((char *, long));
void (*skip) __P((char *, long));
getfile(void (*fill)(char *buf, long size),
void (*skip)(char *buf, long size))
{
int i;
int curblk = 0;
@ -893,9 +887,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 (Dflag)
@ -915,9 +907,7 @@ xtrfile(buf, size)
*/
/* ARGSUSED */
static void
xtrskip(buf, size)
char *buf;
long size;
xtrskip(char *buf, long size)
{
if (Dflag)
@ -936,9 +926,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;
@ -955,9 +943,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",
@ -969,9 +955,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);
@ -983,9 +967,7 @@ xtrmap(buf, size)
*/
/* ARGSUSED */
static void
xtrmapskip(buf, size)
char *buf;
long size;
xtrmapskip(char *buf, long size)
{
panic("hole in map\n");
@ -997,9 +979,7 @@ xtrmapskip(buf, size)
*/
/* ARGSUSED */
void
xtrnull(buf, size)
char *buf;
long size;
xtrnull(char *buf, long size)
{
return;
@ -1010,8 +990,7 @@ xtrnull(buf, size)
* Handle read errors, and end of media.
*/
static void
readtape(buf)
char *buf;
readtape(char *buf)
{
int rd, newvol, i;
int cnt, seek_failed;
@ -1129,7 +1108,7 @@ getmore:
}
static void
findtapeblksize()
findtapeblksize(void)
{
long i;
@ -1159,7 +1138,7 @@ findtapeblksize()
}
void
closemt()
closemt(void)
{
if (mt < 0)
@ -1179,8 +1158,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)
{
union u_ospcl u_ospcl;
@ -1294,8 +1272,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;
@ -1361,8 +1338,7 @@ newcalc:
* Complain if had to skip, and complain is set.
*/
static void
findinode(header)
struct s_spcl *header;
findinode(struct s_spcl *header)
{
static long skipcnt = 0;
long i;
@ -1440,8 +1416,7 @@ findinode(header)
}
static int
checksum(buf)
int *buf;
checksum(int *buf)
{
int i, j;

View File

@ -1,4 +1,4 @@
/* $NetBSD: utilities.c,v 1.18 2004/10/22 22:38:38 bouyer Exp $ */
/* $NetBSD: utilities.c,v 1.19 2005/02/17 15:00:33 xtraeme Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)utilities.c 8.5 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: utilities.c,v 1.18 2004/10/22 22:38:38 bouyer Exp $");
__RCSID("$NetBSD: utilities.c,v 1.19 2005/02/17 15:00:33 xtraeme Exp $");
#endif
#endif /* not lint */
@ -58,8 +58,7 @@ __RCSID("$NetBSD: utilities.c,v 1.18 2004/10/22 22:38:38 bouyer Exp $");
* 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;
@ -127,8 +124,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",
@ -142,8 +138,7 @@ renameit(from, to)
* Create a new node (directory).
*/
void
newnode(np)
struct entry *np;
newnode(struct entry *np)
{
char *cp;
@ -162,8 +157,7 @@ newnode(np)
* Remove an old node (directory).
*/
void
removenode(ep)
struct entry *ep;
removenode(struct entry *ep)
{
char *cp;
@ -185,8 +179,7 @@ removenode(ep)
* Remove a leaf.
*/
void
removeleaf(ep)
struct entry *ep;
removeleaf(struct entry *ep)
{
char *cp;
@ -206,9 +199,7 @@ removeleaf(ep)
* Create a link.
*/
int
linkit(existing, new, type)
char *existing, *new;
int type;
linkit(char *existing, char *new, int type)
{
if (type == SYMLINK) {
@ -238,8 +229,7 @@ linkit(existing, new, type)
* Create a whiteout.
*/
int
addwhiteout(name)
char *name;
addwhiteout(char *name)
{
if (!Nflag && mknod(name, S_IFWHT, 0) < 0) {
@ -255,8 +245,7 @@ addwhiteout(name)
* Delete a whiteout.
*/
void
delwhiteout(ep)
struct entry *ep;
delwhiteout(struct entry *ep)
{
char *name;
@ -277,8 +266,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;
@ -296,8 +284,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;
@ -315,9 +302,7 @@ upperbnd(start)
* report on a badly formed entry
*/
void
badentry(ep, message)
struct entry *ep;
char *message;
badentry(struct entry *ep, char *message)
{
fprintf(stderr, "bad entry: %s\n", message);
@ -342,8 +327,7 @@ badentry(ep, message)
* 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];
@ -368,8 +352,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;
@ -385,8 +368,7 @@ dirlookup(name)
* Elicit a reply.
*/
int
reply(question)
char *question;
reply(char *question)
{
char c;