diff --git a/bin/pax/Makefile b/bin/pax/Makefile index d311e427934c..52aa7d7d1696 100644 --- a/bin/pax/Makefile +++ b/bin/pax/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.30 2003/07/18 02:18:49 lukem Exp $ +# $NetBSD: Makefile,v 1.31 2004/05/11 17:12:26 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # To install on versions prior to BSD 4.4 the following may have to be @@ -27,6 +27,7 @@ .include +WARNS=3 PROG= pax SRCS= ar_io.c ar_subs.c buf_subs.c cpio.c file_subs.c ftree.c\ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c\ diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index d64621ebc56c..9142127499fc 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: ar_io.c,v 1.39 2003/10/27 00:12:41 lukem Exp $ */ +/* $NetBSD: ar_io.c,v 1.40 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: ar_io.c,v 1.39 2003/10/27 00:12:41 lukem Exp $"); +__RCSID("$NetBSD: ar_io.c,v 1.40 2004/05/11 17:12:26 christos Exp $"); #endif #endif /* not lint */ @@ -77,8 +77,9 @@ __RCSID("$NetBSD: ar_io.c,v 1.39 2003/10/27 00:12:41 lukem Exp $"); #define EXT_MODE O_RDONLY /* open mode for list/extract */ #define AR_MODE (O_WRONLY | O_CREAT | O_TRUNC) /* mode for archive */ #define APP_MODE O_RDWR /* mode for append */ -#define STDO "" /* pseudo name for stdout */ -#define STDN "" /* pseudo name for stdin */ +static char STDO[] = ""; /* pseudo name for stdout */ +static char STDN[] = ""; /* pseudo name for stdin */ +static char NONE[] = ""; /* pseudo name for none */ static int arfd = -1; /* archive file descriptor */ static int artyp = ISREG; /* archive type: file/FIFO/tape */ static int arvol = 1; /* archive volume number */ @@ -183,7 +184,7 @@ ar_open(const char *name) /* * arfd not used in COPY mode */ - arcname = ""; + arcname = NONE; lstrval = 1; return(0); } @@ -1396,7 +1397,7 @@ int ar_next(void) { char buf[PAXPATHLEN+2]; - static int freeit = 0; + static char *arcfree = NULL; sigset_t o_mask; /* @@ -1525,17 +1526,17 @@ ar_next(void) * try to open new archive */ if (ar_open(buf) >= 0) { - if (freeit) { - (void)free((char *)arcname); - freeit = 0; + if (arcfree) { + (void)free(arcfree); + arcfree = NULL; } - if ((arcname = strdup(buf)) == NULL) { + if ((arcfree = strdup(buf)) == NULL) { done = 1; lstrval = -1; tty_warn(0, "Cannot save archive name."); return(-1); } - freeit = 1; + arcname = arcfree; break; } tty_prnt("Cannot open %s, try again\n", buf); diff --git a/bin/pax/extern.h b/bin/pax/extern.h index d5f4e025d22f..6b659e195e6e 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.41 2004/02/13 23:10:14 matt Exp $ */ +/* $NetBSD: extern.h,v 1.42 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -251,7 +251,7 @@ extern int docrc; extern int to_stdout; extern char *dirptr; extern char *ltmfrmt; -extern char *argv0; +extern const char *argv0; extern FILE *listf; extern char *tempfile; extern char *tempbase; diff --git a/bin/pax/options.c b/bin/pax/options.c index e5342e8fbacf..25296a485b90 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $NetBSD: options.c,v 1.73 2004/02/20 05:16:54 uebayasi Exp $ */ +/* $NetBSD: options.c,v 1.74 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: options.c,v 1.73 2004/02/20 05:16:54 uebayasi Exp $"); +__RCSID("$NetBSD: options.c,v 1.74 2004/05/11 17:12:26 christos Exp $"); #endif #endif /* not lint */ @@ -74,7 +74,7 @@ __RCSID("$NetBSD: options.c,v 1.73 2004/02/20 05:16:54 uebayasi Exp $"); */ static int nopids; /* tar mode: suppress "pids" for -p option */ -static char *flgch = FLGCH; /* list of all possible flags (pax) */ +static char flgch[] = FLGCH; /* list of all possible flags (pax) */ static OPLIST *ophead = NULL; /* head for format specific options -x */ static OPLIST *optail = NULL; /* option tail */ @@ -471,10 +471,10 @@ pax_options(int argc, char **argv) /* * non-standard limit on read faults * 0 indicates stop after first error, values - * indicate a limit, "NONE" try forever + * indicate a limit, "none" try forever */ flg |= CEF; - if (strcmp(NONE, optarg) == 0) + if (strcmp(none, optarg) == 0) maxflt = -1; else if ((maxflt = atoi(optarg)) < 0) { tty_warn(1, @@ -1715,7 +1715,7 @@ printflg(unsigned int flg) static int c_frmt(const void *a, const void *b) { - return(strcmp(((FSUB *)a)->name, ((FSUB *)b)->name)); + return(strcmp(((const FSUB *)a)->name, ((const FSUB *)b)->name)); } /* diff --git a/bin/pax/options.h b/bin/pax/options.h index 0bea717b34f5..86298ae0722a 100644 --- a/bin/pax/options.h +++ b/bin/pax/options.h @@ -1,4 +1,4 @@ -/* $NetBSD: options.h,v 1.9 2003/10/13 07:41:22 agc Exp $ */ +/* $NetBSD: options.h,v 1.10 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ * operation mode of pax, a set of illegal flags is defined. If any one of * those illegal flags are found set, we scream and exit */ -#define NONE "none" +#define none "none" /* * flags (one for each option). diff --git a/bin/pax/pax.c b/bin/pax/pax.c index cd2a3f1cd649..2d7f96dd364d 100644 --- a/bin/pax/pax.c +++ b/bin/pax/pax.c @@ -1,4 +1,4 @@ -/* $NetBSD: pax.c,v 1.33 2004/02/13 23:10:14 matt Exp $ */ +/* $NetBSD: pax.c,v 1.34 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: pax.c,v 1.33 2004/02/13 23:10:14 matt Exp $"); +__RCSID("$NetBSD: pax.c,v 1.34 2004/05/11 17:12:26 christos Exp $"); #endif #endif /* not lint */ @@ -107,7 +107,7 @@ int docrc; /* check/create file crc */ int to_stdout; /* extract to stdout */ char *dirptr; /* destination dir in a copy */ char *ltmfrmt; /* -v locale time format (if any) */ -char *argv0; /* root of argv[0] */ +const char *argv0; /* root of argv[0] */ sigset_t s_mask; /* signal mask for cleanup critical sect */ FILE *listf; /* file pointer to print file list to */ char *tempfile; /* tempfile to use for mkstemp(3) */ @@ -240,7 +240,7 @@ int secure = 1; /* don't extract names that contain .. */ int main(int argc, char **argv) { - char *tmpdir; + const char *tmpdir; size_t tdlen; setprogname(argv[0]); diff --git a/bin/pax/pax.h b/bin/pax/pax.h index 65eea9ea7782..8e49002a76cb 100644 --- a/bin/pax/pax.h +++ b/bin/pax/pax.h @@ -1,4 +1,4 @@ -/* $NetBSD: pax.h,v 1.23 2004/02/12 22:19:18 matt Exp $ */ +/* $NetBSD: pax.h,v 1.24 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -145,7 +145,7 @@ typedef struct { * dependent routines pass pointers to ARCHD structure (described below). */ typedef struct { - char *name; /* name of format, this is the name the user */ + const char *name; /* name of format, this is the name the user */ /* gives to -x option to select it. */ int bsz; /* default block size. used when the user */ /* does not specify a blocksize for writing */ diff --git a/bin/pax/tar.c b/bin/pax/tar.c index ffde45e13391..c35e3c78ac32 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -1,4 +1,4 @@ -/* $NetBSD: tar.c,v 1.52 2004/04/25 15:52:30 christos Exp $ */ +/* $NetBSD: tar.c,v 1.53 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: tar.c,v 1.52 2004/04/25 15:52:30 christos Exp $"); +__RCSID("$NetBSD: tar.c,v 1.53 2004/05/11 17:12:26 christos Exp $"); #endif #endif /* not lint */ @@ -95,6 +95,15 @@ char *gnu_name_string; /* ././@LongLink hackery name */ char *gnu_link_string; /* ././@LongLink hackery link */ static int gnu_short_trailer; /* gnu short trailer */ +#ifdef _PAX_ +char DEV_0[] = "/dev/rst0"; +char DEV_1[] = "/dev/rst1"; +char DEV_4[] = "/dev/rst4"; +char DEV_5[] = "/dev/rst5"; +char DEV_7[] = "/dev/rst7"; +char DEV_8[] = "/dev/rst8"; +#endif + static int check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet) { diff --git a/bin/pax/tar.h b/bin/pax/tar.h index 4076f00bcd26..6d26cb69cfed 100644 --- a/bin/pax/tar.h +++ b/bin/pax/tar.h @@ -1,4 +1,4 @@ -/* $NetBSD: tar.h,v 1.8 2003/10/13 07:41:22 agc Exp $ */ +/* $NetBSD: tar.h,v 1.9 2004/05/11 17:12:26 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -115,12 +115,12 @@ typedef struct { /* * default device names */ -#define DEV_0 "/dev/rst0" -#define DEV_1 "/dev/rst1" -#define DEV_4 "/dev/rst4" -#define DEV_5 "/dev/rst5" -#define DEV_7 "/dev/rst7" -#define DEV_8 "/dev/rst8" +extern char DEV_0[]; +extern char DEV_1[]; +extern char DEV_4[]; +extern char DEV_5[]; +extern char DEV_7[]; +extern char DEV_8[]; #endif /* _PAX_ */ /*