o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are.
This commit is contained in:
parent
7669d0fc4f
commit
46251dde8f
@ -53,13 +53,10 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main __P((int, char *[]));
|
||||
void usage __P((void));
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, sflag;
|
||||
char *p, hostname[MAXHOSTNAMELEN];
|
||||
@ -94,7 +91,7 @@ main(argc,argv)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "usage: hostname [-s] [name-of-host]\n");
|
||||
|
@ -53,16 +53,13 @@ static const char rcsid[] =
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main __P((int, char *[]));
|
||||
void nosig __P((char *));
|
||||
void printsignals __P((FILE *));
|
||||
int signame_to_signum __P((char *));
|
||||
void usage __P((void));
|
||||
void nosig(char *);
|
||||
void printsignals(FILE *);
|
||||
int signame_to_signum(char *);
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int errors, numsig, pid;
|
||||
char *ep;
|
||||
@ -140,8 +137,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
int
|
||||
signame_to_signum(sig)
|
||||
char *sig;
|
||||
signame_to_signum(char *sig)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -155,8 +151,7 @@ signame_to_signum(sig)
|
||||
}
|
||||
|
||||
void
|
||||
nosig(name)
|
||||
char *name;
|
||||
nosig(char *name)
|
||||
{
|
||||
|
||||
warnx("unknown signal %s; valid signals:", name);
|
||||
@ -165,8 +160,7 @@ nosig(name)
|
||||
}
|
||||
|
||||
void
|
||||
printsignals(fp)
|
||||
FILE *fp;
|
||||
printsignals(FILE *fp)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -180,7 +174,7 @@ printsignals(fp)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
||||
|
17
bin/ln/ln.c
17
bin/ln/ln.c
@ -62,17 +62,14 @@ int iflag; /* Interactive mode. */
|
||||
int sflag; /* Symbolic, not hard, link. */
|
||||
int vflag; /* Verbose output. */
|
||||
/* System link call. */
|
||||
int (*linkf) __P((const char *, const char *));
|
||||
int (*linkf)(const char *, const char *);
|
||||
char linkch;
|
||||
|
||||
int linkit __P((const char *, const char *, int));
|
||||
int main __P((int, char *[]));
|
||||
void usage __P((void));
|
||||
int linkit(const char *, const char *, int);
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct stat sb;
|
||||
char *p, *sourcedir;
|
||||
@ -155,9 +152,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
int
|
||||
linkit(target, source, isdir)
|
||||
const char *target, *source;
|
||||
int isdir;
|
||||
linkit(const char *target, const char *source, int isdir)
|
||||
{
|
||||
struct stat sb;
|
||||
const char *p;
|
||||
@ -232,7 +227,7 @@ linkit(target, source, isdir)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
||||
"usage: ln [-fhinsv] file1 file2",
|
||||
|
24
bin/ls/cmp.c
24
bin/ls/cmp.c
@ -53,57 +53,49 @@ static const char rcsid[] =
|
||||
#include "extern.h"
|
||||
|
||||
int
|
||||
namecmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
namecmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
revnamecmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revnamecmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (strcoll(b->fts_name, a->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
modcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
modcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (b->fts_statp->st_mtime - a->fts_statp->st_mtime);
|
||||
}
|
||||
|
||||
int
|
||||
revmodcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revmodcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (a->fts_statp->st_mtime - b->fts_statp->st_mtime);
|
||||
}
|
||||
|
||||
int
|
||||
acccmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
acccmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (b->fts_statp->st_atime - a->fts_statp->st_atime);
|
||||
}
|
||||
|
||||
int
|
||||
revacccmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revacccmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (a->fts_statp->st_atime - b->fts_statp->st_atime);
|
||||
}
|
||||
|
||||
int
|
||||
statcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
statcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (b->fts_statp->st_ctime - a->fts_statp->st_ctime);
|
||||
}
|
||||
|
||||
int
|
||||
revstatcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revstatcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
return (a->fts_statp->st_ctime - b->fts_statp->st_ctime);
|
||||
}
|
||||
|
@ -34,25 +34,25 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
int acccmp __P((const FTSENT *, const FTSENT *));
|
||||
int revacccmp __P((const FTSENT *, const FTSENT *));
|
||||
int modcmp __P((const FTSENT *, const FTSENT *));
|
||||
int revmodcmp __P((const FTSENT *, const FTSENT *));
|
||||
int namecmp __P((const FTSENT *, const FTSENT *));
|
||||
int revnamecmp __P((const FTSENT *, const FTSENT *));
|
||||
int statcmp __P((const FTSENT *, const FTSENT *));
|
||||
int revstatcmp __P((const FTSENT *, const FTSENT *));
|
||||
int acccmp(const FTSENT *, const FTSENT *);
|
||||
int revacccmp(const FTSENT *, const FTSENT *);
|
||||
int modcmp(const FTSENT *, const FTSENT *);
|
||||
int revmodcmp(const FTSENT *, const FTSENT *);
|
||||
int namecmp(const FTSENT *, const FTSENT *);
|
||||
int revnamecmp(const FTSENT *, const FTSENT *);
|
||||
int statcmp(const FTSENT *, const FTSENT *);
|
||||
int revstatcmp(const FTSENT *, const FTSENT *);
|
||||
|
||||
void printcol __P((DISPLAY *));
|
||||
void printlong __P((DISPLAY *));
|
||||
void printscol __P((DISPLAY *));
|
||||
void usage __P((void));
|
||||
int len_octal __P((const char *, int));
|
||||
int prn_octal __P((const char *));
|
||||
int prn_printable __P((const char *));
|
||||
void printcol(DISPLAY *);
|
||||
void printlong(DISPLAY *);
|
||||
void printscol(DISPLAY *);
|
||||
void usage(void);
|
||||
int len_octal(const char *, int);
|
||||
int prn_octal(const char *);
|
||||
int prn_printable(const char *);
|
||||
#ifdef COLORLS
|
||||
void parsecolors __P((const char *cs));
|
||||
void colorquit __P((int));
|
||||
void parsecolors(const char *cs);
|
||||
void colorquit(int);
|
||||
|
||||
extern char *ansi_fgcol;
|
||||
extern char *ansi_bgcol;
|
||||
|
@ -68,8 +68,8 @@ struct lomac_fioctl2 ioctl_args;
|
||||
*/
|
||||
|
||||
void
|
||||
lomac_start(void) {
|
||||
|
||||
lomac_start(void)
|
||||
{
|
||||
if ((devlomac = open(LOMAC_DEVICE, O_RDWR)) == -1)
|
||||
err(1, "cannot open %s", LOMAC_DEVICE);
|
||||
}
|
||||
@ -84,8 +84,8 @@ lomac_start(void) {
|
||||
*/
|
||||
|
||||
void
|
||||
lomac_stop(void) {
|
||||
|
||||
lomac_stop(void)
|
||||
{
|
||||
if (close(devlomac) == -1)
|
||||
err(1, "cannot close %s", LOMAC_DEVICE);
|
||||
}
|
||||
@ -104,7 +104,8 @@ lomac_stop(void) {
|
||||
*/
|
||||
|
||||
char *
|
||||
get_lattr(FTSENT *ent) {
|
||||
get_lattr(FTSENT *ent)
|
||||
{
|
||||
char *lattr;
|
||||
|
||||
#ifdef NOT_NOW
|
||||
|
29
bin/ls/ls.c
29
bin/ls/ls.c
@ -79,13 +79,13 @@ static const char rcsid[] =
|
||||
*/
|
||||
#define STRBUF_SIZEOF(t) (1 + CHAR_BIT * sizeof(t) / 3 + 1)
|
||||
|
||||
static void display __P((FTSENT *, FTSENT *));
|
||||
static u_quad_t makenines __P((u_long));
|
||||
static int mastercmp __P((const FTSENT **, const FTSENT **));
|
||||
static void traverse __P((int, char **, int));
|
||||
static void display(FTSENT *, FTSENT *);
|
||||
static u_quad_t makenines(u_long);
|
||||
static int mastercmp(const FTSENT **, const FTSENT **);
|
||||
static void traverse(int, char **, int);
|
||||
|
||||
static void (*printfcn) __P((DISPLAY *));
|
||||
static int (*sortfcn) __P((const FTSENT *, const FTSENT *));
|
||||
static void (*printfcn)(DISPLAY *);
|
||||
static int (*sortfcn)(const FTSENT *, const FTSENT *);
|
||||
|
||||
long blocksize; /* block size units */
|
||||
int termwidth = 80; /* default terminal width */
|
||||
@ -129,9 +129,7 @@ char *enter_bold; /* ANSI sequence to set color to bold mode */
|
||||
int rval;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
static char dot[] = ".", *dotav[] = {dot, NULL};
|
||||
struct winsize win;
|
||||
@ -409,9 +407,7 @@ static int output; /* If anything output. */
|
||||
* a superset (may be exact set) of the files to be displayed.
|
||||
*/
|
||||
static void
|
||||
traverse(argc, argv, options)
|
||||
int argc, options;
|
||||
char *argv[];
|
||||
traverse(int argc, char *argv[], int options)
|
||||
{
|
||||
FTS *ftsp;
|
||||
FTSENT *p, *chp;
|
||||
@ -474,8 +470,7 @@ traverse(argc, argv, options)
|
||||
* points to the parent directory of the display list.
|
||||
*/
|
||||
static void
|
||||
display(p, list)
|
||||
FTSENT *p, *list;
|
||||
display(FTSENT *p, FTSENT *list)
|
||||
{
|
||||
struct stat *sp;
|
||||
DISPLAY d;
|
||||
@ -721,8 +716,7 @@ display(p, list)
|
||||
* All other levels use the sort function. Error entries remain unsorted.
|
||||
*/
|
||||
static int
|
||||
mastercmp(a, b)
|
||||
const FTSENT **a, **b;
|
||||
mastercmp(const FTSENT **a, const FTSENT **b)
|
||||
{
|
||||
int a_info, b_info;
|
||||
|
||||
@ -751,8 +745,7 @@ mastercmp(a, b)
|
||||
* into a number that wide in decimal.
|
||||
*/
|
||||
static u_quad_t
|
||||
makenines(n)
|
||||
u_long n;
|
||||
makenines(u_long n)
|
||||
{
|
||||
u_long i;
|
||||
u_quad_t reg;
|
||||
|
@ -67,14 +67,14 @@ static const char rcsid[] =
|
||||
#include "ls.h"
|
||||
#include "extern.h"
|
||||
|
||||
static int printaname __P((FTSENT *, u_long, u_long));
|
||||
static void printlink __P((FTSENT *));
|
||||
static void printtime __P((time_t));
|
||||
static int printtype __P((u_int));
|
||||
static void printsize __P((size_t, off_t));
|
||||
static int printaname(FTSENT *, u_long, u_long);
|
||||
static void printlink(FTSENT *);
|
||||
static void printtime(time_t);
|
||||
static int printtype(u_int);
|
||||
static void printsize(size_t, off_t);
|
||||
#ifdef COLORLS
|
||||
static void endcolor __P((int));
|
||||
static int colortype __P((mode_t));
|
||||
static void endcolor(int);
|
||||
static int colortype(mode_t);
|
||||
#endif
|
||||
|
||||
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT)
|
||||
@ -97,7 +97,7 @@ unsigned long long vals_base2[] = {1, KILO_2_SZ, MEGA_2_SZ, GIGA_2_SZ, TERA_2_SZ
|
||||
typedef enum {
|
||||
NONE, KILO, MEGA, GIGA, TERA, PETA, UNIT_MAX
|
||||
} unit_t;
|
||||
static unit_t unit_adjust __P((off_t *));
|
||||
static unit_t unit_adjust(off_t *);
|
||||
|
||||
int unitp[] = {NONE, KILO, MEGA, GIGA, TERA, PETA};
|
||||
|
||||
@ -130,8 +130,7 @@ static struct {
|
||||
#endif
|
||||
|
||||
void
|
||||
printscol(dp)
|
||||
DISPLAY *dp;
|
||||
printscol(DISPLAY *dp)
|
||||
{
|
||||
FTSENT *p;
|
||||
|
||||
@ -147,8 +146,7 @@ printscol(dp)
|
||||
* print name in current style
|
||||
*/
|
||||
static int
|
||||
printname(name)
|
||||
const char *name;
|
||||
printname(const char *name)
|
||||
{
|
||||
if (f_octal || f_octal_escape)
|
||||
return prn_octal(name);
|
||||
@ -159,8 +157,7 @@ printname(name)
|
||||
}
|
||||
|
||||
void
|
||||
printlong(dp)
|
||||
DISPLAY *dp;
|
||||
printlong(DISPLAY *dp)
|
||||
{
|
||||
struct stat *sp;
|
||||
FTSENT *p;
|
||||
@ -228,8 +225,7 @@ printlong(dp)
|
||||
}
|
||||
|
||||
void
|
||||
printcol(dp)
|
||||
DISPLAY *dp;
|
||||
printcol(DISPLAY *dp)
|
||||
{
|
||||
extern int termwidth;
|
||||
static FTSENT **array;
|
||||
@ -311,10 +307,7 @@ printcol(dp)
|
||||
* return # of characters printed, no trailing characters.
|
||||
*/
|
||||
static int
|
||||
printaname(p, inodefield, sizefield)
|
||||
FTSENT *p;
|
||||
u_long inodefield;
|
||||
u_long sizefield;
|
||||
printaname(FTSENT *p, u_long inodefield, u_long sizefield)
|
||||
{
|
||||
struct stat *sp;
|
||||
int chcnt;
|
||||
@ -344,8 +337,7 @@ printaname(p, inodefield, sizefield)
|
||||
}
|
||||
|
||||
static void
|
||||
printtime(ftime)
|
||||
time_t ftime;
|
||||
printtime(time_t ftime)
|
||||
{
|
||||
char longstring[80];
|
||||
static time_t now;
|
||||
@ -372,8 +364,7 @@ printtime(ftime)
|
||||
}
|
||||
|
||||
static int
|
||||
printtype(mode)
|
||||
u_int mode;
|
||||
printtype(u_int mode)
|
||||
{
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
@ -401,16 +392,14 @@ printtype(mode)
|
||||
|
||||
#ifdef COLORLS
|
||||
static int
|
||||
putch(c)
|
||||
int c;
|
||||
putch(int c)
|
||||
{
|
||||
(void)putchar(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
writech(c)
|
||||
int c;
|
||||
writech(int c)
|
||||
{
|
||||
char tmp = c;
|
||||
|
||||
@ -419,8 +408,7 @@ writech(c)
|
||||
}
|
||||
|
||||
static void
|
||||
printcolor(c)
|
||||
Colors c;
|
||||
printcolor(Colors c)
|
||||
{
|
||||
char *ansiseq;
|
||||
|
||||
@ -440,16 +428,14 @@ printcolor(c)
|
||||
}
|
||||
|
||||
static void
|
||||
endcolor(sig)
|
||||
int sig;
|
||||
endcolor(int sig)
|
||||
{
|
||||
tputs(ansi_coloff, 1, sig ? writech : putch);
|
||||
tputs(attrs_off, 1, sig ? writech : putch);
|
||||
}
|
||||
|
||||
static int
|
||||
colortype(mode)
|
||||
mode_t mode;
|
||||
colortype(mode_t mode)
|
||||
{
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
@ -490,8 +476,7 @@ colortype(mode)
|
||||
}
|
||||
|
||||
void
|
||||
parsecolors(cs)
|
||||
const char *cs;
|
||||
parsecolors(const char *cs)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@ -541,8 +526,7 @@ parsecolors(cs)
|
||||
}
|
||||
|
||||
void
|
||||
colorquit(sig)
|
||||
int sig;
|
||||
colorquit(int sig)
|
||||
{
|
||||
endcolor(sig);
|
||||
|
||||
@ -553,8 +537,7 @@ colorquit(sig)
|
||||
#endif /* COLORLS */
|
||||
|
||||
static void
|
||||
printlink(p)
|
||||
FTSENT *p;
|
||||
printlink(FTSENT *p)
|
||||
{
|
||||
int lnklen;
|
||||
char name[MAXPATHLEN + 1];
|
||||
@ -575,9 +558,7 @@ printlink(p)
|
||||
}
|
||||
|
||||
static void
|
||||
printsize(width, bytes)
|
||||
size_t width;
|
||||
off_t bytes;
|
||||
printsize(size_t width, off_t bytes)
|
||||
{
|
||||
unit_t unit;
|
||||
|
||||
@ -600,8 +581,7 @@ printsize(width, bytes)
|
||||
*
|
||||
*/
|
||||
unit_t
|
||||
unit_adjust(val)
|
||||
off_t *val;
|
||||
unit_adjust(off_t *val)
|
||||
{
|
||||
double abval;
|
||||
unit_t unit;
|
||||
|
@ -57,8 +57,7 @@ static const char rcsid[] =
|
||||
#include "extern.h"
|
||||
|
||||
int
|
||||
prn_printable(s)
|
||||
const char *s;
|
||||
prn_printable(const char *s)
|
||||
{
|
||||
unsigned char c;
|
||||
int n;
|
||||
@ -85,9 +84,7 @@ prn_printable(s)
|
||||
*/
|
||||
|
||||
int
|
||||
len_octal(s, len)
|
||||
const char *s;
|
||||
int len;
|
||||
len_octal(const char *s, int len)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
@ -97,8 +94,7 @@ len_octal(s, len)
|
||||
}
|
||||
|
||||
int
|
||||
prn_octal(s)
|
||||
const char *s;
|
||||
prn_octal(const char *s)
|
||||
{
|
||||
unsigned char ch;
|
||||
int len = 0;
|
||||
@ -158,7 +154,7 @@ prn_octal(s)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
#ifdef COLORLS
|
||||
|
@ -57,16 +57,13 @@ static const char rcsid[] =
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int build __P((char *, mode_t));
|
||||
int main __P((int, char *[]));
|
||||
void usage __P((void));
|
||||
int build(char *, mode_t);
|
||||
void usage(void);
|
||||
|
||||
int vflag;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, exitval, success, omode, pflag;
|
||||
mode_t *set = (mode_t *)NULL;
|
||||
@ -136,9 +133,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
int
|
||||
build(path, omode)
|
||||
char *path;
|
||||
mode_t omode;
|
||||
build(char *path, mode_t omode)
|
||||
{
|
||||
struct stat sb;
|
||||
mode_t numask, oumask;
|
||||
@ -206,7 +201,7 @@ build(path, omode)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "usage: mkdir [-pv] [-m mode] directory ...\n");
|
||||
|
25
bin/mv/mv.c
25
bin/mv/mv.c
@ -68,16 +68,13 @@ static const char rcsid[] =
|
||||
|
||||
int fflg, iflg, vflg;
|
||||
|
||||
int copy __P((char *, char *));
|
||||
int do_move __P((char *, char *));
|
||||
int fastcopy __P((char *, char *, struct stat *));
|
||||
int main __P((int, char *[]));
|
||||
void usage __P((void));
|
||||
int copy(char *, char *);
|
||||
int do_move(char *, char *);
|
||||
int fastcopy(char *, char *, struct stat *);
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
register int baselen, len, rval;
|
||||
register char *p, *endp;
|
||||
@ -151,8 +148,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
int
|
||||
do_move(from, to)
|
||||
char *from, *to;
|
||||
do_move(char *from, char *to)
|
||||
{
|
||||
struct stat sb;
|
||||
int ask, ch, first;
|
||||
@ -232,9 +228,7 @@ do_move(from, to)
|
||||
}
|
||||
|
||||
int
|
||||
fastcopy(from, to, sbp)
|
||||
char *from, *to;
|
||||
struct stat *sbp;
|
||||
fastcopy(char *from, char *to, struct stat *sbp)
|
||||
{
|
||||
struct timeval tval[2];
|
||||
static u_int blen;
|
||||
@ -325,8 +319,7 @@ err: if (unlink(to))
|
||||
}
|
||||
|
||||
int
|
||||
copy(from, to)
|
||||
char *from, *to;
|
||||
copy(char *from, char *to)
|
||||
{
|
||||
int pid, status;
|
||||
|
||||
@ -371,7 +364,7 @@ copy(from, to)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
|
@ -85,9 +85,9 @@ char *arcname; /* printable name of archive */
|
||||
const char *gzip_program; /* name of gzip program */
|
||||
static pid_t zpid = -1; /* pid of child process */
|
||||
|
||||
static int get_phys __P((void));
|
||||
static int get_phys(void);
|
||||
extern sigset_t s_mask;
|
||||
static void ar_start_gzip __P((int, const char *, int));
|
||||
static void ar_start_gzip(int, const char *, int);
|
||||
|
||||
/*
|
||||
* ar_open()
|
||||
@ -98,14 +98,8 @@ static void ar_start_gzip __P((int, const char *, int));
|
||||
* -1 on failure, 0 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_open(char *name)
|
||||
#else
|
||||
int
|
||||
ar_open(name)
|
||||
char *name;
|
||||
#endif
|
||||
{
|
||||
struct mtget mb;
|
||||
|
||||
@ -303,13 +297,8 @@ ar_open(name)
|
||||
* ar_close()
|
||||
* closes archive device, increments volume number, and prints i/o summary
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
void
|
||||
ar_close(void)
|
||||
#else
|
||||
void
|
||||
ar_close()
|
||||
#endif
|
||||
{
|
||||
|
||||
if (arfd < 0) {
|
||||
@ -425,13 +414,8 @@ ar_close()
|
||||
* other side of the pipe from getting a SIGPIPE (pax will stop
|
||||
* reading an archive once a format dependent trailer is detected).
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
void
|
||||
ar_drain(void)
|
||||
#else
|
||||
void
|
||||
ar_drain()
|
||||
#endif
|
||||
{
|
||||
register int res;
|
||||
char drbuf[MAXBLK];
|
||||
@ -462,13 +446,8 @@ ar_drain()
|
||||
* 0 if all ready to write, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_set_wr(void)
|
||||
#else
|
||||
int
|
||||
ar_set_wr()
|
||||
#endif
|
||||
{
|
||||
off_t cpos;
|
||||
|
||||
@ -505,13 +484,8 @@ ar_set_wr()
|
||||
* 0 if we can append, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_app_ok(void)
|
||||
#else
|
||||
int
|
||||
ar_app_ok()
|
||||
#endif
|
||||
{
|
||||
if (artyp == ISPIPE) {
|
||||
paxwarn(1, "Cannot append to an archive obtained from a pipe.");
|
||||
@ -534,15 +508,8 @@ ar_app_ok()
|
||||
* Number of bytes in buffer. 0 for end of file, -1 for a read error.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_read(register char *buf, register int cnt)
|
||||
#else
|
||||
int
|
||||
ar_read(buf, cnt)
|
||||
register char *buf;
|
||||
register int cnt;
|
||||
#endif
|
||||
{
|
||||
register int res = 0;
|
||||
|
||||
@ -624,15 +591,8 @@ ar_read(buf, cnt)
|
||||
* error in the archive occured.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_write(register char *buf, register int bsz)
|
||||
#else
|
||||
int
|
||||
ar_write(buf, bsz)
|
||||
register char *buf;
|
||||
register int bsz;
|
||||
#endif
|
||||
{
|
||||
register int res;
|
||||
off_t cpos;
|
||||
@ -749,13 +709,8 @@ ar_write(buf, bsz)
|
||||
* 0 when ok to try i/o again, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_rdsync(void)
|
||||
#else
|
||||
int
|
||||
ar_rdsync()
|
||||
#endif
|
||||
{
|
||||
long fsbz;
|
||||
off_t cpos;
|
||||
@ -840,15 +795,8 @@ ar_rdsync()
|
||||
* partial move (the amount moved is in skipped)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_fow(off_t sksz, off_t *skipped)
|
||||
#else
|
||||
int
|
||||
ar_fow(sksz, skipped)
|
||||
off_t sksz;
|
||||
off_t *skipped;
|
||||
#endif
|
||||
{
|
||||
off_t cpos;
|
||||
off_t mpos;
|
||||
@ -906,14 +854,8 @@ ar_fow(sksz, skipped)
|
||||
* 0 if moved the requested distance, -1 on complete failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_rev(off_t sksz)
|
||||
#else
|
||||
int
|
||||
ar_rev(sksz)
|
||||
off_t sksz;
|
||||
#endif
|
||||
{
|
||||
off_t cpos;
|
||||
struct mtop mb;
|
||||
@ -1044,13 +986,8 @@ ar_rev(sksz)
|
||||
* physical block size if ok (ok > 0), -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
get_phys(void)
|
||||
#else
|
||||
static int
|
||||
get_phys()
|
||||
#endif
|
||||
{
|
||||
register int padsz = 0;
|
||||
register int res;
|
||||
@ -1162,13 +1099,8 @@ get_phys()
|
||||
* 0 when ready to continue, -1 when all done
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ar_next(void)
|
||||
#else
|
||||
int
|
||||
ar_next()
|
||||
#endif
|
||||
{
|
||||
char buf[PAXPATHLEN+2];
|
||||
static int freeit = 0;
|
||||
|
@ -56,9 +56,9 @@ static const char rcsid[] =
|
||||
#include "pax.h"
|
||||
#include "extern.h"
|
||||
|
||||
static void wr_archive __P((register ARCHD *, int is_app));
|
||||
static int get_arc __P((void));
|
||||
static int next_head __P((register ARCHD *));
|
||||
static void wr_archive(register ARCHD *, int is_app);
|
||||
static int get_arc(void);
|
||||
static int next_head(register ARCHD *);
|
||||
extern sigset_t s_mask;
|
||||
|
||||
/*
|
||||
@ -75,13 +75,8 @@ u_long flcnt; /* number of files processed */
|
||||
* (no pattern matches all).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
list(void)
|
||||
#else
|
||||
void
|
||||
list()
|
||||
#endif
|
||||
{
|
||||
register ARCHD *arcn;
|
||||
register int res;
|
||||
@ -157,13 +152,8 @@ list()
|
||||
* pattern(s) (no patterns extracts all members)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
extract(void)
|
||||
#else
|
||||
void
|
||||
extract()
|
||||
#endif
|
||||
{
|
||||
register ARCHD *arcn;
|
||||
register int res;
|
||||
@ -368,15 +358,8 @@ extract()
|
||||
* previously written archive.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static void
|
||||
wr_archive(register ARCHD *arcn, int is_app)
|
||||
#else
|
||||
static void
|
||||
wr_archive(arcn, is_app)
|
||||
register ARCHD *arcn;
|
||||
int is_app;
|
||||
#endif
|
||||
{
|
||||
register int res;
|
||||
register int hlk;
|
||||
@ -578,13 +561,8 @@ wr_archive(arcn, is_app)
|
||||
* over write existing files that it creates.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
append(void)
|
||||
#else
|
||||
void
|
||||
append()
|
||||
#endif
|
||||
{
|
||||
register ARCHD *arcn;
|
||||
register int res;
|
||||
@ -719,13 +697,8 @@ append()
|
||||
* write a new archive
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
archive(void)
|
||||
#else
|
||||
void
|
||||
archive()
|
||||
#endif
|
||||
{
|
||||
ARCHD archd;
|
||||
|
||||
@ -750,13 +723,8 @@ archive()
|
||||
* (except the files are forced to be under the destination directory).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
copy(void)
|
||||
#else
|
||||
void
|
||||
copy()
|
||||
#endif
|
||||
{
|
||||
register ARCHD *arcn;
|
||||
register int res;
|
||||
@ -1002,14 +970,8 @@ copy()
|
||||
* the specs for rd_wrbuf() for more details)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
next_head(register ARCHD *arcn)
|
||||
#else
|
||||
static int
|
||||
next_head(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register int ret;
|
||||
register char *hdend;
|
||||
@ -1160,13 +1122,8 @@ next_head(arcn)
|
||||
* 0 if archive found -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
get_arc(void)
|
||||
#else
|
||||
static int
|
||||
get_arc()
|
||||
#endif
|
||||
{
|
||||
register int i;
|
||||
register int hdsz = 0;
|
||||
|
@ -84,13 +84,8 @@ off_t rdcnt; /* # of bytes read on current vol */
|
||||
* 0 if ok, -1 if the user specified write block size violates pax spec
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
wr_start(void)
|
||||
#else
|
||||
int
|
||||
wr_start()
|
||||
#endif
|
||||
{
|
||||
buf = &(bufmem[BLKMULT]);
|
||||
/*
|
||||
@ -137,13 +132,8 @@ wr_start()
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
rd_start(void)
|
||||
#else
|
||||
int
|
||||
rd_start()
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* leave space for the header pushback (see get_arc()). If we are
|
||||
@ -180,13 +170,8 @@ rd_start()
|
||||
* set up buffer system for copying within the file system
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
cp_start(void)
|
||||
#else
|
||||
void
|
||||
cp_start()
|
||||
#endif
|
||||
{
|
||||
buf = &(bufmem[BLKMULT]);
|
||||
rdblksz = blksz = MAXBLK;
|
||||
@ -224,14 +209,8 @@ cp_start()
|
||||
* 0 for success, -1 for failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
appnd_start(off_t skcnt)
|
||||
#else
|
||||
int
|
||||
appnd_start(skcnt)
|
||||
off_t skcnt;
|
||||
#endif
|
||||
{
|
||||
register int res;
|
||||
off_t cnt;
|
||||
@ -329,13 +308,8 @@ appnd_start(skcnt)
|
||||
* 0 on success, and -1 on failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
rd_sync(void)
|
||||
#else
|
||||
int
|
||||
rd_sync()
|
||||
#endif
|
||||
{
|
||||
register int errcnt = 0;
|
||||
register int res;
|
||||
@ -402,15 +376,8 @@ rd_sync()
|
||||
* pback space is increased.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
pback(char *pt, int cnt)
|
||||
#else
|
||||
void
|
||||
pback(pt, cnt)
|
||||
char *pt;
|
||||
int cnt;
|
||||
#endif
|
||||
{
|
||||
bufpt -= cnt;
|
||||
memcpy(bufpt, pt, cnt);
|
||||
@ -425,14 +392,8 @@ pback(pt, cnt)
|
||||
* 0 if ok, -1 failure, and 1 when EOF on the archive volume was detected.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
rd_skip(off_t skcnt)
|
||||
#else
|
||||
int
|
||||
rd_skip(skcnt)
|
||||
off_t skcnt;
|
||||
#endif
|
||||
{
|
||||
off_t res;
|
||||
off_t cnt;
|
||||
@ -500,13 +461,8 @@ rd_skip(skcnt)
|
||||
* BE a requirement....
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
wr_fin(void)
|
||||
#else
|
||||
void
|
||||
wr_fin()
|
||||
#endif
|
||||
{
|
||||
if (bufpt > buf) {
|
||||
memset(bufpt, 0, bufend - bufpt);
|
||||
@ -526,15 +482,8 @@ wr_fin()
|
||||
* 0 if buffer was filled ok, -1 o.w. (buffer flush failure)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
wr_rdbuf(register char *out, register int outcnt)
|
||||
#else
|
||||
int
|
||||
wr_rdbuf(out, outcnt)
|
||||
register char *out;
|
||||
register int outcnt;
|
||||
#endif
|
||||
{
|
||||
register int cnt;
|
||||
|
||||
@ -569,15 +518,8 @@ wr_rdbuf(out, outcnt)
|
||||
* -1 is a read error
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
rd_wrbuf(register char *in, register int cpcnt)
|
||||
#else
|
||||
int
|
||||
rd_wrbuf(in, cpcnt)
|
||||
register char *in;
|
||||
register int cpcnt;
|
||||
#endif
|
||||
{
|
||||
register int res;
|
||||
register int cnt;
|
||||
@ -624,14 +566,8 @@ rd_wrbuf(in, cpcnt)
|
||||
* 0 if ok, -1 if there was a buf_flush failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
wr_skip(off_t skcnt)
|
||||
#else
|
||||
int
|
||||
wr_skip(skcnt)
|
||||
off_t skcnt;
|
||||
#endif
|
||||
{
|
||||
register int cnt;
|
||||
|
||||
@ -668,16 +604,8 @@ wr_skip(skcnt)
|
||||
* 0, but "left" is set to be greater than zero.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
wr_rdfile(ARCHD *arcn, int ifd, off_t *left)
|
||||
#else
|
||||
int
|
||||
wr_rdfile(arcn, ifd, left)
|
||||
ARCHD *arcn;
|
||||
int ifd;
|
||||
off_t *left;
|
||||
#endif
|
||||
{
|
||||
register int cnt;
|
||||
register int res = 0;
|
||||
@ -737,16 +665,8 @@ wr_rdfile(arcn, ifd, left)
|
||||
* we return a 0 but "left" is set to be the amount unwritten
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
|
||||
#else
|
||||
int
|
||||
rd_wrfile(arcn, ofd, left)
|
||||
ARCHD *arcn;
|
||||
int ofd;
|
||||
off_t *left;
|
||||
#endif
|
||||
{
|
||||
register int cnt = 0;
|
||||
register off_t size = arcn->sb.st_size;
|
||||
@ -833,16 +753,8 @@ rd_wrfile(arcn, ofd, left)
|
||||
* destination file so we can properly copy files with holes.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
cp_file(ARCHD *arcn, int fd1, int fd2)
|
||||
#else
|
||||
void
|
||||
cp_file(arcn, fd1, fd2)
|
||||
ARCHD *arcn;
|
||||
int fd1;
|
||||
int fd2;
|
||||
#endif
|
||||
{
|
||||
register int cnt;
|
||||
register off_t cpcnt = 0L;
|
||||
@ -922,13 +834,8 @@ cp_file(arcn, fd1, fd2)
|
||||
* 0 when finished (user specified termination in ar_next()).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
buf_fill(void)
|
||||
#else
|
||||
int
|
||||
buf_fill()
|
||||
#endif
|
||||
{
|
||||
register int cnt;
|
||||
static int fini = 0;
|
||||
@ -972,14 +879,8 @@ buf_fill()
|
||||
* 0 if all is ok, -1 when a write error occurs.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
buf_flush(register int bufcnt)
|
||||
#else
|
||||
int
|
||||
buf_flush(bufcnt)
|
||||
register int bufcnt;
|
||||
#endif
|
||||
{
|
||||
register int cnt;
|
||||
register int push = 0;
|
||||
|
@ -76,13 +76,8 @@ static GIDC **grptb = NULL; /* group name to gid cache */
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
uidtb_start(void)
|
||||
#else
|
||||
int
|
||||
uidtb_start()
|
||||
#endif
|
||||
{
|
||||
static int fail = 0;
|
||||
|
||||
@ -105,13 +100,8 @@ uidtb_start()
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
gidtb_start(void)
|
||||
#else
|
||||
int
|
||||
gidtb_start()
|
||||
#endif
|
||||
{
|
||||
static int fail = 0;
|
||||
|
||||
@ -134,13 +124,8 @@ gidtb_start()
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
usrtb_start(void)
|
||||
#else
|
||||
int
|
||||
usrtb_start()
|
||||
#endif
|
||||
{
|
||||
static int fail = 0;
|
||||
|
||||
@ -163,13 +148,8 @@ usrtb_start()
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
grptb_start(void)
|
||||
#else
|
||||
int
|
||||
grptb_start()
|
||||
#endif
|
||||
{
|
||||
static int fail = 0;
|
||||
|
||||
@ -193,15 +173,8 @@ grptb_start()
|
||||
* Pointer to stored name (or a empty string)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
char *
|
||||
name_uid(uid_t uid, int frc)
|
||||
#else
|
||||
char *
|
||||
name_uid(uid, frc)
|
||||
uid_t uid;
|
||||
int frc;
|
||||
#endif
|
||||
{
|
||||
register struct passwd *pw;
|
||||
register UIDC *ptr;
|
||||
@ -271,15 +244,8 @@ name_uid(uid, frc)
|
||||
* Pointer to stored name (or a empty string)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
char *
|
||||
name_gid(gid_t gid, int frc)
|
||||
#else
|
||||
char *
|
||||
name_gid(gid, frc)
|
||||
gid_t gid;
|
||||
int frc;
|
||||
#endif
|
||||
{
|
||||
register struct group *gr;
|
||||
register GIDC *ptr;
|
||||
@ -348,15 +314,8 @@ name_gid(gid, frc)
|
||||
* the uid (if any) for a user name, or a -1 if no match can be found
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
uid_name(char *name, uid_t *uid)
|
||||
#else
|
||||
int
|
||||
uid_name(name, uid)
|
||||
char *name;
|
||||
uid_t *uid;
|
||||
#endif
|
||||
{
|
||||
register struct passwd *pw;
|
||||
register UIDC *ptr;
|
||||
@ -419,15 +378,8 @@ uid_name(name, uid)
|
||||
* the gid (if any) for a group name, or a -1 if no match can be found
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
gid_name(char *name, gid_t *gid)
|
||||
#else
|
||||
int
|
||||
gid_name(name, gid)
|
||||
char *name;
|
||||
gid_t *gid;
|
||||
#endif
|
||||
{
|
||||
register struct group *gr;
|
||||
register GIDC *ptr;
|
||||
|
138
bin/pax/cpio.c
138
bin/pax/cpio.c
@ -54,9 +54,9 @@ static const char rcsid[] =
|
||||
#include "cpio.h"
|
||||
#include "extern.h"
|
||||
|
||||
static int rd_nm __P((register ARCHD *, int));
|
||||
static int rd_ln_nm __P((register ARCHD *));
|
||||
static int com_rd __P((register ARCHD *));
|
||||
static int rd_nm(register ARCHD *, int);
|
||||
static int rd_ln_nm(register ARCHD *);
|
||||
static int com_rd(register ARCHD *);
|
||||
|
||||
/*
|
||||
* Routines which support the different cpio versions
|
||||
@ -75,13 +75,8 @@ static int swp_head; /* binary cpio header byte swap */
|
||||
* 0 if ok -1 otherwise (the return values of lnk_start())
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cpio_strd(void)
|
||||
#else
|
||||
int
|
||||
cpio_strd()
|
||||
#endif
|
||||
{
|
||||
return(lnk_start());
|
||||
}
|
||||
@ -96,14 +91,8 @@ cpio_strd()
|
||||
* 0 if a valid trailer, -1 if not a valid trailer,
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cpio_trail(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
cpio_trail(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* look for trailer id in file we are about to process
|
||||
@ -120,14 +109,8 @@ cpio_trail(arcn)
|
||||
* 0
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
com_rd(register ARCHD *arcn)
|
||||
#else
|
||||
static int
|
||||
com_rd(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
arcn->skip = 0;
|
||||
arcn->pat = NULL;
|
||||
@ -175,13 +158,8 @@ com_rd(arcn)
|
||||
* result of the write of the trailer from the cpio specific write func
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cpio_endwr(void)
|
||||
#else
|
||||
int
|
||||
cpio_endwr()
|
||||
#endif
|
||||
{
|
||||
ARCHD last;
|
||||
|
||||
@ -203,15 +181,8 @@ cpio_endwr()
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
rd_nm(register ARCHD *arcn, int nsz)
|
||||
#else
|
||||
static int
|
||||
rd_nm(arcn, nsz)
|
||||
register ARCHD *arcn;
|
||||
int nsz;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* do not even try bogus values
|
||||
@ -240,14 +211,8 @@ rd_nm(arcn, nsz)
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
rd_ln_nm(register ARCHD *arcn)
|
||||
#else
|
||||
static int
|
||||
rd_ln_nm(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* check the length specified for bogus values
|
||||
@ -297,15 +262,8 @@ rd_ln_nm(arcn)
|
||||
* 0 if a valid header, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cpio_id(char *blk, int size)
|
||||
#else
|
||||
int
|
||||
cpio_id(blk, size)
|
||||
char *blk;
|
||||
int size;
|
||||
#endif
|
||||
{
|
||||
if ((size < sizeof(HD_CPIO)) ||
|
||||
(strncmp(blk, AMAGIC, sizeof(AMAGIC) - 1) != 0))
|
||||
@ -321,15 +279,8 @@ cpio_id(blk, size)
|
||||
* 0 if a valid header, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cpio_rd(register ARCHD *arcn, register char *buf)
|
||||
#else
|
||||
int
|
||||
cpio_rd(arcn, buf)
|
||||
register ARCHD *arcn;
|
||||
register char *buf;
|
||||
#endif
|
||||
{
|
||||
register int nsz;
|
||||
register HD_CPIO *hd;
|
||||
@ -409,13 +360,8 @@ cpio_rd(arcn, buf)
|
||||
* size of trailer header in this format
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
off_t
|
||||
cpio_endrd(void)
|
||||
#else
|
||||
off_t
|
||||
cpio_endrd()
|
||||
#endif
|
||||
{
|
||||
return((off_t)(sizeof(HD_CPIO) + sizeof(TRAILER)));
|
||||
}
|
||||
@ -427,13 +373,8 @@ cpio_endrd()
|
||||
* 0 if ok, -1 otherwise (what dev_start() returns)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cpio_stwr(void)
|
||||
#else
|
||||
int
|
||||
cpio_stwr()
|
||||
#endif
|
||||
{
|
||||
return(dev_start());
|
||||
}
|
||||
@ -447,14 +388,8 @@ cpio_stwr()
|
||||
* data to write after the header, -1 if archive write failed
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cpio_wr(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
cpio_wr(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register HD_CPIO *hd;
|
||||
register int nsz;
|
||||
@ -583,15 +518,8 @@ cpio_wr(arcn)
|
||||
* 0 if a valid header, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
vcpio_id(char *blk, int size)
|
||||
#else
|
||||
int
|
||||
vcpio_id(blk, size)
|
||||
char *blk;
|
||||
int size;
|
||||
#endif
|
||||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVMAGIC, sizeof(AVMAGIC) - 1) != 0))
|
||||
@ -607,15 +535,8 @@ vcpio_id(blk, size)
|
||||
* 0 if a valid header, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
crc_id(char *blk, int size)
|
||||
#else
|
||||
int
|
||||
crc_id(blk, size)
|
||||
char *blk;
|
||||
int size;
|
||||
#endif
|
||||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVCMAGIC, sizeof(AVCMAGIC) - 1) != 0))
|
||||
@ -630,13 +551,8 @@ crc_id(blk, size)
|
||||
* 0 if ok -1 otherwise (the return values of lnk_start())
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
crc_strd(void)
|
||||
#else
|
||||
int
|
||||
crc_strd()
|
||||
#endif
|
||||
{
|
||||
docrc = 1;
|
||||
return(lnk_start());
|
||||
@ -650,15 +566,8 @@ crc_strd()
|
||||
* 0 if a valid header, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
vcpio_rd(register ARCHD *arcn, register char *buf)
|
||||
#else
|
||||
int
|
||||
vcpio_rd(arcn, buf)
|
||||
register ARCHD *arcn;
|
||||
register char *buf;
|
||||
#endif
|
||||
{
|
||||
register HD_VCPIO *hd;
|
||||
dev_t devminor;
|
||||
@ -760,13 +669,8 @@ vcpio_rd(arcn, buf)
|
||||
* size of trailer header in this format
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
off_t
|
||||
vcpio_endrd(void)
|
||||
#else
|
||||
off_t
|
||||
vcpio_endrd()
|
||||
#endif
|
||||
{
|
||||
return((off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER) +
|
||||
(VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER)))));
|
||||
@ -779,13 +683,8 @@ vcpio_endrd()
|
||||
* 0 if ok, -1 otherwise (what dev_start() returns)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
crc_stwr(void)
|
||||
#else
|
||||
int
|
||||
crc_stwr()
|
||||
#endif
|
||||
{
|
||||
docrc = 1;
|
||||
return(dev_start());
|
||||
@ -800,14 +699,8 @@ crc_stwr()
|
||||
* NO data to write after the header, -1 if archive write failed
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
vcpio_wr(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
vcpio_wr(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register HD_VCPIO *hd;
|
||||
unsigned int nsz;
|
||||
@ -963,15 +856,8 @@ vcpio_wr(arcn)
|
||||
* 0 if a valid header, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
bcpio_id(char *blk, int size)
|
||||
#else
|
||||
int
|
||||
bcpio_id(blk, size)
|
||||
char *blk;
|
||||
int size;
|
||||
#endif
|
||||
{
|
||||
if (size < sizeof(HD_BCPIO))
|
||||
return(-1);
|
||||
@ -998,15 +884,8 @@ bcpio_id(blk, size)
|
||||
* 0 if a valid header, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
bcpio_rd(register ARCHD *arcn, register char *buf)
|
||||
#else
|
||||
int
|
||||
bcpio_rd(arcn, buf)
|
||||
register ARCHD *arcn;
|
||||
register char *buf;
|
||||
#endif
|
||||
{
|
||||
register HD_BCPIO *hd;
|
||||
register int nsz;
|
||||
@ -1102,13 +981,8 @@ bcpio_rd(arcn, buf)
|
||||
* size of trailer header in this format
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
off_t
|
||||
bcpio_endrd(void)
|
||||
#else
|
||||
off_t
|
||||
bcpio_endrd()
|
||||
#endif
|
||||
{
|
||||
return((off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER) +
|
||||
(BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER)))));
|
||||
@ -1125,14 +999,8 @@ bcpio_endrd()
|
||||
* data to write after the header, -1 if archive write failed
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
bcpio_wr(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
bcpio_wr(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register HD_BCPIO *hd;
|
||||
register int nsz;
|
||||
|
283
bin/pax/extern.h
283
bin/pax/extern.h
@ -49,27 +49,27 @@
|
||||
*/
|
||||
extern char *arcname;
|
||||
extern const char *gzip_program;
|
||||
int ar_open __P((char *));
|
||||
void ar_close __P((void));
|
||||
void ar_drain __P((void));
|
||||
int ar_set_wr __P((void));
|
||||
int ar_app_ok __P((void));
|
||||
int ar_read __P((register char *, register int));
|
||||
int ar_write __P((register char *, register int));
|
||||
int ar_rdsync __P((void));
|
||||
int ar_fow __P((off_t, off_t *));
|
||||
int ar_rev __P((off_t ));
|
||||
int ar_next __P((void));
|
||||
int ar_open(char *);
|
||||
void ar_close(void);
|
||||
void ar_drain(void);
|
||||
int ar_set_wr(void);
|
||||
int ar_app_ok(void);
|
||||
int ar_read(char *, int);
|
||||
int ar_write(char *, int);
|
||||
int ar_rdsync(void);
|
||||
int ar_fow(off_t, off_t *);
|
||||
int ar_rev(off_t );
|
||||
int ar_next(void);
|
||||
|
||||
/*
|
||||
* ar_subs.c
|
||||
*/
|
||||
extern u_long flcnt;
|
||||
void list __P((void));
|
||||
void extract __P((void));
|
||||
void append __P((void));
|
||||
void archive __P((void));
|
||||
void copy __P((void));
|
||||
void list(void);
|
||||
void extract(void);
|
||||
void append(void);
|
||||
void archive(void);
|
||||
void copy(void);
|
||||
|
||||
/*
|
||||
* buf_subs.c
|
||||
@ -81,126 +81,126 @@ extern int rdblksz;
|
||||
extern off_t wrlimit;
|
||||
extern off_t rdcnt;
|
||||
extern off_t wrcnt;
|
||||
int wr_start __P((void));
|
||||
int rd_start __P((void));
|
||||
void cp_start __P((void));
|
||||
int appnd_start __P((off_t));
|
||||
int rd_sync __P((void));
|
||||
void pback __P((char *, int));
|
||||
int rd_skip __P((off_t));
|
||||
void wr_fin __P((void));
|
||||
int wr_rdbuf __P((register char *, register int));
|
||||
int rd_wrbuf __P((register char *, register int));
|
||||
int wr_skip __P((off_t));
|
||||
int wr_rdfile __P((ARCHD *, int, off_t *));
|
||||
int rd_wrfile __P((ARCHD *, int, off_t *));
|
||||
void cp_file __P((ARCHD *, int, int));
|
||||
int buf_fill __P((void));
|
||||
int buf_flush __P((register int));
|
||||
int wr_start(void);
|
||||
int rd_start(void);
|
||||
void cp_start(void);
|
||||
int appnd_start(off_t);
|
||||
int rd_sync(void);
|
||||
void pback(char *, int);
|
||||
int rd_skip(off_t);
|
||||
void wr_fin(void);
|
||||
int wr_rdbuf(char *, int);
|
||||
int rd_wrbuf(char *, int);
|
||||
int wr_skip(off_t);
|
||||
int wr_rdfile(ARCHD *, int, off_t *);
|
||||
int rd_wrfile(ARCHD *, int, off_t *);
|
||||
void cp_file(ARCHD *, int, int);
|
||||
int buf_fill(void);
|
||||
int buf_flush(int);
|
||||
|
||||
/*
|
||||
* cache.c
|
||||
*/
|
||||
int uidtb_start __P((void));
|
||||
int gidtb_start __P((void));
|
||||
int usrtb_start __P((void));
|
||||
int grptb_start __P((void));
|
||||
char * name_uid __P((uid_t, int));
|
||||
char * name_gid __P((gid_t, int));
|
||||
int uid_name __P((char *, uid_t *));
|
||||
int gid_name __P((char *, gid_t *));
|
||||
int uidtb_start(void);
|
||||
int gidtb_start(void);
|
||||
int usrtb_start(void);
|
||||
int grptb_start(void);
|
||||
char * name_uid(uid_t, int);
|
||||
char * name_gid(gid_t, int);
|
||||
int uid_name(char *, uid_t *);
|
||||
int gid_name(char *, gid_t *);
|
||||
|
||||
/*
|
||||
* cpio.c
|
||||
*/
|
||||
int cpio_strd __P((void));
|
||||
int cpio_trail __P((register ARCHD *));
|
||||
int cpio_endwr __P((void));
|
||||
int cpio_id __P((char *, int));
|
||||
int cpio_rd __P((register ARCHD *, register char *));
|
||||
off_t cpio_endrd __P((void));
|
||||
int cpio_stwr __P((void));
|
||||
int cpio_wr __P((register ARCHD *));
|
||||
int vcpio_id __P((char *, int));
|
||||
int crc_id __P((char *, int));
|
||||
int crc_strd __P((void));
|
||||
int vcpio_rd __P((register ARCHD *, register char *));
|
||||
off_t vcpio_endrd __P((void));
|
||||
int crc_stwr __P((void));
|
||||
int vcpio_wr __P((register ARCHD *));
|
||||
int bcpio_id __P((char *, int));
|
||||
int bcpio_rd __P((register ARCHD *, register char *));
|
||||
off_t bcpio_endrd __P((void));
|
||||
int bcpio_wr __P((register ARCHD *));
|
||||
int cpio_strd(void);
|
||||
int cpio_trail(ARCHD *);
|
||||
int cpio_endwr(void);
|
||||
int cpio_id(char *, int);
|
||||
int cpio_rd(ARCHD *, char *);
|
||||
off_t cpio_endrd(void);
|
||||
int cpio_stwr(void);
|
||||
int cpio_wr(ARCHD *);
|
||||
int vcpio_id(char *, int);
|
||||
int crc_id(char *, int);
|
||||
int crc_strd(void);
|
||||
int vcpio_rd(ARCHD *, char *);
|
||||
off_t vcpio_endrd(void);
|
||||
int crc_stwr(void);
|
||||
int vcpio_wr(ARCHD *);
|
||||
int bcpio_id(char *, int);
|
||||
int bcpio_rd(ARCHD *, char *);
|
||||
off_t bcpio_endrd(void);
|
||||
int bcpio_wr(ARCHD *);
|
||||
|
||||
/*
|
||||
* file_subs.c
|
||||
*/
|
||||
int file_creat __P((register ARCHD *));
|
||||
void file_close __P((register ARCHD *, int));
|
||||
int lnk_creat __P((register ARCHD *));
|
||||
int cross_lnk __P((register ARCHD *));
|
||||
int chk_same __P((register ARCHD *));
|
||||
int node_creat __P((register ARCHD *));
|
||||
int unlnk_exist __P((register char *, register int));
|
||||
int chk_path __P((register char *, uid_t, gid_t));
|
||||
void set_ftime __P((char *fnm, time_t mtime, time_t atime, int frc));
|
||||
int set_ids __P((char *, uid_t, gid_t));
|
||||
int set_lids __P((char *, uid_t, gid_t));
|
||||
void set_pmode __P((char *, mode_t));
|
||||
int file_write __P((int, char *, register int, int *, int *, int, char *));
|
||||
void file_flush __P((int, char *, int));
|
||||
void rdfile_close __P((register ARCHD *, register int *));
|
||||
int set_crc __P((register ARCHD *, register int));
|
||||
int file_creat(ARCHD *);
|
||||
void file_close(ARCHD *, int);
|
||||
int lnk_creat(ARCHD *);
|
||||
int cross_lnk(ARCHD *);
|
||||
int chk_same(ARCHD *);
|
||||
int node_creat(ARCHD *);
|
||||
int unlnk_exist(char *, int);
|
||||
int chk_path(char *, uid_t, gid_t);
|
||||
void set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
|
||||
int set_ids(char *, uid_t, gid_t);
|
||||
int set_lids(char *, uid_t, gid_t);
|
||||
void set_pmode(char *, mode_t);
|
||||
int file_write(int, char *, int, int *, int *, int, char *);
|
||||
void file_flush(int, char *, int);
|
||||
void rdfile_close(ARCHD *, int *);
|
||||
int set_crc(ARCHD *, int);
|
||||
|
||||
/*
|
||||
* ftree.c
|
||||
*/
|
||||
int ftree_start __P((void));
|
||||
int ftree_add __P((register char *, int));
|
||||
void ftree_sel __P((register ARCHD *));
|
||||
void ftree_chk __P((void));
|
||||
int next_file __P((register ARCHD *));
|
||||
int ftree_start(void);
|
||||
int ftree_add(char *, int);
|
||||
void ftree_sel(ARCHD *);
|
||||
void ftree_chk(void);
|
||||
int next_file(ARCHD *);
|
||||
|
||||
/*
|
||||
* gen_subs.c
|
||||
*/
|
||||
void ls_list __P((register ARCHD *, time_t, FILE *));
|
||||
void ls_tty __P((register ARCHD *));
|
||||
int l_strncpy __P((register char *, register char *, int));
|
||||
u_long asc_ul __P((register char *, int, register int));
|
||||
int ul_asc __P((u_long, register char *, register int, register int));
|
||||
void ls_list(ARCHD *, time_t, FILE *);
|
||||
void ls_tty(ARCHD *);
|
||||
int l_strncpy(char *, char *, int);
|
||||
u_long asc_ul(char *, int, int);
|
||||
int ul_asc(u_long, char *, int, int);
|
||||
#ifndef NET2_STAT
|
||||
u_quad_t asc_uqd __P((register char *, int, register int));
|
||||
int uqd_asc __P((u_quad_t, register char *, register int, register int));
|
||||
u_quad_t asc_uqd(char *, int, int);
|
||||
int uqd_asc(u_quad_t, char *, int, int);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* getoldopt.c
|
||||
*/
|
||||
int getoldopt __P((int, char **, char *));
|
||||
int getoldopt(int, char **, char *);
|
||||
|
||||
/*
|
||||
* options.c
|
||||
*/
|
||||
extern FSUB fsub[];
|
||||
extern int ford[];
|
||||
void options __P((register int, register char **));
|
||||
OPLIST * opt_next __P((void));
|
||||
int opt_add __P((register char *));
|
||||
int bad_opt __P((void));
|
||||
void options(int, char **);
|
||||
OPLIST * opt_next(void);
|
||||
int opt_add(char *);
|
||||
int bad_opt(void);
|
||||
char *chdname;
|
||||
|
||||
/*
|
||||
* pat_rep.c
|
||||
*/
|
||||
int rep_add __P((register char *));
|
||||
int pat_add __P((char *, char *));
|
||||
void pat_chk __P((void));
|
||||
int pat_sel __P((register ARCHD *));
|
||||
int pat_match __P((register ARCHD *));
|
||||
int mod_name __P((register ARCHD *));
|
||||
int set_dest __P((register ARCHD *, char *, int));
|
||||
int rep_add(char *);
|
||||
int pat_add(char *, char *);
|
||||
void pat_chk(void);
|
||||
int pat_sel(ARCHD *);
|
||||
int pat_match(ARCHD *);
|
||||
int mod_name(ARCHD *);
|
||||
int set_dest(ARCHD *, char *, int);
|
||||
|
||||
/*
|
||||
* pax.c
|
||||
@ -238,62 +238,61 @@ extern FILE *listf;
|
||||
extern char *tempfile;
|
||||
extern char *tempbase;
|
||||
|
||||
int main __P((int, char **));
|
||||
void sig_cleanup __P((int));
|
||||
void sig_cleanup(int);
|
||||
|
||||
/*
|
||||
* sel_subs.c
|
||||
*/
|
||||
int sel_chk __P((register ARCHD *));
|
||||
int grp_add __P((register char *));
|
||||
int usr_add __P((register char *));
|
||||
int trng_add __P((register char *));
|
||||
int sel_chk(ARCHD *);
|
||||
int grp_add(char *);
|
||||
int usr_add(char *);
|
||||
int trng_add(char *);
|
||||
|
||||
/*
|
||||
* tables.c
|
||||
*/
|
||||
int lnk_start __P((void));
|
||||
int chk_lnk __P((register ARCHD *));
|
||||
void purg_lnk __P((register ARCHD *));
|
||||
void lnk_end __P((void));
|
||||
int ftime_start __P((void));
|
||||
int chk_ftime __P((register ARCHD *));
|
||||
int name_start __P((void));
|
||||
int add_name __P((register char *, int, char *));
|
||||
void sub_name __P((register char *, int *, size_t));
|
||||
int dev_start __P((void));
|
||||
int add_dev __P((register ARCHD *));
|
||||
int map_dev __P((register ARCHD *, u_long, u_long));
|
||||
int atdir_start __P((void));
|
||||
void atdir_end __P((void));
|
||||
void add_atdir __P((char *, dev_t, ino_t, time_t, time_t));
|
||||
int get_atdir __P((dev_t, ino_t, time_t *, time_t *));
|
||||
int dir_start __P((void));
|
||||
void add_dir __P((char *, int, struct stat *, int));
|
||||
void proc_dir __P((void));
|
||||
u_int st_hash __P((char *, int, int));
|
||||
int lnk_start(void);
|
||||
int chk_lnk(ARCHD *);
|
||||
void purg_lnk(ARCHD *);
|
||||
void lnk_end(void);
|
||||
int ftime_start(void);
|
||||
int chk_ftime(ARCHD *);
|
||||
int name_start(void);
|
||||
int add_name(char *, int, char *);
|
||||
void sub_name(char *, int *, size_t);
|
||||
int dev_start(void);
|
||||
int add_dev(ARCHD *);
|
||||
int map_dev(ARCHD *, u_long, u_long);
|
||||
int atdir_start(void);
|
||||
void atdir_end(void);
|
||||
void add_atdir(char *, dev_t, ino_t, time_t, time_t);
|
||||
int get_atdir(dev_t, ino_t, time_t *, time_t *);
|
||||
int dir_start(void);
|
||||
void add_dir(char *, int, struct stat *, int);
|
||||
void proc_dir(void);
|
||||
u_int st_hash(char *, int, int);
|
||||
|
||||
/*
|
||||
* tar.c
|
||||
*/
|
||||
int tar_endwr __P((void));
|
||||
off_t tar_endrd __P((void));
|
||||
int tar_trail __P((register char *, register int, register int *));
|
||||
int tar_id __P((register char *, int));
|
||||
int tar_opt __P((void));
|
||||
int tar_rd __P((register ARCHD *, register char *));
|
||||
int tar_wr __P((register ARCHD *));
|
||||
int ustar_strd __P((void));
|
||||
int ustar_stwr __P((void));
|
||||
int ustar_id __P((char *, int));
|
||||
int ustar_rd __P((register ARCHD *, register char *));
|
||||
int ustar_wr __P((register ARCHD *));
|
||||
int tar_endwr(void);
|
||||
off_t tar_endrd(void);
|
||||
int tar_trail(char *, int, int *);
|
||||
int tar_id(char *, int);
|
||||
int tar_opt(void);
|
||||
int tar_rd(ARCHD *, char *);
|
||||
int tar_wr(ARCHD *);
|
||||
int ustar_strd(void);
|
||||
int ustar_stwr(void);
|
||||
int ustar_id(char *, int);
|
||||
int ustar_rd(ARCHD *, char *);
|
||||
int ustar_wr(ARCHD *);
|
||||
|
||||
/*
|
||||
* tty_subs.c
|
||||
*/
|
||||
int tty_init __P((void));
|
||||
void tty_prnt __P((const char *, ...)) __printflike(1, 2);
|
||||
int tty_read __P((char *, int));
|
||||
void paxwarn __P((int, const char *, ...)) __printflike(2, 3);
|
||||
void syswarn __P((int, int, const char *, ...)) __printflike(3, 4);
|
||||
int tty_init(void);
|
||||
void tty_prnt(const char *, ...) __printflike(1, 2);
|
||||
int tty_read(char *, int);
|
||||
void paxwarn(int, const char *, ...) __printflike(2, 3);
|
||||
void syswarn(int, int, const char *, ...) __printflike(3, 4);
|
||||
|
@ -58,7 +58,7 @@ static const char rcsid[] =
|
||||
#include "extern.h"
|
||||
|
||||
static int
|
||||
mk_link __P((register char *,register struct stat *,register char *, int));
|
||||
mk_link(register char *,register struct stat *,register char *, int);
|
||||
|
||||
/*
|
||||
* routines that deal with file operations such as: creating, removing;
|
||||
@ -76,14 +76,8 @@ mk_link __P((register char *,register struct stat *,register char *, int));
|
||||
* file descriptor or -1 for failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
file_creat(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
file_creat(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
int fd = -1;
|
||||
mode_t file_mode;
|
||||
@ -139,15 +133,8 @@ file_creat(arcn)
|
||||
* 0 for success, -1 for failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
file_close(register ARCHD *arcn, int fd)
|
||||
#else
|
||||
void
|
||||
file_close(arcn, fd)
|
||||
register ARCHD *arcn;
|
||||
int fd;
|
||||
#endif
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
@ -186,14 +173,8 @@ file_close(arcn, fd)
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
lnk_creat(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
lnk_creat(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
@ -226,14 +207,8 @@ lnk_creat(arcn)
|
||||
* 0 if cross_lnk() ok, -1 for fatal flaw (like linking to self).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
cross_lnk(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
cross_lnk(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* try to make a link to original file (-l flag in copy mode). make sure
|
||||
@ -256,14 +231,8 @@ cross_lnk(arcn)
|
||||
* 0 skip it file exists (-k) or may be the same as source file
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
chk_same(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
chk_same(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
@ -299,18 +268,9 @@ chk_same(arcn)
|
||||
* allowed option). -1 an error occurred.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
mk_link(register char *to, register struct stat *to_sb, register char *from,
|
||||
int ign)
|
||||
#else
|
||||
static int
|
||||
mk_link(to, to_sb, from, ign)
|
||||
register char *to;
|
||||
register struct stat *to_sb;
|
||||
register char *from;
|
||||
int ign;
|
||||
#endif
|
||||
{
|
||||
struct stat sb;
|
||||
int oerrno;
|
||||
@ -381,14 +341,8 @@ mk_link(to, to_sb, from, ign)
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
node_creat(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
node_creat(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register int res;
|
||||
register int ign = 0;
|
||||
@ -551,15 +505,8 @@ node_creat(arcn)
|
||||
* 1 we found a directory and we were going to create a directory.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
unlnk_exist(register char *name, register int type)
|
||||
#else
|
||||
int
|
||||
unlnk_exist(name, type)
|
||||
register char *name;
|
||||
register int type;
|
||||
#endif
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
@ -609,16 +556,8 @@ unlnk_exist(name, type)
|
||||
* 0 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
chk_path( register char *name, uid_t st_uid, gid_t st_gid)
|
||||
#else
|
||||
int
|
||||
chk_path(name, st_uid, st_gid)
|
||||
register char *name;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
#endif
|
||||
{
|
||||
register char *spt = name;
|
||||
struct stat sb;
|
||||
@ -701,17 +640,8 @@ chk_path(name, st_uid, st_gid)
|
||||
* not set request.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
set_ftime(char *fnm, time_t mtime, time_t atime, int frc)
|
||||
#else
|
||||
void
|
||||
set_ftime(fnm, mtime, atime, frc)
|
||||
char *fnm;
|
||||
time_t mtime;
|
||||
time_t atime;
|
||||
int frc;
|
||||
#endif
|
||||
{
|
||||
static struct timeval tv[2] = {{0L, 0L}, {0L, 0L}};
|
||||
struct stat sb;
|
||||
@ -748,16 +678,8 @@ set_ftime(fnm, mtime, atime, frc)
|
||||
* 0 when set, -1 on failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
set_ids(char *fnm, uid_t uid, gid_t gid)
|
||||
#else
|
||||
int
|
||||
set_ids(fnm, uid, gid)
|
||||
char *fnm;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
#endif
|
||||
{
|
||||
if (chown(fnm, uid, gid) < 0) {
|
||||
/*
|
||||
@ -780,16 +702,8 @@ set_ids(fnm, uid, gid)
|
||||
* 0 when set, -1 on failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
set_lids(char *fnm, uid_t uid, gid_t gid)
|
||||
#else
|
||||
int
|
||||
set_lids(fnm, uid, gid)
|
||||
char *fnm;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
#endif
|
||||
{
|
||||
if (lchown(fnm, uid, gid) < 0) {
|
||||
/*
|
||||
@ -810,15 +724,8 @@ set_lids(fnm, uid, gid)
|
||||
* Set file access mode
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
set_pmode(char *fnm, mode_t mode)
|
||||
#else
|
||||
void
|
||||
set_pmode(fnm, mode)
|
||||
char *fnm;
|
||||
mode_t mode;
|
||||
#endif
|
||||
{
|
||||
mode &= ABITS;
|
||||
if (chmod(fnm, mode) < 0)
|
||||
@ -874,21 +781,9 @@ set_pmode(fnm, mode)
|
||||
* number of bytes written, -1 on write (or lseek) error.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
file_write(int fd, char *str, register int cnt, int *rem, int *isempt, int sz,
|
||||
char *name)
|
||||
#else
|
||||
int
|
||||
file_write(fd, str, cnt, rem, isempt, sz, name)
|
||||
int fd;
|
||||
char *str;
|
||||
register int cnt;
|
||||
int *rem;
|
||||
int *isempt;
|
||||
int sz;
|
||||
char *name;
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
register char *end;
|
||||
@ -967,16 +862,8 @@ file_write(fd, str, cnt, rem, isempt, sz, name)
|
||||
* write the last BYTE with a zero (back up one byte and write a zero).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
file_flush(int fd, char *fname, int isempt)
|
||||
#else
|
||||
void
|
||||
file_flush(fd, fname, isempt)
|
||||
int fd;
|
||||
char *fname;
|
||||
int isempt;
|
||||
#endif
|
||||
{
|
||||
static char blnk[] = "\0";
|
||||
|
||||
@ -1006,15 +893,8 @@ file_flush(fd, fname, isempt)
|
||||
* reset access time (tflag) do so (the times are stored in arcn).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
rdfile_close(register ARCHD *arcn, register int *fd)
|
||||
#else
|
||||
void
|
||||
rdfile_close(arcn, fd)
|
||||
register ARCHD *arcn;
|
||||
register int *fd;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* make sure the file is open
|
||||
@ -1043,15 +923,8 @@ rdfile_close(arcn, fd)
|
||||
* 0 if was able to calculate the crc, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
set_crc(register ARCHD *arcn, register int fd)
|
||||
#else
|
||||
int
|
||||
set_crc(arcn, fd)
|
||||
register ARCHD *arcn;
|
||||
register int fd;
|
||||
#endif
|
||||
{
|
||||
register int i;
|
||||
register int res;
|
||||
|
@ -79,7 +79,7 @@ static FTREE *ftcur = NULL; /* current file arg being processed */
|
||||
static FTSENT *ftent = NULL; /* current file tree entry */
|
||||
static int ftree_skip; /* when set skip to next file arg */
|
||||
|
||||
static int ftree_arg __P((void));
|
||||
static int ftree_arg(void);
|
||||
|
||||
/*
|
||||
* ftree_start()
|
||||
@ -91,13 +91,8 @@ static int ftree_arg __P((void));
|
||||
* 0 if there is at least one valid file arg to process, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ftree_start(void)
|
||||
#else
|
||||
int
|
||||
ftree_start()
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* set up the operation mode of fts, open the first file arg. We must
|
||||
@ -150,15 +145,8 @@ ftree_start()
|
||||
* 0 if added to the linked list, -1 if failed
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ftree_add(register char *str, int chflg)
|
||||
#else
|
||||
int
|
||||
ftree_add(str, chflg)
|
||||
register char *str;
|
||||
int chflg;
|
||||
#endif
|
||||
{
|
||||
register FTREE *ft;
|
||||
register int len;
|
||||
@ -202,14 +190,8 @@ ftree_add(str, chflg)
|
||||
* -n and -d processing.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
ftree_sel(register ARCHD *arcn)
|
||||
#else
|
||||
void
|
||||
ftree_sel(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* set reference bit for this pattern. This linked list is only used
|
||||
@ -241,13 +223,8 @@ ftree_sel(arcn)
|
||||
* have a selected member (reference count still 0)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
ftree_chk(void)
|
||||
#else
|
||||
void
|
||||
ftree_chk()
|
||||
#endif
|
||||
{
|
||||
register FTREE *ft;
|
||||
register int wban = 0;
|
||||
@ -283,13 +260,8 @@ ftree_chk()
|
||||
* stdin).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
ftree_arg(void)
|
||||
#else
|
||||
static int
|
||||
ftree_arg()
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
|
||||
@ -362,14 +334,8 @@ ftree_arg()
|
||||
* 0 when contents of arcn have been set with the next file, -1 when done.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
next_file(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
next_file(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register int cnt;
|
||||
time_t atime;
|
||||
|
@ -81,16 +81,8 @@ static int d_first = -1;
|
||||
* list the members of an archive in ls format
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
ls_list(register ARCHD *arcn, time_t now, FILE *fp)
|
||||
#else
|
||||
void
|
||||
ls_list(arcn, now, fp)
|
||||
register ARCHD *arcn;
|
||||
time_t now;
|
||||
FILE *fp;
|
||||
#endif
|
||||
{
|
||||
register struct stat *sbp;
|
||||
char f_mode[MODELEN];
|
||||
@ -169,14 +161,8 @@ ls_list(arcn, now, fp)
|
||||
* print a short summary of file to tty.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
ls_tty(register ARCHD *arcn)
|
||||
#else
|
||||
void
|
||||
ls_tty(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
char f_date[DATELEN];
|
||||
char f_mode[MODELEN];
|
||||
@ -210,16 +196,8 @@ ls_tty(arcn)
|
||||
* doing a strncpy(), a strlen(), and then a possible memset())
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
l_strncpy(register char *dest, register char *src, int len)
|
||||
#else
|
||||
int
|
||||
l_strncpy(dest, src, len)
|
||||
register char *dest;
|
||||
register char *src;
|
||||
int len;
|
||||
#endif
|
||||
{
|
||||
register char *stop;
|
||||
register char *start;
|
||||
@ -244,16 +222,8 @@ l_strncpy(dest, src, len)
|
||||
* unsigned long value
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
u_long
|
||||
asc_ul(register char *str, int len, register int base)
|
||||
#else
|
||||
u_long
|
||||
asc_ul(str, len, base)
|
||||
register char *str;
|
||||
int len;
|
||||
register int base;
|
||||
#endif
|
||||
{
|
||||
register char *stop;
|
||||
u_long tval = 0;
|
||||
@ -295,17 +265,8 @@ asc_ul(str, len, base)
|
||||
* NOTE: the string created is NOT TERMINATED.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ul_asc(u_long val, register char *str, register int len, register int base)
|
||||
#else
|
||||
int
|
||||
ul_asc(val, str, len, base)
|
||||
u_long val;
|
||||
register char *str;
|
||||
register int len;
|
||||
register int base;
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
u_long digit;
|
||||
@ -358,16 +319,8 @@ ul_asc(val, str, len, base)
|
||||
* u_quad_t value
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
u_quad_t
|
||||
asc_uqd(register char *str, int len, register int base)
|
||||
#else
|
||||
u_quad_t
|
||||
asc_uqd(str, len, base)
|
||||
register char *str;
|
||||
int len;
|
||||
register int base;
|
||||
#endif
|
||||
{
|
||||
register char *stop;
|
||||
u_quad_t tval = 0;
|
||||
@ -409,17 +362,8 @@ asc_uqd(str, len, base)
|
||||
* NOTE: the string created is NOT TERMINATED.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
uqd_asc(u_quad_t val, register char *str, register int len, register int base)
|
||||
#else
|
||||
int
|
||||
uqd_asc(val, str, len, base)
|
||||
u_quad_t val;
|
||||
register char *str;
|
||||
register int len;
|
||||
register int base;
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
u_quad_t digit;
|
||||
|
@ -19,10 +19,7 @@ static const char rcsid[] = "$FreeBSD$";
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
getoldopt(argc, argv, optstring)
|
||||
int argc;
|
||||
char **argv;
|
||||
char *optstring;
|
||||
getoldopt(int argc, char **argv, char *optstring)
|
||||
{
|
||||
static char *key; /* Points to next keyletter */
|
||||
static char use_getopt; /* !=0 if argv[1][0] was '-' */
|
||||
|
@ -67,17 +67,17 @@ static char flgch[] = FLGCH; /* list of all possible flags */
|
||||
static OPLIST *ophead = NULL; /* head for format specific options -x */
|
||||
static OPLIST *optail = NULL; /* option tail */
|
||||
|
||||
static int no_op __P((void));
|
||||
static void printflg __P((unsigned int));
|
||||
static int c_frmt __P((const void *, const void *));
|
||||
static off_t str_offt __P((char *));
|
||||
static char *getline __P((FILE *fp));
|
||||
static void pax_options __P((register int, register char **));
|
||||
static void pax_usage __P((void));
|
||||
static void tar_options __P((register int, register char **));
|
||||
static void tar_usage __P((void));
|
||||
static void cpio_options __P((register int, register char **));
|
||||
static void cpio_usage __P((void));
|
||||
static int no_op(void);
|
||||
static void printflg(unsigned int);
|
||||
static int c_frmt(const void *, const void *);
|
||||
static off_t str_offt(char *);
|
||||
static char *getline(FILE *fp);
|
||||
static void pax_options(register int, register char **);
|
||||
static void pax_usage(void);
|
||||
static void tar_options(register int, register char **);
|
||||
static void tar_usage(void);
|
||||
static void cpio_options(register int, register char **);
|
||||
static void cpio_usage(void);
|
||||
|
||||
/* errors from getline */
|
||||
#define GETLINE_FILE_CORRUPT 1
|
||||
@ -149,15 +149,8 @@ int ford[] = {5, 4, 3, 2, 1, 0, -1 };
|
||||
* parser
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
options(register int argc, register char **argv)
|
||||
#else
|
||||
void
|
||||
options(argc, argv)
|
||||
register int argc;
|
||||
register char **argv;
|
||||
#endif
|
||||
{
|
||||
|
||||
/*
|
||||
@ -185,15 +178,8 @@ options(argc, argv)
|
||||
* the user specified a legal set of flags. If not, complain and exit
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static void
|
||||
pax_options(register int argc, register char **argv)
|
||||
#else
|
||||
static void
|
||||
pax_options(argc, argv)
|
||||
register int argc;
|
||||
register char **argv;
|
||||
#endif
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
@ -590,15 +576,8 @@ pax_options(argc, argv)
|
||||
* the user specified a legal set of flags. If not, complain and exit
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static void
|
||||
tar_options(register int argc, register char **argv)
|
||||
#else
|
||||
static void
|
||||
tar_options(argc, argv)
|
||||
register int argc;
|
||||
register char **argv;
|
||||
#endif
|
||||
{
|
||||
register int c;
|
||||
int fstdin = 0;
|
||||
@ -1029,15 +1008,8 @@ mkpath(path)
|
||||
* the user specified a legal set of flags. If not, complain and exit
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static void
|
||||
cpio_options(register int argc, register char **argv)
|
||||
#else
|
||||
static void
|
||||
cpio_options(argc, argv)
|
||||
register int argc;
|
||||
register char **argv;
|
||||
#endif
|
||||
{
|
||||
register int c, i;
|
||||
char *str;
|
||||
@ -1296,14 +1268,8 @@ cpio_options(argc, argv)
|
||||
* print out those invalid flag sets found to the user
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static void
|
||||
printflg(unsigned int flg)
|
||||
#else
|
||||
static void
|
||||
printflg(flg)
|
||||
unsigned int flg;
|
||||
#endif
|
||||
{
|
||||
int nxt;
|
||||
int pos = 0;
|
||||
@ -1323,15 +1289,8 @@ printflg(flg)
|
||||
* by the user
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
c_frmt(const void *a, const void *b)
|
||||
#else
|
||||
static int
|
||||
c_frmt(a, b)
|
||||
void *a;
|
||||
void *b;
|
||||
#endif
|
||||
{
|
||||
return(strcmp(((FSUB *)a)->name, ((FSUB *)b)->name));
|
||||
}
|
||||
@ -1344,13 +1303,8 @@ c_frmt(a, b)
|
||||
* pointer to next OPLIST entry or NULL (end of list).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
OPLIST *
|
||||
opt_next(void)
|
||||
#else
|
||||
OPLIST *
|
||||
opt_next()
|
||||
#endif
|
||||
{
|
||||
OPLIST *opt;
|
||||
|
||||
@ -1365,13 +1319,8 @@ opt_next()
|
||||
* when the format does not support options.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
bad_opt(void)
|
||||
#else
|
||||
int
|
||||
bad_opt()
|
||||
#endif
|
||||
{
|
||||
register OPLIST *opt;
|
||||
|
||||
@ -1396,14 +1345,8 @@ bad_opt()
|
||||
* 0 if format in name=value format, -1 if -o is passed junk
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
opt_add(register char *str)
|
||||
#else
|
||||
int
|
||||
opt_add(str)
|
||||
register char *str;
|
||||
#endif
|
||||
{
|
||||
register OPLIST *opt;
|
||||
register char *frpt;
|
||||
@ -1471,14 +1414,8 @@ opt_add(str)
|
||||
* 0 for an error, a positive value o.w.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static off_t
|
||||
str_offt(char *val)
|
||||
#else
|
||||
static off_t
|
||||
str_offt(val)
|
||||
char *val;
|
||||
#endif
|
||||
{
|
||||
char *expr;
|
||||
off_t num, t;
|
||||
@ -1539,14 +1476,8 @@ str_offt(val)
|
||||
return(num);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
char *
|
||||
getline(FILE *f)
|
||||
#else
|
||||
char *
|
||||
getline(f)
|
||||
FILE *f;
|
||||
#endif
|
||||
{
|
||||
char *name, *temp;
|
||||
size_t len;
|
||||
@ -1575,13 +1506,8 @@ getline(f)
|
||||
* 0
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
no_op(void)
|
||||
#else
|
||||
static int
|
||||
no_op()
|
||||
#endif
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@ -1591,13 +1517,8 @@ no_op()
|
||||
* print the usage summary to the user
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
pax_usage(void)
|
||||
#else
|
||||
void
|
||||
pax_usage()
|
||||
#endif
|
||||
{
|
||||
(void)fputs("usage: pax [-cdnvz] [-E limit] [-f archive] ", stderr);
|
||||
(void)fputs("[-s replstr] ... [-U user] ...", stderr);
|
||||
@ -1630,13 +1551,8 @@ pax_usage()
|
||||
* print the usage summary to the user
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
tar_usage(void)
|
||||
#else
|
||||
void
|
||||
tar_usage()
|
||||
#endif
|
||||
{
|
||||
(void)fputs("usage: tar [-]{crtux}[-befhjmopqsvwyzHLOPXZ014578] [blocksize] ",
|
||||
stderr);
|
||||
@ -1650,13 +1566,8 @@ tar_usage()
|
||||
* print the usage summary to the user
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
cpio_usage(void)
|
||||
#else
|
||||
void
|
||||
cpio_usage()
|
||||
#endif
|
||||
{
|
||||
(void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr);
|
||||
(void)fputs(" [-F archive] < name-list [> archive]\n", stderr);
|
||||
|
@ -72,15 +72,15 @@ static PATTERN *pattail = NULL; /* file pattern match list tail */
|
||||
static REPLACE *rephead = NULL; /* replacement string list head */
|
||||
static REPLACE *reptail = NULL; /* replacement string list tail */
|
||||
|
||||
static int rep_name __P((char *, int *, int));
|
||||
static int tty_rename __P((register ARCHD *));
|
||||
static int fix_path __P((char *, int *, char *, int));
|
||||
static int fn_match __P((register char *, register char *, char **));
|
||||
static char * range_match __P((register char *, register int));
|
||||
static int rep_name(char *, int *, int);
|
||||
static int tty_rename(register ARCHD *);
|
||||
static int fix_path(char *, int *, char *, int);
|
||||
static int fn_match(register char *, register char *, char **);
|
||||
static char * range_match(register char *, register int);
|
||||
#ifdef NET2_REGEX
|
||||
static int resub __P((regexp *, char *, char *, register char *));
|
||||
static int resub(regexp *, char *, char *, register char *);
|
||||
#else
|
||||
static int resub __P((regex_t *, regmatch_t *, char *, char *, char *));
|
||||
static int resub(regex_t *, regmatch_t *, char *, char *, char *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -99,14 +99,8 @@ static int resub __P((regex_t *, regmatch_t *, char *, char *, char *));
|
||||
* the list of replacement patterns; -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
rep_add(register char *str)
|
||||
#else
|
||||
int
|
||||
rep_add(str)
|
||||
register char *str;
|
||||
#endif
|
||||
{
|
||||
register char *pt1;
|
||||
register char *pt2;
|
||||
@ -227,15 +221,8 @@ rep_add(str)
|
||||
* 0 if the pattern was added to the list, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
pat_add(char *str, char *chdname)
|
||||
#else
|
||||
int
|
||||
pat_add(str, chdname)
|
||||
char *str;
|
||||
char *chdname;
|
||||
#endif
|
||||
{
|
||||
register PATTERN *pt;
|
||||
|
||||
@ -279,13 +266,8 @@ pat_add(str, chdname)
|
||||
* a selected archive member.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
pat_chk(void)
|
||||
#else
|
||||
void
|
||||
pat_chk()
|
||||
#endif
|
||||
{
|
||||
register PATTERN *pt;
|
||||
register int wban = 0;
|
||||
@ -321,14 +303,8 @@ pat_chk()
|
||||
* match, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
pat_sel(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
pat_sel(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register PATTERN *pt;
|
||||
register PATTERN **ppt;
|
||||
@ -446,14 +422,8 @@ pat_sel(arcn)
|
||||
* looking for more members)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
pat_match(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
pat_match(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register PATTERN *pt;
|
||||
|
||||
@ -524,16 +494,8 @@ pat_match(arcn)
|
||||
* Note: *pend may be changed to show where the prefix ends.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
fn_match(register char *pattern, register char *string, char **pend)
|
||||
#else
|
||||
static int
|
||||
fn_match(pattern, string, pend)
|
||||
register char *pattern;
|
||||
register char *string;
|
||||
char **pend;
|
||||
#endif
|
||||
{
|
||||
register char c;
|
||||
char test;
|
||||
@ -605,15 +567,8 @@ fn_match(pattern, string, pend)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
static char *
|
||||
range_match(register char *pattern, register int test)
|
||||
#else
|
||||
static char *
|
||||
range_match(pattern, test)
|
||||
register char *pattern;
|
||||
register int test;
|
||||
#endif
|
||||
{
|
||||
register char c;
|
||||
register char c2;
|
||||
@ -655,14 +610,8 @@ range_match(pattern, test)
|
||||
* 0 continue to process file, 1 skip this file, -1 pax is finished
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
mod_name(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
mod_name(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register int res = 0;
|
||||
|
||||
@ -754,14 +703,8 @@ mod_name(arcn)
|
||||
* 0 process this file, 1 skip this file, -1 we need to exit pax
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
tty_rename(register ARCHD *arcn)
|
||||
#else
|
||||
static int
|
||||
tty_rename(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
char tmpname[PAXPATHLEN+2];
|
||||
int res;
|
||||
@ -826,16 +769,8 @@ tty_rename(arcn)
|
||||
* 0 if ok, -1 if failure (name too long)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
set_dest(register ARCHD *arcn, char *dest_dir, int dir_len)
|
||||
#else
|
||||
int
|
||||
set_dest(arcn, dest_dir, dir_len)
|
||||
register ARCHD *arcn;
|
||||
char *dest_dir;
|
||||
int dir_len;
|
||||
#endif
|
||||
{
|
||||
if (fix_path(arcn->name, &(arcn->nlen), dest_dir, dir_len) < 0)
|
||||
return(-1);
|
||||
@ -861,17 +796,8 @@ set_dest(arcn, dest_dir, dir_len)
|
||||
* 0 if ok, -1 if the final name is too long
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
fix_path( char *or_name, int *or_len, char *dir_name, int dir_len)
|
||||
#else
|
||||
static int
|
||||
fix_path(or_name, or_len, dir_name, dir_len)
|
||||
char *or_name;
|
||||
int *or_len;
|
||||
char *dir_name;
|
||||
int dir_len;
|
||||
#endif
|
||||
{
|
||||
register char *src;
|
||||
register char *dest;
|
||||
@ -933,16 +859,8 @@ fix_path(or_name, or_len, dir_name, dir_len)
|
||||
* ended up empty)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
rep_name(char *name, int *nlen, int prnt)
|
||||
#else
|
||||
static int
|
||||
rep_name(name, nlen, prnt)
|
||||
char *name;
|
||||
int *nlen;
|
||||
int prnt;
|
||||
#endif
|
||||
{
|
||||
register REPLACE *pt;
|
||||
register char *inpt;
|
||||
@ -1107,17 +1025,8 @@ rep_name(name, nlen, prnt)
|
||||
* -1 if error, or the number of characters added to the destination.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
resub(regexp *prog, char *src, char *dest, register char *destend)
|
||||
#else
|
||||
static int
|
||||
resub(prog, src, dest, destend)
|
||||
regexp *prog;
|
||||
char *src;
|
||||
char *dest;
|
||||
register char *destend;
|
||||
#endif
|
||||
{
|
||||
register char *spt;
|
||||
register char *dpt;
|
||||
@ -1165,19 +1074,9 @@ resub(prog, src, dest, destend)
|
||||
* -1 if error, or the number of characters added to the destination.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
resub(regex_t *rp, register regmatch_t *pm, char *src, char *dest,
|
||||
register char *destend)
|
||||
#else
|
||||
static int
|
||||
resub(rp, pm, src, dest, destend)
|
||||
regex_t *rp;
|
||||
register regmatch_t *pm;
|
||||
char *src;
|
||||
char *dest;
|
||||
register char *destend;
|
||||
#endif
|
||||
{
|
||||
register char *spt;
|
||||
register char *dpt;
|
||||
|
@ -65,7 +65,7 @@ static const char rcsid[] =
|
||||
#include <unistd.h>
|
||||
#include "pax.h"
|
||||
#include "extern.h"
|
||||
static int gen_init __P((void));
|
||||
static int gen_init(void);
|
||||
|
||||
/*
|
||||
* PAX main routines, general globals and some simple start up routines
|
||||
@ -228,15 +228,8 @@ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
|
||||
* Return: 0 if ok, 1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
#else
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
#endif
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *tmpdir;
|
||||
size_t tdlen;
|
||||
@ -312,14 +305,8 @@ main(argc, argv)
|
||||
* never....
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
sig_cleanup(int which_sig)
|
||||
#else
|
||||
void
|
||||
sig_cleanup(which_sig)
|
||||
int which_sig;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* restore modes and times for any dirs we may have created
|
||||
@ -345,13 +332,8 @@ sig_cleanup(which_sig)
|
||||
* when dealing with a medium to large sized archives.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
gen_init(void)
|
||||
#else
|
||||
static int
|
||||
gen_init()
|
||||
#endif
|
||||
{
|
||||
struct rlimit reslimit;
|
||||
struct sigaction n_hand;
|
||||
|
@ -57,10 +57,10 @@ static const char rcsid[] =
|
||||
#include "sel_subs.h"
|
||||
#include "extern.h"
|
||||
|
||||
static int str_sec __P((register char *, time_t *));
|
||||
static int usr_match __P((register ARCHD *));
|
||||
static int grp_match __P((register ARCHD *));
|
||||
static int trng_match __P((register ARCHD *));
|
||||
static int str_sec(register char *, time_t *);
|
||||
static int usr_match(register ARCHD *);
|
||||
static int grp_match(register ARCHD *);
|
||||
static int trng_match(register ARCHD *);
|
||||
|
||||
static TIME_RNG *trhead = NULL; /* time range list head */
|
||||
static TIME_RNG *trtail = NULL; /* time range list tail */
|
||||
@ -78,14 +78,8 @@ static GRPT **grptb = NULL; /* group selection table */
|
||||
* 0 if this archive member should be processed, 1 if it should be skipped
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
sel_chk(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
sel_chk(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
if (((usrtb != NULL) && usr_match(arcn)) ||
|
||||
((grptb != NULL) && grp_match(arcn)) ||
|
||||
@ -109,14 +103,8 @@ sel_chk(arcn)
|
||||
* 0 if added ok, -1 otherwise;
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
usr_add(register char *str)
|
||||
#else
|
||||
int
|
||||
usr_add(str)
|
||||
register char *str;
|
||||
#endif
|
||||
{
|
||||
register u_int indx;
|
||||
register USRT *pt;
|
||||
@ -188,14 +176,8 @@ usr_add(str)
|
||||
* 0 if this archive member should be processed, 1 if it should be skipped
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
usr_match(register ARCHD *arcn)
|
||||
#else
|
||||
static int
|
||||
usr_match(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register USRT *pt;
|
||||
|
||||
@ -222,14 +204,8 @@ usr_match(arcn)
|
||||
* 0 if added ok, -1 otherwise;
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
grp_add(register char *str)
|
||||
#else
|
||||
int
|
||||
grp_add(str)
|
||||
register char *str;
|
||||
#endif
|
||||
{
|
||||
register u_int indx;
|
||||
register GRPT *pt;
|
||||
@ -301,14 +277,8 @@ grp_add(str)
|
||||
* 0 if this archive member should be processed, 1 if it should be skipped
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
grp_match(register ARCHD *arcn)
|
||||
#else
|
||||
static int
|
||||
grp_match(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register GRPT *pt;
|
||||
|
||||
@ -357,14 +327,8 @@ grp_match(arcn)
|
||||
* 0 if the time range was added to the list, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
trng_add(register char *str)
|
||||
#else
|
||||
int
|
||||
trng_add(str)
|
||||
register char *str;
|
||||
#endif
|
||||
{
|
||||
register TIME_RNG *pt;
|
||||
register char *up_pt = NULL;
|
||||
@ -503,14 +467,8 @@ trng_add(str)
|
||||
* 0 if this archive member should be processed, 1 if it should be skipped
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
trng_match(register ARCHD *arcn)
|
||||
#else
|
||||
static int
|
||||
trng_match(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register TIME_RNG *pt;
|
||||
|
||||
@ -578,15 +536,8 @@ trng_match(arcn)
|
||||
* 0 if converted ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
str_sec(register char *str, time_t *tval)
|
||||
#else
|
||||
static int
|
||||
str_sec(str, tval)
|
||||
register char *str;
|
||||
time_t *tval;
|
||||
#endif
|
||||
{
|
||||
register struct tm *lt;
|
||||
register char *dot = NULL;
|
||||
|
138
bin/pax/tables.c
138
bin/pax/tables.c
@ -80,7 +80,7 @@ static int dirfd = -1; /* storage for setting created dir time/mode */
|
||||
static u_long dircnt; /* entries in dir time/mode storage */
|
||||
static int ffd = -1; /* tmp file for file time table name storage */
|
||||
|
||||
static DEVT *chk_dev __P((dev_t, int));
|
||||
static DEVT *chk_dev(dev_t, int);
|
||||
|
||||
/*
|
||||
* hard link table routines
|
||||
@ -105,13 +105,8 @@ static DEVT *chk_dev __P((dev_t, int));
|
||||
* 0 if created, -1 if failure
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
lnk_start(void)
|
||||
#else
|
||||
int
|
||||
lnk_start()
|
||||
#endif
|
||||
{
|
||||
if (ltab != NULL)
|
||||
return(0);
|
||||
@ -134,14 +129,8 @@ lnk_start()
|
||||
* if found returns 1; if not found returns 0; -1 on error
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
chk_lnk(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
chk_lnk(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register HRDLNK *pt;
|
||||
register HRDLNK **ppt;
|
||||
@ -227,14 +216,8 @@ chk_lnk(arcn)
|
||||
* we do not want to accidently point another file at it later on.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
purg_lnk(register ARCHD *arcn)
|
||||
#else
|
||||
void
|
||||
purg_lnk(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register HRDLNK *pt;
|
||||
register HRDLNK **ppt;
|
||||
@ -287,13 +270,8 @@ purg_lnk(arcn)
|
||||
* write phase
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
lnk_end(void)
|
||||
#else
|
||||
void
|
||||
lnk_end()
|
||||
#endif
|
||||
{
|
||||
register int i;
|
||||
register HRDLNK *pt;
|
||||
@ -352,13 +330,8 @@ lnk_end()
|
||||
* 0 if the table and file was created ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ftime_start(void)
|
||||
#else
|
||||
int
|
||||
ftime_start()
|
||||
#endif
|
||||
{
|
||||
|
||||
if (ftab != NULL)
|
||||
@ -395,14 +368,8 @@ ftime_start()
|
||||
* -1 on error
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
chk_ftime(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
chk_ftime(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register FTM *pt;
|
||||
register int namelen;
|
||||
@ -520,13 +487,8 @@ chk_ftime(arcn)
|
||||
* 0 if successful, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
name_start(void)
|
||||
#else
|
||||
int
|
||||
name_start()
|
||||
#endif
|
||||
{
|
||||
if (ntab != NULL)
|
||||
return(0);
|
||||
@ -546,16 +508,8 @@ name_start()
|
||||
* 0 if added, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
add_name(register char *oname, int onamelen, char *nname)
|
||||
#else
|
||||
int
|
||||
add_name(oname, onamelen, nname)
|
||||
register char *oname;
|
||||
int onamelen;
|
||||
char *nname;
|
||||
#endif
|
||||
{
|
||||
register NAMT *pt;
|
||||
register u_int indx;
|
||||
@ -622,16 +576,8 @@ add_name(oname, onamelen, nname)
|
||||
* new name (oname is the link to name)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
sub_name(register char *oname, int *onamelen, size_t onamesize)
|
||||
#else
|
||||
void
|
||||
sub_name(oname, onamelen, onamesize)
|
||||
register char *oname;
|
||||
int *onamelen;
|
||||
size_t onamesize;
|
||||
#endif
|
||||
{
|
||||
register NAMT *pt;
|
||||
register u_int indx;
|
||||
@ -714,13 +660,8 @@ sub_name(oname, onamelen, onamesize)
|
||||
* 0 if successful, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
dev_start(void)
|
||||
#else
|
||||
int
|
||||
dev_start()
|
||||
#endif
|
||||
{
|
||||
if (dtab != NULL)
|
||||
return(0);
|
||||
@ -741,14 +682,8 @@ dev_start()
|
||||
* 0 if added ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
add_dev(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
add_dev(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
if (chk_dev(arcn->sb.st_dev, 1) == NULL)
|
||||
return(-1);
|
||||
@ -768,15 +703,8 @@ add_dev(arcn)
|
||||
* is returned (indicates an error).
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static DEVT *
|
||||
chk_dev(dev_t dev, int add)
|
||||
#else
|
||||
static DEVT *
|
||||
chk_dev(dev, add)
|
||||
dev_t dev;
|
||||
int add;
|
||||
#endif
|
||||
{
|
||||
register DEVT *pt;
|
||||
register u_int indx;
|
||||
@ -833,16 +761,8 @@ chk_dev(dev, add)
|
||||
* 0 if all ok, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
map_dev(register ARCHD *arcn, u_long dev_mask, u_long ino_mask)
|
||||
#else
|
||||
int
|
||||
map_dev(arcn, dev_mask, ino_mask)
|
||||
register ARCHD *arcn;
|
||||
u_long dev_mask;
|
||||
u_long ino_mask;
|
||||
#endif
|
||||
{
|
||||
register DEVT *pt;
|
||||
register DLIST *dpt;
|
||||
@ -983,13 +903,8 @@ map_dev(arcn, dev_mask, ino_mask)
|
||||
* 0 is created ok, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
atdir_start(void)
|
||||
#else
|
||||
int
|
||||
atdir_start()
|
||||
#endif
|
||||
{
|
||||
if (atab != NULL)
|
||||
return(0);
|
||||
@ -1008,13 +923,8 @@ atdir_start()
|
||||
* entries are for directories READ by pax
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
atdir_end(void)
|
||||
#else
|
||||
void
|
||||
atdir_end()
|
||||
#endif
|
||||
{
|
||||
register ATDIR *pt;
|
||||
register int i;
|
||||
@ -1044,18 +954,8 @@ atdir_end()
|
||||
* and chained by inode number. This is for directories READ by pax
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
add_atdir(char *fname, dev_t dev, ino_t ino, time_t mtime, time_t atime)
|
||||
#else
|
||||
void
|
||||
add_atdir(fname, dev, ino, mtime, atime)
|
||||
char *fname;
|
||||
dev_t dev;
|
||||
ino_t ino;
|
||||
time_t mtime;
|
||||
time_t atime;
|
||||
#endif
|
||||
{
|
||||
register ATDIR *pt;
|
||||
register u_int indx;
|
||||
@ -1116,17 +1016,8 @@ add_atdir(fname, dev, ino, mtime, atime)
|
||||
* 0 if found, -1 if not found.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime)
|
||||
#else
|
||||
int
|
||||
get_atdir(dev, ino, mtime, atime)
|
||||
dev_t dev;
|
||||
ino_t ino;
|
||||
time_t *mtime;
|
||||
time_t *atime;
|
||||
#endif
|
||||
{
|
||||
register ATDIR *pt;
|
||||
register ATDIR **ppt;
|
||||
@ -1200,13 +1091,8 @@ get_atdir(dev, ino, mtime, atime)
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
dir_start(void)
|
||||
#else
|
||||
int
|
||||
dir_start()
|
||||
#endif
|
||||
{
|
||||
|
||||
if (dirfd != -1)
|
||||
@ -1238,17 +1124,8 @@ dir_start()
|
||||
* pax spec)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
add_dir(char *name, int nlen, struct stat *psb, int frc_mode)
|
||||
#else
|
||||
void
|
||||
add_dir(name, nlen, psb, frc_mode)
|
||||
char *name;
|
||||
int nlen;
|
||||
struct stat *psb;
|
||||
int frc_mode;
|
||||
#endif
|
||||
{
|
||||
DIRDATA dblk;
|
||||
|
||||
@ -1288,13 +1165,8 @@ add_dir(name, nlen, psb, frc_mode)
|
||||
* by pax
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
proc_dir(void)
|
||||
#else
|
||||
void
|
||||
proc_dir()
|
||||
#endif
|
||||
{
|
||||
char name[PAXPATHLEN+1];
|
||||
DIRDATA dblk;
|
||||
@ -1356,16 +1228,8 @@ proc_dir()
|
||||
* the hash value of the string MOD (%) the table size.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
u_int
|
||||
st_hash(char *name, int len, int tabsz)
|
||||
#else
|
||||
u_int
|
||||
st_hash(name, len, tabsz)
|
||||
char *name;
|
||||
int len;
|
||||
int tabsz;
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
register char *dest;
|
||||
|
113
bin/pax/tar.c
113
bin/pax/tar.c
@ -58,11 +58,11 @@ static const char rcsid[] =
|
||||
* Routines for reading, writing and header identify of various versions of tar
|
||||
*/
|
||||
|
||||
static u_long tar_chksm __P((register char *, register int));
|
||||
static char *name_split __P((register char *, register int));
|
||||
static int ul_oct __P((u_long, register char *, register int, int));
|
||||
static u_long tar_chksm(register char *, register int);
|
||||
static char *name_split(register char *, register int);
|
||||
static int ul_oct(u_long, register char *, register int, int);
|
||||
#ifndef NET2_STAT
|
||||
static int uqd_oct __P((u_quad_t, register char *, register int, int));
|
||||
static int uqd_oct(u_quad_t, register char *, register int, int);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -78,13 +78,8 @@ static int tar_nodir; /* do not write dirs under old tar */
|
||||
* 0 if ok, -1 otherwise (what wr_skip returns)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tar_endwr(void)
|
||||
#else
|
||||
int
|
||||
tar_endwr()
|
||||
#endif
|
||||
{
|
||||
return(wr_skip((off_t)(NULLCNT*BLKMULT)));
|
||||
}
|
||||
@ -96,13 +91,8 @@ tar_endwr()
|
||||
* size of trailer (2 * BLKMULT)
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
off_t
|
||||
tar_endrd(void)
|
||||
#else
|
||||
off_t
|
||||
tar_endrd()
|
||||
#endif
|
||||
{
|
||||
return((off_t)(NULLCNT*BLKMULT));
|
||||
}
|
||||
@ -118,16 +108,8 @@ tar_endrd()
|
||||
* could never contain a header.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tar_trail(register char *buf, register int in_resync, register int *cnt)
|
||||
#else
|
||||
int
|
||||
tar_trail(buf, in_resync, cnt)
|
||||
register char *buf;
|
||||
register int in_resync;
|
||||
register int *cnt;
|
||||
#endif
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -169,17 +151,8 @@ tar_trail(buf, in_resync, cnt)
|
||||
* 0 if the number fit into the string, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
ul_oct(u_long val, register char *str, register int len, int term)
|
||||
#else
|
||||
static int
|
||||
ul_oct(val, str, len, term)
|
||||
u_long val;
|
||||
register char *str;
|
||||
register int len;
|
||||
int term;
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
|
||||
@ -233,17 +206,8 @@ ul_oct(val, str, len, term)
|
||||
* 0 if the number fit into the string, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static int
|
||||
uqd_oct(u_quad_t val, register char *str, register int len, int term)
|
||||
#else
|
||||
static int
|
||||
uqd_oct(val, str, len, term)
|
||||
u_quad_t val;
|
||||
register char *str;
|
||||
register int len;
|
||||
int term;
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
|
||||
@ -296,15 +260,8 @@ uqd_oct(val, str, len, term)
|
||||
* unsigned long checksum
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static u_long
|
||||
tar_chksm(register char *blk, register int len)
|
||||
#else
|
||||
static u_long
|
||||
tar_chksm(blk, len)
|
||||
register char *blk;
|
||||
register int len;
|
||||
#endif
|
||||
{
|
||||
register char *stop;
|
||||
register char *pt;
|
||||
@ -344,15 +301,8 @@ tar_chksm(blk, len)
|
||||
* 0 if a tar header, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tar_id(register char *blk, int size)
|
||||
#else
|
||||
int
|
||||
tar_id(blk, size)
|
||||
register char *blk;
|
||||
int size;
|
||||
#endif
|
||||
{
|
||||
register HD_TAR *hd;
|
||||
register HD_USTAR *uhd;
|
||||
@ -385,13 +335,8 @@ tar_id(blk, size)
|
||||
* 0 if ok -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tar_opt(void)
|
||||
#else
|
||||
int
|
||||
tar_opt()
|
||||
#endif
|
||||
{
|
||||
OPLIST *opt;
|
||||
|
||||
@ -427,15 +372,8 @@ tar_opt()
|
||||
* 0
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tar_rd(register ARCHD *arcn, register char *buf)
|
||||
#else
|
||||
int
|
||||
tar_rd(arcn, buf)
|
||||
register ARCHD *arcn;
|
||||
register char *buf;
|
||||
#endif
|
||||
{
|
||||
register HD_TAR *hd;
|
||||
register char *pt;
|
||||
@ -565,14 +503,8 @@ tar_rd(arcn, buf)
|
||||
* data to write after the header, -1 if archive write failed
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tar_wr(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
tar_wr(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register HD_TAR *hd;
|
||||
int len;
|
||||
@ -732,13 +664,8 @@ tar_wr(arcn)
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ustar_strd(void)
|
||||
#else
|
||||
int
|
||||
ustar_strd()
|
||||
#endif
|
||||
{
|
||||
if ((usrtb_start() < 0) || (grptb_start() < 0))
|
||||
return(-1);
|
||||
@ -752,13 +679,8 @@ ustar_strd()
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ustar_stwr(void)
|
||||
#else
|
||||
int
|
||||
ustar_stwr()
|
||||
#endif
|
||||
{
|
||||
if ((uidtb_start() < 0) || (gidtb_start() < 0))
|
||||
return(-1);
|
||||
@ -773,15 +695,8 @@ ustar_stwr()
|
||||
* 0 if a ustar header, -1 otherwise
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ustar_id(char *blk, int size)
|
||||
#else
|
||||
int
|
||||
ustar_id(blk, size)
|
||||
char *blk;
|
||||
int size;
|
||||
#endif
|
||||
{
|
||||
register HD_USTAR *hd;
|
||||
|
||||
@ -812,15 +727,8 @@ ustar_id(blk, size)
|
||||
* 0
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ustar_rd(register ARCHD *arcn, register char *buf)
|
||||
#else
|
||||
int
|
||||
ustar_rd(arcn, buf)
|
||||
register ARCHD *arcn;
|
||||
register char *buf;
|
||||
#endif
|
||||
{
|
||||
register HD_USTAR *hd;
|
||||
register char *dest;
|
||||
@ -976,14 +884,8 @@ ustar_rd(arcn, buf)
|
||||
* data to write after the header, -1 if archive write failed
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
ustar_wr(register ARCHD *arcn)
|
||||
#else
|
||||
int
|
||||
ustar_wr(arcn)
|
||||
register ARCHD *arcn;
|
||||
#endif
|
||||
{
|
||||
register HD_USTAR *hd;
|
||||
register char *pt;
|
||||
@ -1164,15 +1066,8 @@ ustar_wr(arcn)
|
||||
* the file name is too long
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
static char *
|
||||
name_split(register char *name, register int len)
|
||||
#else
|
||||
static char *
|
||||
name_split(name, len)
|
||||
register char *name;
|
||||
register int len;
|
||||
#endif
|
||||
{
|
||||
register char *start;
|
||||
|
||||
|
@ -52,11 +52,7 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include "pax.h"
|
||||
#include "extern.h"
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* routines that deal with I/O to and from the user
|
||||
@ -72,13 +68,8 @@ static FILE *ttyinf = NULL; /* input pointing at control tty */
|
||||
* open fails, future ops that require user input will get an EOF
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tty_init(void)
|
||||
#else
|
||||
int
|
||||
tty_init()
|
||||
#endif
|
||||
{
|
||||
int ttyfd;
|
||||
|
||||
@ -104,22 +95,11 @@ tty_init()
|
||||
* if there is no controlling terminal, just return.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
tty_prnt(const char *fmt, ...)
|
||||
#else
|
||||
void
|
||||
tty_prnt(fmt, va_alist)
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
# ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
# else
|
||||
va_start(ap);
|
||||
# endif
|
||||
if (ttyoutf == NULL)
|
||||
return;
|
||||
(void)vfprintf(ttyoutf, fmt, ap);
|
||||
@ -135,15 +115,8 @@ tty_prnt(fmt, va_alist)
|
||||
* 0 if data was read, -1 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
int
|
||||
tty_read(char *str, int len)
|
||||
#else
|
||||
int
|
||||
tty_read(str, len)
|
||||
char *str;
|
||||
int len;
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
|
||||
@ -165,23 +138,11 @@ tty_read(str, len)
|
||||
* will be non-zero.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
paxwarn(int set, const char *fmt, ...)
|
||||
#else
|
||||
void
|
||||
paxwarn(set, fmt, va_alist)
|
||||
int set;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
# ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
# else
|
||||
va_start(ap);
|
||||
# endif
|
||||
if (set)
|
||||
exit_val = 1;
|
||||
/*
|
||||
@ -205,24 +166,11 @@ paxwarn(set, fmt, va_alist)
|
||||
* will be non-zero.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
syswarn(int set, int errnum, const char *fmt, ...)
|
||||
#else
|
||||
void
|
||||
syswarn(set, errnum, fmt, va_alist)
|
||||
int set;
|
||||
int errnum;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
# ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
# else
|
||||
va_start(ap);
|
||||
# endif
|
||||
if (set)
|
||||
exit_val = 1;
|
||||
/*
|
||||
|
@ -46,41 +46,41 @@ extern VAR var[];
|
||||
extern VARENT *vhead;
|
||||
|
||||
__BEGIN_DECLS
|
||||
void command __P((KINFO *, VARENT *));
|
||||
void cputime __P((KINFO *, VARENT *));
|
||||
int donlist __P((void));
|
||||
char *fmt_argv __P((char **, char *, int));
|
||||
double getpcpu __P((KINFO *));
|
||||
double getpmem __P((KINFO *));
|
||||
void kvar __P((KINFO *, VARENT *));
|
||||
void logname __P((KINFO *, VARENT *));
|
||||
void longtname __P((KINFO *, VARENT *));
|
||||
void lstarted __P((KINFO *, VARENT *));
|
||||
void maxrss __P((KINFO *, VARENT *));
|
||||
void mtxname __P((KINFO *, VARENT *));
|
||||
void nlisterr __P((struct nlist *));
|
||||
void p_rssize __P((KINFO *, VARENT *));
|
||||
void pagein __P((KINFO *, VARENT *));
|
||||
void parsefmt __P((char *));
|
||||
void pcpu __P((KINFO *, VARENT *));
|
||||
void pmem __P((KINFO *, VARENT *));
|
||||
void pri __P((KINFO *, VARENT *));
|
||||
void priorityr __P((KINFO *, VARENT *));
|
||||
void printheader __P((void));
|
||||
void rssize __P((KINFO *, VARENT *));
|
||||
void runame __P((KINFO *, VARENT *));
|
||||
int s_runame __P((KINFO *));
|
||||
void rvar __P((KINFO *, VARENT *));
|
||||
void showkey __P((void));
|
||||
void started __P((KINFO *, VARENT *));
|
||||
void state __P((KINFO *, VARENT *));
|
||||
void tdev __P((KINFO *, VARENT *));
|
||||
void tname __P((KINFO *, VARENT *));
|
||||
void tsize __P((KINFO *, VARENT *));
|
||||
void ucomm __P((KINFO *, VARENT *));
|
||||
void uname __P((KINFO *, VARENT *));
|
||||
int s_uname __P((KINFO *));
|
||||
void vsize __P((KINFO *, VARENT *));
|
||||
void wchan __P((KINFO *, VARENT *));
|
||||
void lattr __P((KINFO *, VARENT *));
|
||||
void command(KINFO *, VARENT *);
|
||||
void cputime(KINFO *, VARENT *);
|
||||
int donlist(void);
|
||||
char *fmt_argv(char **, char *, int);
|
||||
double getpcpu(KINFO *);
|
||||
double getpmem(KINFO *);
|
||||
void kvar(KINFO *, VARENT *);
|
||||
void logname(KINFO *, VARENT *);
|
||||
void longtname(KINFO *, VARENT *);
|
||||
void lstarted(KINFO *, VARENT *);
|
||||
void maxrss(KINFO *, VARENT *);
|
||||
void mtxname(KINFO *, VARENT *);
|
||||
void nlisterr(struct nlist *);
|
||||
void p_rssize(KINFO *, VARENT *);
|
||||
void pagein(KINFO *, VARENT *);
|
||||
void parsefmt(char *);
|
||||
void pcpu(KINFO *, VARENT *);
|
||||
void pmem(KINFO *, VARENT *);
|
||||
void pri(KINFO *, VARENT *);
|
||||
void priorityr(KINFO *, VARENT *);
|
||||
void printheader(void);
|
||||
void rssize(KINFO *, VARENT *);
|
||||
void runame(KINFO *, VARENT *);
|
||||
int s_runame(KINFO *);
|
||||
void rvar(KINFO *, VARENT *);
|
||||
void showkey(void);
|
||||
void started(KINFO *, VARENT *);
|
||||
void state(KINFO *, VARENT *);
|
||||
void tdev(KINFO *, VARENT *);
|
||||
void tname(KINFO *, VARENT *);
|
||||
void tsize(KINFO *, VARENT *);
|
||||
void ucomm(KINFO *, VARENT *);
|
||||
void uname(KINFO *, VARENT *);
|
||||
int s_uname(KINFO *);
|
||||
void vsize(KINFO *, VARENT *);
|
||||
void wchan(KINFO *, VARENT *);
|
||||
void lattr(KINFO *, VARENT *);
|
||||
__END_DECLS
|
||||
|
15
bin/ps/fmt.c
15
bin/ps/fmt.c
@ -50,16 +50,15 @@ static const char rcsid[] =
|
||||
#include <vis.h>
|
||||
#include "ps.h"
|
||||
|
||||
static char *cmdpart __P((char *));
|
||||
static char *shquote __P((char **));
|
||||
static char *cmdpart(char *);
|
||||
static char *shquote(char **);
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* This is a stub until marc does the real one.
|
||||
*/
|
||||
static char *
|
||||
shquote(argv)
|
||||
char **argv;
|
||||
shquote(char **argv)
|
||||
{
|
||||
static long arg_max = -1;
|
||||
long len;
|
||||
@ -97,8 +96,7 @@ shquote(argv)
|
||||
}
|
||||
|
||||
static char *
|
||||
cmdpart(arg0)
|
||||
char *arg0;
|
||||
cmdpart(char *arg0)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@ -106,10 +104,7 @@ cmdpart(arg0)
|
||||
}
|
||||
|
||||
char *
|
||||
fmt_argv(argv, cmd, maxlen)
|
||||
char **argv;
|
||||
char *cmd;
|
||||
int maxlen;
|
||||
fmt_argv(char **argv, char *cmd, int maxlen)
|
||||
{
|
||||
int len;
|
||||
char *ap, *cp;
|
||||
|
@ -58,8 +58,8 @@ static const char rcsid[] =
|
||||
|
||||
#include "ps.h"
|
||||
|
||||
static VAR *findvar __P((char *));
|
||||
static int vcmp __P((const void *, const void *));
|
||||
static VAR *findvar(char *);
|
||||
static int vcmp(const void *, const void *);
|
||||
|
||||
#ifdef NOTINUSE
|
||||
int utime(), stime(), ixrss(), idrss(), isrss();
|
||||
@ -190,7 +190,7 @@ VAR var[] = {
|
||||
};
|
||||
|
||||
void
|
||||
showkey()
|
||||
showkey(void)
|
||||
{
|
||||
VAR *v;
|
||||
int i;
|
||||
@ -211,8 +211,7 @@ showkey()
|
||||
}
|
||||
|
||||
void
|
||||
parsefmt(p)
|
||||
char *p;
|
||||
parsefmt(char *p)
|
||||
{
|
||||
static struct varent *vtail;
|
||||
|
||||
@ -242,8 +241,7 @@ parsefmt(p)
|
||||
}
|
||||
|
||||
static VAR *
|
||||
findvar(p)
|
||||
char *p;
|
||||
findvar(char *p)
|
||||
{
|
||||
VAR *v, key;
|
||||
char *hp;
|
||||
@ -273,8 +271,7 @@ findvar(p)
|
||||
}
|
||||
|
||||
static int
|
||||
vcmp(a, b)
|
||||
const void *a, *b;
|
||||
vcmp(const void *a, const void *b)
|
||||
{
|
||||
return (strcmp(((VAR *)a)->name, ((VAR *)b)->name));
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ static int devlomac = -1; /* file descriptor for LOMAC_DEVICE */
|
||||
*/
|
||||
|
||||
void
|
||||
lomac_start(void) {
|
||||
|
||||
lomac_start(void)
|
||||
{
|
||||
if ((devlomac = open(LOMAC_DEVICE, O_RDWR)) == -1)
|
||||
err(1, "cannot open %s", LOMAC_DEVICE);
|
||||
}
|
||||
@ -83,7 +83,8 @@ lomac_start(void) {
|
||||
*/
|
||||
|
||||
void
|
||||
lomac_stop(void) {
|
||||
lomac_stop(void)
|
||||
{
|
||||
|
||||
if (devlomac != -1 && close(devlomac) == -1)
|
||||
err(1, "cannot close %s", LOMAC_DEVICE);
|
||||
@ -104,7 +105,8 @@ lomac_stop(void) {
|
||||
*/
|
||||
|
||||
int
|
||||
get_lattr(int pid) {
|
||||
get_lattr(int pid)
|
||||
{
|
||||
|
||||
if (devlomac == -1)
|
||||
lomac_start();
|
||||
|
@ -50,7 +50,7 @@ int mempages; /* number of pages of phys. memory */
|
||||
int fscale; /* kernel _fscale variable */
|
||||
|
||||
int
|
||||
donlist()
|
||||
donlist(void)
|
||||
{
|
||||
size_t oldlen;
|
||||
|
||||
|
126
bin/ps/print.c
126
bin/ps/print.c
@ -66,7 +66,7 @@ static const char rcsid[] =
|
||||
#include "ps.h"
|
||||
|
||||
void
|
||||
printheader()
|
||||
printheader(void)
|
||||
{
|
||||
VAR *v;
|
||||
struct varent *vent;
|
||||
@ -87,9 +87,7 @@ printheader()
|
||||
}
|
||||
|
||||
void
|
||||
command(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
command(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
int left;
|
||||
@ -143,9 +141,7 @@ command(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
ucomm(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
ucomm(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -154,9 +150,7 @@ ucomm(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
logname(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
logname(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
char *s;
|
||||
@ -166,9 +160,7 @@ logname(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
state(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
state(KINFO *k, VARENT *ve)
|
||||
{
|
||||
int flag, sflag, tdflags;
|
||||
char *cp;
|
||||
@ -240,9 +232,7 @@ state(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
pri(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
pri(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -251,9 +241,7 @@ pri(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
uname(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
uname(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -263,16 +251,13 @@ uname(k, ve)
|
||||
}
|
||||
|
||||
int
|
||||
s_uname(k)
|
||||
KINFO *k;
|
||||
s_uname(KINFO *k)
|
||||
{
|
||||
return (strlen(user_from_uid(k->ki_p->ki_uid, 0)));
|
||||
}
|
||||
|
||||
void
|
||||
runame(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
runame(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -282,16 +267,13 @@ runame(k, ve)
|
||||
}
|
||||
|
||||
int
|
||||
s_runame(k)
|
||||
KINFO *k;
|
||||
s_runame(KINFO *k)
|
||||
{
|
||||
return (strlen(user_from_uid(k->ki_p->ki_ruid, 0)));
|
||||
}
|
||||
|
||||
void
|
||||
tdev(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
tdev(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
dev_t dev;
|
||||
@ -309,9 +291,7 @@ tdev(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
tname(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
tname(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
dev_t dev;
|
||||
@ -331,9 +311,7 @@ tname(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
longtname(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
longtname(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
dev_t dev;
|
||||
@ -348,9 +326,7 @@ longtname(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
started(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
started(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
static time_t now;
|
||||
@ -384,9 +360,7 @@ started(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
lstarted(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
lstarted(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
time_t then;
|
||||
@ -403,9 +377,7 @@ lstarted(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
mtxname(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
mtxname(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -421,9 +393,7 @@ mtxname(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
wchan(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
wchan(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -444,9 +414,7 @@ wchan(k, ve)
|
||||
#endif
|
||||
|
||||
void
|
||||
vsize(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
vsize(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -456,9 +424,7 @@ vsize(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
rssize(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
rssize(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -469,9 +435,7 @@ rssize(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
p_rssize(k, ve) /* doesn't account for text */
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
p_rssize(KINFO *k, VARENT *ve) /* doesn't account for text */
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -480,9 +444,7 @@ p_rssize(k, ve) /* doesn't account for text */
|
||||
}
|
||||
|
||||
void
|
||||
cputime(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
cputime(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
long secs;
|
||||
@ -521,8 +483,7 @@ cputime(k, ve)
|
||||
}
|
||||
|
||||
double
|
||||
getpcpu(k)
|
||||
KINFO *k;
|
||||
getpcpu(KINFO *k)
|
||||
{
|
||||
static int failure;
|
||||
|
||||
@ -543,9 +504,7 @@ getpcpu(k)
|
||||
}
|
||||
|
||||
void
|
||||
pcpu(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
pcpu(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -554,8 +513,7 @@ pcpu(k, ve)
|
||||
}
|
||||
|
||||
double
|
||||
getpmem(k)
|
||||
KINFO *k;
|
||||
getpmem(KINFO *k)
|
||||
{
|
||||
static int failure;
|
||||
double fracmem;
|
||||
@ -574,9 +532,7 @@ getpmem(k)
|
||||
}
|
||||
|
||||
void
|
||||
pmem(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
pmem(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -585,9 +541,7 @@ pmem(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
pagein(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
pagein(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -597,9 +551,7 @@ pagein(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
maxrss(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
maxrss(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -609,9 +561,7 @@ maxrss(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
tsize(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
tsize(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -620,9 +570,7 @@ tsize(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
priorityr(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
priorityr(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
struct priority *pri;
|
||||
@ -656,9 +604,7 @@ priorityr(k, ve)
|
||||
* structures.
|
||||
*/
|
||||
static void
|
||||
printval(bp, v)
|
||||
char *bp;
|
||||
VAR *v;
|
||||
printval(char *bp, VAR *v)
|
||||
{
|
||||
static char ofmt[32] = "%";
|
||||
char *fcp, *cp;
|
||||
@ -704,9 +650,7 @@ printval(bp, v)
|
||||
}
|
||||
|
||||
void
|
||||
kvar(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
kvar(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -715,9 +659,7 @@ kvar(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
rvar(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
rvar(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
@ -729,9 +671,7 @@ rvar(k, ve)
|
||||
}
|
||||
|
||||
void
|
||||
lattr(k, ve)
|
||||
KINFO *k;
|
||||
VARENT *ve;
|
||||
lattr(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
|
||||
|
47
bin/ps/ps.c
47
bin/ps/ps.c
@ -93,15 +93,15 @@ static int forceuread=1;
|
||||
|
||||
enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;
|
||||
|
||||
static char *fmt __P((char **(*)(kvm_t *, const struct kinfo_proc *, int),
|
||||
KINFO *, char *, int));
|
||||
static char *kludge_oldps_options __P((char *));
|
||||
static int pscomp __P((const void *, const void *));
|
||||
static void saveuser __P((KINFO *));
|
||||
static void scanvars __P((void));
|
||||
static void dynsizevars __P((KINFO *));
|
||||
static void sizevars __P((void));
|
||||
static void usage __P((void));
|
||||
static char *fmt(char **(*)(kvm_t *, const struct kinfo_proc *, int),
|
||||
KINFO *, char *, int);
|
||||
static char *kludge_oldps_options(char *);
|
||||
static int pscomp(const void *, const void *);
|
||||
static void saveuser(KINFO *);
|
||||
static void scanvars(void);
|
||||
static void dynsizevars(KINFO *);
|
||||
static void sizevars(void);
|
||||
static void usage(void);
|
||||
static uid_t *getuids(const char *, int *);
|
||||
|
||||
char dfmt[] = "pid tt state time command";
|
||||
@ -116,9 +116,7 @@ char Zfmt[] = "lvl";
|
||||
kvm_t *kd;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct kinfo_proc *kp;
|
||||
struct varent *vent;
|
||||
@ -439,7 +437,7 @@ getuids(const char *arg, int *nuids)
|
||||
}
|
||||
|
||||
static void
|
||||
scanvars()
|
||||
scanvars(void)
|
||||
{
|
||||
struct varent *vent;
|
||||
VAR *v;
|
||||
@ -458,8 +456,7 @@ scanvars()
|
||||
}
|
||||
|
||||
static void
|
||||
dynsizevars(ki)
|
||||
KINFO *ki;
|
||||
dynsizevars(KINFO *ki)
|
||||
{
|
||||
struct varent *vent;
|
||||
VAR *v;
|
||||
@ -478,7 +475,7 @@ dynsizevars(ki)
|
||||
}
|
||||
|
||||
static void
|
||||
sizevars()
|
||||
sizevars(void)
|
||||
{
|
||||
struct varent *vent;
|
||||
VAR *v;
|
||||
@ -495,11 +492,8 @@ sizevars()
|
||||
}
|
||||
|
||||
static char *
|
||||
fmt(fn, ki, comm, maxlen)
|
||||
char **(*fn) __P((kvm_t *, const struct kinfo_proc *, int));
|
||||
KINFO *ki;
|
||||
char *comm;
|
||||
int maxlen;
|
||||
fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, int), KINFO *ki,
|
||||
char *comm, int maxlen)
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -512,8 +506,7 @@ fmt(fn, ki, comm, maxlen)
|
||||
#define UREADOK(ki) (forceuread || (ki->ki_p->ki_sflag & PS_INMEM))
|
||||
|
||||
static void
|
||||
saveuser(ki)
|
||||
KINFO *ki;
|
||||
saveuser(KINFO *ki)
|
||||
{
|
||||
|
||||
if (ki->ki_p->ki_sflag & PS_INMEM) {
|
||||
@ -549,8 +542,7 @@ saveuser(ki)
|
||||
}
|
||||
|
||||
static int
|
||||
pscomp(a, b)
|
||||
const void *a, *b;
|
||||
pscomp(const void *a, const void *b)
|
||||
{
|
||||
int i;
|
||||
#define VSIZE(k) ((k)->ki_p->ki_dsize + (k)->ki_p->ki_ssize + \
|
||||
@ -578,8 +570,7 @@ pscomp(a, b)
|
||||
* feature is available with the option 'T', which takes no argument.
|
||||
*/
|
||||
static char *
|
||||
kludge_oldps_options(s)
|
||||
char *s;
|
||||
kludge_oldps_options(char *s)
|
||||
{
|
||||
size_t len;
|
||||
char *newopts, *ns, *cp;
|
||||
@ -632,7 +623,7 @@ kludge_oldps_options(s)
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
||||
|
@ -60,9 +60,9 @@ typedef struct var {
|
||||
#define DSIZ 0x08 /* field size is dynamic*/
|
||||
u_int flag;
|
||||
/* output routine */
|
||||
void (*oproc) __P((struct kinfo *, struct varent *));
|
||||
void (*oproc)(struct kinfo *, struct varent *);
|
||||
/* sizing routine*/
|
||||
int (*sproc) __P((struct kinfo *));
|
||||
int (*sproc)(struct kinfo *);
|
||||
short width; /* printing width */
|
||||
/*
|
||||
* The following (optional) elements are hooks for passing information
|
||||
|
@ -52,13 +52,10 @@ static const char rcsid[] =
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
int main __P((int, char *[]));
|
||||
void usage __P((void));
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
char *p;
|
||||
@ -99,7 +96,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "usage: pwd\n");
|
||||
|
@ -41,11 +41,11 @@ typedef struct {
|
||||
|
||||
extern int iamremote;
|
||||
|
||||
BUF *allocbuf __P((BUF *, int, int));
|
||||
char *colon __P((char *));
|
||||
void lostconn __P((int));
|
||||
void nospace __P((void));
|
||||
int okname __P((char *));
|
||||
void run_err __P((const char *, ...)) __printflike(1, 2);
|
||||
int susystem __P((char *, int));
|
||||
void verifydir __P((char *));
|
||||
BUF *allocbuf(BUF *, int, int);
|
||||
char *colon(char *);
|
||||
void lostconn(int);
|
||||
void nospace(void);
|
||||
int okname(char *);
|
||||
void run_err(const char *, ...) __printflike(1, 2);
|
||||
int susystem(char *, int);
|
||||
void verifydir(char *);
|
||||
|
@ -106,22 +106,20 @@ static char **argv_copy;
|
||||
char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */
|
||||
|
||||
#ifdef KERBEROS
|
||||
int kerberos __P((char **, char *, char *, char *));
|
||||
void oldw __P((const char *, ...)) __printflike(1, 2);
|
||||
int kerberos(char **, char *, char *, char *);
|
||||
void oldw(const char *, ...) __printflike(1, 2);
|
||||
#endif
|
||||
int response __P((void));
|
||||
void rsource __P((char *, struct stat *));
|
||||
void run_err __P((const char *, ...)) __printflike(1, 2);
|
||||
void sink __P((int, char *[]));
|
||||
void source __P((int, char *[]));
|
||||
void tolocal __P((int, char *[]));
|
||||
void toremote __P((char *, int, char *[]));
|
||||
void usage __P((void));
|
||||
int response(void);
|
||||
void rsource(char *, struct stat *);
|
||||
void run_err(const char *, ...) __printflike(1, 2);
|
||||
void sink(int, char *[]);
|
||||
void source(int, char *[]);
|
||||
void tolocal(int, char *[]);
|
||||
void toremote(char *, int, char *[]);
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct servent *sp;
|
||||
int ch, fflag, i, tflag;
|
||||
@ -269,9 +267,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
void
|
||||
toremote(targ, argc, argv)
|
||||
char *targ, *argv[];
|
||||
int argc;
|
||||
toremote(char *targ, int argc, char *argv[])
|
||||
{
|
||||
int i, len, tos;
|
||||
char *bp, *host, *src, *suser, *thost, *tuser;
|
||||
@ -361,9 +357,7 @@ toremote(targ, argc, argv)
|
||||
}
|
||||
|
||||
void
|
||||
tolocal(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
tolocal(int argc, char *argv[])
|
||||
{
|
||||
int i, len, tos;
|
||||
char *bp, *host, *src, *suser;
|
||||
@ -425,9 +419,7 @@ tolocal(argc, argv)
|
||||
}
|
||||
|
||||
void
|
||||
source(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
source(int argc, char *argv[])
|
||||
{
|
||||
struct stat stb;
|
||||
static BUF buffer;
|
||||
@ -513,9 +505,7 @@ next: (void)close(fd);
|
||||
}
|
||||
|
||||
void
|
||||
rsource(name, statp)
|
||||
char *name;
|
||||
struct stat *statp;
|
||||
rsource(char *name, struct stat *statp)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
@ -566,9 +556,7 @@ rsource(name, statp)
|
||||
}
|
||||
|
||||
void
|
||||
sink(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
sink(int argc, char *argv[])
|
||||
{
|
||||
static BUF buffer;
|
||||
struct stat stb;
|
||||
@ -806,8 +794,7 @@ bad: run_err("%s: %s", np, strerror(errno));
|
||||
|
||||
#ifdef KERBEROS
|
||||
int
|
||||
kerberos(host, bp, locuser, user)
|
||||
char **host, *bp, *locuser, *user;
|
||||
kerberos(char **host, char *bp, char *locuser, char *user)
|
||||
{
|
||||
if (use_kerberos) {
|
||||
setuid(getuid());
|
||||
@ -844,7 +831,7 @@ kerberos(host, bp, locuser, user)
|
||||
#endif /* KERBEROS */
|
||||
|
||||
int
|
||||
response()
|
||||
response(void)
|
||||
{
|
||||
char ch, *cp, resp, rbuf[BUFSIZ];
|
||||
|
||||
@ -877,7 +864,7 @@ response()
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
#ifdef KERBEROS
|
||||
#ifdef CRYPT
|
||||
@ -897,28 +884,14 @@ usage()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifdef KERBEROS
|
||||
void
|
||||
#if __STDC__
|
||||
oldw(const char *fmt, ...)
|
||||
#else
|
||||
oldw(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void)fprintf(stderr, "rcp: ");
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, ", using standard rcp\n");
|
||||
@ -927,21 +900,11 @@ oldw(fmt, va_alist)
|
||||
#endif
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
run_err(const char *fmt, ...)
|
||||
#else
|
||||
run_err(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
static FILE *fp;
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
|
||||
++errs;
|
||||
if (fp == NULL && !(fp = fdopen(rem, "w")))
|
||||
|
@ -56,8 +56,7 @@ static const char rcsid[] =
|
||||
#include "extern.h"
|
||||
|
||||
char *
|
||||
colon(cp)
|
||||
char *cp;
|
||||
colon(char *cp)
|
||||
{
|
||||
if (*cp == ':') /* Leading colon is part of file name. */
|
||||
return (0);
|
||||
@ -72,8 +71,7 @@ colon(cp)
|
||||
}
|
||||
|
||||
void
|
||||
verifydir(cp)
|
||||
char *cp;
|
||||
verifydir(char *cp)
|
||||
{
|
||||
struct stat stb;
|
||||
|
||||
@ -87,8 +85,7 @@ verifydir(cp)
|
||||
}
|
||||
|
||||
int
|
||||
okname(cp0)
|
||||
char *cp0;
|
||||
okname(char *cp0)
|
||||
{
|
||||
int c;
|
||||
char *cp;
|
||||
@ -108,9 +105,7 @@ bad: warnx("%s: invalid user name", cp0);
|
||||
}
|
||||
|
||||
int
|
||||
susystem(s, userid)
|
||||
int userid;
|
||||
char *s;
|
||||
susystem(char *s, int userid)
|
||||
{
|
||||
sig_t istat, qstat;
|
||||
int status;
|
||||
@ -136,9 +131,7 @@ susystem(s, userid)
|
||||
}
|
||||
|
||||
BUF *
|
||||
allocbuf(bp, fd, blksize)
|
||||
BUF *bp;
|
||||
int fd, blksize;
|
||||
allocbuf(BUF *bp, int fd, int blksize)
|
||||
{
|
||||
struct stat stb;
|
||||
size_t size;
|
||||
@ -162,8 +155,7 @@ allocbuf(bp, fd, blksize)
|
||||
}
|
||||
|
||||
void
|
||||
lostconn(signo)
|
||||
int signo;
|
||||
lostconn(int signo)
|
||||
{
|
||||
if (!iamremote)
|
||||
warnx("lost connection");
|
||||
|
36
bin/rm/rm.c
36
bin/rm/rm.c
@ -63,13 +63,12 @@ static const char rcsid[] =
|
||||
int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
|
||||
uid_t uid;
|
||||
|
||||
int check __P((char *, char *, struct stat *));
|
||||
void checkdot __P((char **));
|
||||
void rm_file __P((char **));
|
||||
void rm_overwrite __P((char *, struct stat *));
|
||||
void rm_tree __P((char **));
|
||||
void usage __P((void));
|
||||
int main __P((int argc, char *argv[]));
|
||||
int check(char *, char *, struct stat *);
|
||||
void checkdot(char **);
|
||||
void rm_file(char **);
|
||||
void rm_overwrite(char *, struct stat *);
|
||||
void rm_tree(char **);
|
||||
void usage(void);
|
||||
|
||||
/*
|
||||
* rm --
|
||||
@ -79,9 +78,7 @@ int main __P((int argc, char *argv[]));
|
||||
* file removal.
|
||||
*/
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, rflag;
|
||||
char *p;
|
||||
@ -158,8 +155,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
void
|
||||
rm_tree(argv)
|
||||
char **argv;
|
||||
rm_tree(char **argv)
|
||||
{
|
||||
FTS *fts;
|
||||
FTSENT *p;
|
||||
@ -290,8 +286,7 @@ rm_tree(argv)
|
||||
}
|
||||
|
||||
void
|
||||
rm_file(argv)
|
||||
char **argv;
|
||||
rm_file(char **argv)
|
||||
{
|
||||
struct stat sb;
|
||||
int rval;
|
||||
@ -363,9 +358,7 @@ rm_file(argv)
|
||||
* kernel support.
|
||||
*/
|
||||
void
|
||||
rm_overwrite(file, sbp)
|
||||
char *file;
|
||||
struct stat *sbp;
|
||||
rm_overwrite(char *file, struct stat *sbp)
|
||||
{
|
||||
struct stat sb;
|
||||
struct statfs fsb;
|
||||
@ -417,9 +410,7 @@ err: eval = 1;
|
||||
|
||||
|
||||
int
|
||||
check(path, name, sp)
|
||||
char *path, *name;
|
||||
struct stat *sp;
|
||||
check(char *path, char *name, struct stat *sp)
|
||||
{
|
||||
int ch, first;
|
||||
char modep[15], *flagsp;
|
||||
@ -460,8 +451,7 @@ check(path, name, sp)
|
||||
|
||||
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
|
||||
void
|
||||
checkdot(argv)
|
||||
char **argv;
|
||||
checkdot(char **argv)
|
||||
{
|
||||
char *p, **save, **t;
|
||||
int complained;
|
||||
@ -485,7 +475,7 @@ checkdot(argv)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
|
@ -52,14 +52,11 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main __P((int, char *[]));
|
||||
int rm_path __P((char *));
|
||||
void usage __P((void));
|
||||
int rm_path(char *);
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, errors;
|
||||
int pflag;
|
||||
@ -92,8 +89,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
int
|
||||
rm_path(path)
|
||||
char *path;
|
||||
rm_path(char *path)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -117,7 +113,7 @@ rm_path(path)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "usage: rmdir [-p] directory ...\n");
|
||||
|
Loading…
Reference in New Issue
Block a user