Welcome to WARNS=3

This commit is contained in:
christos 2004-05-11 17:12:26 +00:00
parent 455c8493fb
commit 5820cbfaf6
9 changed files with 48 additions and 37 deletions

View File

@ -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 # @(#)Makefile 8.1 (Berkeley) 5/31/93
# To install on versions prior to BSD 4.4 the following may have to be # To install on versions prior to BSD 4.4 the following may have to be
@ -27,6 +27,7 @@
.include <bsd.own.mk> .include <bsd.own.mk>
WARNS=3
PROG= pax PROG= pax
SRCS= ar_io.c ar_subs.c buf_subs.c cpio.c file_subs.c ftree.c\ 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\ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c\

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94"; static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else #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
#endif /* not lint */ #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 EXT_MODE O_RDONLY /* open mode for list/extract */
#define AR_MODE (O_WRONLY | O_CREAT | O_TRUNC) /* mode for archive */ #define AR_MODE (O_WRONLY | O_CREAT | O_TRUNC) /* mode for archive */
#define APP_MODE O_RDWR /* mode for append */ #define APP_MODE O_RDWR /* mode for append */
#define STDO "<STDOUT>" /* pseudo name for stdout */ static char STDO[] = "<STDOUT>"; /* pseudo name for stdout */
#define STDN "<STDIN>" /* pseudo name for stdin */ static char STDN[] = "<STDIN>"; /* pseudo name for stdin */
static char NONE[] = "<NONE>"; /* pseudo name for none */
static int arfd = -1; /* archive file descriptor */ static int arfd = -1; /* archive file descriptor */
static int artyp = ISREG; /* archive type: file/FIFO/tape */ static int artyp = ISREG; /* archive type: file/FIFO/tape */
static int arvol = 1; /* archive volume number */ static int arvol = 1; /* archive volume number */
@ -183,7 +184,7 @@ ar_open(const char *name)
/* /*
* arfd not used in COPY mode * arfd not used in COPY mode
*/ */
arcname = "<NONE>"; arcname = NONE;
lstrval = 1; lstrval = 1;
return(0); return(0);
} }
@ -1396,7 +1397,7 @@ int
ar_next(void) ar_next(void)
{ {
char buf[PAXPATHLEN+2]; char buf[PAXPATHLEN+2];
static int freeit = 0; static char *arcfree = NULL;
sigset_t o_mask; sigset_t o_mask;
/* /*
@ -1525,17 +1526,17 @@ ar_next(void)
* try to open new archive * try to open new archive
*/ */
if (ar_open(buf) >= 0) { if (ar_open(buf) >= 0) {
if (freeit) { if (arcfree) {
(void)free((char *)arcname); (void)free(arcfree);
freeit = 0; arcfree = NULL;
} }
if ((arcname = strdup(buf)) == NULL) { if ((arcfree = strdup(buf)) == NULL) {
done = 1; done = 1;
lstrval = -1; lstrval = -1;
tty_warn(0, "Cannot save archive name."); tty_warn(0, "Cannot save archive name.");
return(-1); return(-1);
} }
freeit = 1; arcname = arcfree;
break; break;
} }
tty_prnt("Cannot open %s, try again\n", buf); tty_prnt("Cannot open %s, try again\n", buf);

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -251,7 +251,7 @@ extern int docrc;
extern int to_stdout; extern int to_stdout;
extern char *dirptr; extern char *dirptr;
extern char *ltmfrmt; extern char *ltmfrmt;
extern char *argv0; extern const char *argv0;
extern FILE *listf; extern FILE *listf;
extern char *tempfile; extern char *tempfile;
extern char *tempbase; extern char *tempbase;

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
#else #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
#endif /* not lint */ #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 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 *ophead = NULL; /* head for format specific options -x */
static OPLIST *optail = NULL; /* option tail */ static OPLIST *optail = NULL; /* option tail */
@ -471,10 +471,10 @@ pax_options(int argc, char **argv)
/* /*
* non-standard limit on read faults * non-standard limit on read faults
* 0 indicates stop after first error, values * 0 indicates stop after first error, values
* indicate a limit, "NONE" try forever * indicate a limit, "none" try forever
*/ */
flg |= CEF; flg |= CEF;
if (strcmp(NONE, optarg) == 0) if (strcmp(none, optarg) == 0)
maxflt = -1; maxflt = -1;
else if ((maxflt = atoi(optarg)) < 0) { else if ((maxflt = atoi(optarg)) < 0) {
tty_warn(1, tty_warn(1,
@ -1715,7 +1715,7 @@ printflg(unsigned int flg)
static int static int
c_frmt(const void *a, const void *b) 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));
} }
/* /*

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -48,7 +48,7 @@
* operation mode of pax, a set of illegal flags is defined. If any one of * 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 * those illegal flags are found set, we scream and exit
*/ */
#define NONE "none" #define none "none"
/* /*
* flags (one for each option). * flags (one for each option).

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94"; static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
#else #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
#endif /* not lint */ #endif /* not lint */
@ -107,7 +107,7 @@ int docrc; /* check/create file crc */
int to_stdout; /* extract to stdout */ int to_stdout; /* extract to stdout */
char *dirptr; /* destination dir in a copy */ char *dirptr; /* destination dir in a copy */
char *ltmfrmt; /* -v locale time format (if any) */ 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 */ sigset_t s_mask; /* signal mask for cleanup critical sect */
FILE *listf; /* file pointer to print file list to */ FILE *listf; /* file pointer to print file list to */
char *tempfile; /* tempfile to use for mkstemp(3) */ char *tempfile; /* tempfile to use for mkstemp(3) */
@ -240,7 +240,7 @@ int secure = 1; /* don't extract names that contain .. */
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
char *tmpdir; const char *tmpdir;
size_t tdlen; size_t tdlen;
setprogname(argv[0]); setprogname(argv[0]);

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -145,7 +145,7 @@ typedef struct {
* dependent routines pass pointers to ARCHD structure (described below). * dependent routines pass pointers to ARCHD structure (described below).
*/ */
typedef struct { 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. */ /* gives to -x option to select it. */
int bsz; /* default block size. used when the user */ int bsz; /* default block size. used when the user */
/* does not specify a blocksize for writing */ /* does not specify a blocksize for writing */

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else #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
#endif /* not lint */ #endif /* not lint */
@ -95,6 +95,15 @@ char *gnu_name_string; /* ././@LongLink hackery name */
char *gnu_link_string; /* ././@LongLink hackery link */ char *gnu_link_string; /* ././@LongLink hackery link */
static int gnu_short_trailer; /* gnu short trailer */ 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 static int
check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet) check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet)
{ {

View File

@ -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. * Copyright (c) 1992 Keith Muller.
@ -115,12 +115,12 @@ typedef struct {
/* /*
* default device names * default device names
*/ */
#define DEV_0 "/dev/rst0" extern char DEV_0[];
#define DEV_1 "/dev/rst1" extern char DEV_1[];
#define DEV_4 "/dev/rst4" extern char DEV_4[];
#define DEV_5 "/dev/rst5" extern char DEV_5[];
#define DEV_7 "/dev/rst7" extern char DEV_7[];
#define DEV_8 "/dev/rst8" extern char DEV_8[];
#endif /* _PAX_ */ #endif /* _PAX_ */
/* /*