From 65723cba53db39160a108baa841cead13004b7b0 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 24 Mar 2006 14:03:25 +0000 Subject: [PATCH] Fix compiler warnings for pax --- commands/pax/options.c | 20 ++++++++++++++++---- include/stdlib.h | 2 +- include/strings.h | 1 + include/unistd.h | 2 +- lib/posix/getopt.c | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/commands/pax/options.c b/commands/pax/options.c index 1f3afb0ff..155d3c0ff 100644 --- a/commands/pax/options.c +++ b/commands/pax/options.c @@ -31,6 +31,9 @@ * SUCH DAMAGE. */ +#define _POSIX_SOURCE 1 +#define _MINIX 1 + #if 0 #ifndef lint static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; @@ -48,6 +51,13 @@ static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #include #include #include + +#include +#include +#include +#include + + #include "pax.h" #include "options.h" #include "cpio.h" @@ -1477,7 +1487,9 @@ str_offt(char *val) return(num); } -char * +char *fgetln(FILE *f, size_t *); + +static char * getline(FILE *f) { char *name, *temp; @@ -1518,7 +1530,7 @@ no_op(void) * print the usage summary to the user */ -void +static void pax_usage(void) { (void)fputs("usage: pax [-cdnvz] [-E limit] [-f archive] ", stderr); @@ -1552,7 +1564,7 @@ pax_usage(void) * print the usage summary to the user */ -void +static void tar_usage(void) { (void)fputs("usage: tar [-]{crtux}[-befhjmopqsvwyzHLOPXZ014578] [blocksize] ", @@ -1567,7 +1579,7 @@ tar_usage(void) * print the usage summary to the user */ -void +static void cpio_usage(void) { (void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr); diff --git a/include/stdlib.h b/include/stdlib.h index 670893f3c..6dadb4cfd 100755 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -80,7 +80,7 @@ _PROTOTYPE( int putenv, (const char *_name) ); /* According to POSIX, getopt should be in unistd.h. What do we do with * this? */ -_PROTOTYPE(int getopt, (int _argc, char **_argv, char *_opts)); +_PROTOTYPE(int getopt, (int _argc, char * const _argv[], const char *_opts)); extern char *optarg; extern int optind, opterr, optopt; #endif /* _MINIX */ diff --git a/include/strings.h b/include/strings.h index 52bc6024b..f6ce07feb 100644 --- a/include/strings.h +++ b/include/strings.h @@ -7,3 +7,4 @@ _PROTOTYPE( char *index, (const char *_s, int _charwanted) ); _PROTOTYPE( int strcasecmp, (const char *_s1, const char *_s2) ); _PROTOTYPE( int strncasecmp, (const char *_s1, const char *_s2, size_t _len) ); +_PROTOTYPE( int ffs, (int i) ); diff --git a/include/unistd.h b/include/unistd.h index 42ec8728d..d4a25d26b 100755 --- a/include/unistd.h +++ b/include/unistd.h @@ -148,7 +148,7 @@ _PROTOTYPE( int ftruncate, (int _fd, off_t _length) ); /* Open Group Base Specifications Issue 6 (not complete) */ _PROTOTYPE( int symlink, (const char *path1, const char *path2) ); _PROTOTYPE( int readlink, (const char *, char *, size_t) ); -_PROTOTYPE( int getopt, (int _argc, char **_argv, char *_opts) ); +_PROTOTYPE( int getopt, (int _argc, char * const _argv[], char const *_opts) ); extern char *optarg; extern int optind, opterr, optopt; _PROTOTYPE( int usleep, (useconds_t _useconds) ); diff --git a/lib/posix/getopt.c b/lib/posix/getopt.c index b3dee7fcf..11b661a27 100644 --- a/lib/posix/getopt.c +++ b/lib/posix/getopt.c @@ -49,7 +49,7 @@ char *optarg; /* argument associated with option */ * Parse argc/argv argument vector. */ int -getopt(int nargc, char **nargv, char *ostr) +getopt(int nargc, char * const nargv[], const char *ostr) { static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ -- 2.44.0