summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-12-02 12:36:35 +0000
committermarkm <markm@FreeBSD.org>2001-12-02 12:36:35 +0000
commit9c4ab2cc6f3bb82ffeec94e189dddf1dd9441000 (patch)
tree8781c2ade3907af81b3cb15379555b839c1ecdfd
parent54f12414b9d4516defafc83ba6476f53fd487c29 (diff)
downloadFreeBSD-src-9c4ab2cc6f3bb82ffeec94e189dddf1dd9441000.zip
FreeBSD-src-9c4ab2cc6f3bb82ffeec94e189dddf1dd9441000.tar.gz
WARNS=2 fixup.
-rw-r--r--usr.bin/ar/Makefile3
-rw-r--r--usr.bin/ar/ar.c7
-rw-r--r--usr.bin/ar/archive.c4
-rw-r--r--usr.bin/ar/archive.h5
-rw-r--r--usr.bin/ar/extern.h4
-rw-r--r--usr.bin/ar/misc.c4
-rw-r--r--usr.bin/c89/Makefile1
-rw-r--r--usr.bin/c89/c89.c24
8 files changed, 30 insertions, 22 deletions
diff --git a/usr.bin/ar/Makefile b/usr.bin/ar/Makefile
index d195769..61a27c40 100644
--- a/usr.bin/ar/Makefile
+++ b/usr.bin/ar/Makefile
@@ -2,9 +2,10 @@
# $FreeBSD$
PROG= ar
-CFLAGS+=-I${.CURDIR} -Wall
SRCS= append.c ar.c archive.c contents.c delete.c extract.c misc.c \
move.c print.c replace.c
+CFLAGS+=-I${.CURDIR}
+WARNS?= 2
MAN= ar.1aout ar.5
BINDIR= /usr/libexec/aout
diff --git a/usr.bin/ar/ar.c b/usr.bin/ar/ar.c
index 73dab41..dc38da2 100644
--- a/usr.bin/ar/ar.c
+++ b/usr.bin/ar/ar.c
@@ -64,8 +64,9 @@ static const char sccsid[] = "@(#)ar.c 8.3 (Berkeley) 4/2/94";
CHDR chdr;
u_int options;
-char *archive, *envtmp, *posarg, *posname;
-static void badoptions __P((char *));
+char *archive, *posarg, *posname;
+const char *envtmp;
+static void badoptions __P((const char *));
static void usage __P((void));
/*
@@ -219,7 +220,7 @@ main(argc, argv)
static void
badoptions(arg)
- char *arg;
+ const char *arg;
{
warnx("illegal option combination for %s", arg);
diff --git a/usr.bin/ar/archive.c b/usr.bin/ar/archive.c
index 32cdfa6..e09cb67 100644
--- a/usr.bin/ar/archive.c
+++ b/usr.bin/ar/archive.c
@@ -201,7 +201,7 @@ put_arobj(cfp, sb)
CF *cfp;
struct stat *sb;
{
- int lname;
+ size_t lname;
char *name;
struct ar_hdr *hdr;
off_t size;
@@ -253,7 +253,7 @@ put_arobj(cfp, sb)
if (write(cfp->wfd, hb, sizeof(HDR)) != sizeof(HDR))
error(cfp->wname);
if (lname) {
- if (write(cfp->wfd, name, lname) != lname)
+ if ((size_t)write(cfp->wfd, name, lname) != lname)
error(cfp->wname);
already_written = lname;
}
diff --git a/usr.bin/ar/archive.h b/usr.bin/ar/archive.h
index fb4ffeb..f517a95 100644
--- a/usr.bin/ar/archive.h
+++ b/usr.bin/ar/archive.h
@@ -34,6 +34,7 @@
* SUCH DAMAGE.
*
* @(#)archive.h 8.3 (Berkeley) 4/2/94
+ * $FreeBSD$
*/
/* Ar(1) options. */
@@ -65,9 +66,9 @@ extern u_int options;
/* File copy structure. */
typedef struct {
int rfd; /* read file descriptor */
- char *rname; /* read name */
+ const char *rname; /* read name */
int wfd; /* write file descriptor */
- char *wname; /* write name */
+ const char *wname; /* write name */
#define NOPAD 0x00 /* don't pad */
#define RPAD 0x01 /* pad on reads */
#define WPAD 0x02 /* pad on writes */
diff --git a/usr.bin/ar/extern.h b/usr.bin/ar/extern.h
index 0efb771d..a27f72a 100644
--- a/usr.bin/ar/extern.h
+++ b/usr.bin/ar/extern.h
@@ -39,7 +39,7 @@ void badfmt __P((void));
int compare __P((char *));
int contents __P((char **));
int delete __P((char **));
-void error __P((char *));
+void error __P((const char *));
int extract __P((char **));
char *files __P((char **argv));
int move __P((char **));
@@ -50,5 +50,5 @@ int tmp __P((void));
extern char *archive;
extern char *posarg, *posname; /* positioning file name */
-extern char *tname; /* temporary file "name" */
+extern const char *tname; /* temporary file "name" */
extern CHDR chdr; /* converted header */
diff --git a/usr.bin/ar/misc.c b/usr.bin/ar/misc.c
index 0a0dd1b..e61d7b8 100644
--- a/usr.bin/ar/misc.c
+++ b/usr.bin/ar/misc.c
@@ -56,7 +56,7 @@ static const char rcsid[] =
#include "extern.h"
#include "pathnames.h"
-char *tname = "temporary file"; /* temporary file "name" */
+const char *tname = "temporary file"; /* temporary file "name" */
int
tmp()
@@ -134,7 +134,7 @@ badfmt()
void
error(name)
- char *name;
+ const char *name;
{
err(1, "%s", name);
diff --git a/usr.bin/c89/Makefile b/usr.bin/c89/Makefile
index f398af6..8b4b4c0 100644
--- a/usr.bin/c89/Makefile
+++ b/usr.bin/c89/Makefile
@@ -1,6 +1,7 @@
# $FreeBSD$
PROG= c89
+WARNS?= 2
MAN= c89.1
.include <bsd.prog.mk>
diff --git a/usr.bin/c89/c89.c b/usr.bin/c89/c89.c
index 2843529..9559f02 100644
--- a/usr.bin/c89/c89.c
+++ b/usr.bin/c89/c89.c
@@ -47,7 +47,7 @@ static const char rcsid[] =
* benefit of making c89 -D_ANSI_SOURCE do the right thing (or any other
* -D_FOO_SOURCE feature test macro we support.)
*/
-static char *args_prepended[] = {
+static const char *args_prepended[] = {
"-std=iso9899:199409",
"-pedantic"
};
@@ -63,15 +63,19 @@ int
main(int argc, char **argv)
{
int Argc, i;
- char **Argv;
+ size_t j;
+ union {
+ const char **a;
+ char * const *b;
+ } Argv;
Argc = 0;
- Argv = malloc((argc + 1 + N_ARGS_PREPENDED) * sizeof *Argv);
- if (Argv == NULL)
+ Argv.a = malloc((argc + 1 + N_ARGS_PREPENDED) * sizeof *Argv.a);
+ if (Argv.a == NULL)
err(1, "malloc");
- Argv[Argc++] = argv[0];
- for (i = 0; i < N_ARGS_PREPENDED; ++i)
- Argv[Argc++] = args_prepended[i];
+ Argv.a[Argc++] = argv[0];
+ for (j = 0; j < N_ARGS_PREPENDED; ++j)
+ Argv.a[Argc++] = args_prepended[j];
while ((i = getopt(argc, argv, "cD:EgI:l:L:o:OsU:")) != -1) {
if (i == '?')
usage();
@@ -88,10 +92,10 @@ main(int argc, char **argv)
usage();
}
- /* Append argv[1..] at the end of Argv[]. */
+ /* Append argv[1..] at the end of Argv[].a. */
for (i = 1; i <= argc; ++i)
- Argv[Argc++] = argv[i];
- (void)execv(CC, Argv);
+ Argv.a[Argc++] = argv[i];
+ (void)execv(CC, Argv.b);
err(1, "execv(" CC ")");
}
OpenPOWER on IntegriCloud