DragonFly BSD
DragonFly submit List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: usr.bin/ar patcg


From: Max Okumoto <okumoto@xxxxxxxx>
Date: Thu, 13 Jan 2005 05:58:41 -0800

Sergey Gluschenko wrote:
http://xlab.users.sevsky.net/dfly/ar.patch

Hi Sergey,


I looked over your patch and will commit it
to the tree if you could do two things.
	o write a small synopsis of what you changed
	o moved the envtmp declaration into extern.h
	  instead of just out of function scope.

Could you also submit a patch to remove the (void)
cast of functions that don't use a return value?

Thanks for the work.

Max Okumoto
diff -ru ar/Makefile ar.local/Makefile
--- ar/Makefile	2005-01-13 03:05:38.000000000 +0200
+++ ar.local/Makefile	2005-01-13 01:38:50.000000000 +0200
@@ -8,5 +8,6 @@
 	move.c print.c replace.c
 MAN=	ar.1aout ar.5
 BINDIR=	/usr/libexec/binutils212/aout
+WARNS?= 6
 
 .include <bsd.prog.mk>
diff -ru ar/ar.c ar.local/ar.c
--- ar/ar.c	2003-11-03 21:31:28.000000000 +0200
+++ ar.local/ar.c	2005-01-13 01:54:27.000000000 +0200
@@ -58,8 +58,9 @@
 
 CHDR chdr;
 u_int options;
-char *archive, *envtmp, *posarg, *posname;
-static void badoptions(char *);
+char *archive, *posarg, *posname;
+char const *envtmp;
+static void badoptions(char const*);
 static void usage(void);
 
 /*
@@ -210,7 +211,7 @@
 }
 
 static void
-badoptions(char *arg)
+badoptions(char const *arg)
 {
 
 	warnx("illegal option combination for %s", arg);
diff -ru ar/archive.c ar.local/archive.c
--- ar/archive.c	2003-10-02 20:42:25.000000000 +0300
+++ ar.local/archive.c	2005-01-13 02:09:17.000000000 +0200
@@ -225,7 +225,7 @@
 			    (long)sb->st_mtimespec.tv_sec, sb->st_uid,
 			    sb->st_gid, sb->st_mode, sb->st_size, ARFMAG);
 			lname = 0;
-		} else if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
+		} else if (lname > (long)sizeof(hdr->ar_name) || strchr(name, ' '))
 			(void)sprintf(hb, HDR1, AR_EFMT1, lname,
 			    (long)sb->st_mtimespec.tv_sec, sb->st_uid,
 			    sb->st_gid, sb->st_mode, sb->st_size + lname,
diff -ru ar/archive.h ar.local/archive.h
--- ar/archive.h	2003-11-03 21:31:28.000000000 +0200
+++ ar.local/archive.h	2005-01-13 02:26:34.000000000 +0200
@@ -66,9 +66,9 @@
 /* File copy structure. */
 typedef struct {
 	int rfd;			/* read file descriptor */
-	char *rname;			/* read name */
+	char const *rname;			/* read name */
 	int wfd;			/* write file descriptor */
-	char *wname;			/* write name */
+	char const *wname;			/* write name */
 #define	NOPAD	0x00			/* don't pad */
 #define	RPAD	0x01			/* pad on reads */
 #define	WPAD	0x02			/* pad on writes */
diff -ru ar/extern.h ar.local/extern.h
--- ar/extern.h	2003-11-03 21:31:28.000000000 +0200
+++ ar.local/extern.h	2005-01-13 02:17:23.000000000 +0200
@@ -40,7 +40,7 @@
 int	compare(char *);
 int	contents(char **);
 int	delete(char **);
-void	error(char *);
+void	error(char const*);
 int	extract(char **);
 char   *files(char **argv);
 int	move(char **);
@@ -51,5 +51,5 @@
 
 extern char *archive;
 extern char *posarg, *posname;		/* positioning file name */
-extern char *tname;                     /* temporary file "name" */
+extern char const *tname;           /* temporary file "name" */
 extern CHDR chdr;			/* converted header */
diff -ru ar/misc.c ar.local/misc.c
--- ar/misc.c	2003-10-02 20:42:25.000000000 +0300
+++ ar.local/misc.c	2005-01-13 02:14:24.000000000 +0200
@@ -54,12 +54,12 @@
 #include "extern.h"
 #include "pathnames.h"
 
-char *tname = "temporary file";		/* temporary file "name" */
+char const*tname = "temporary file";		/* temporary file "name" */
+extern char *envtmp;
 
 int
 tmp(void)
 {
-	extern char *envtmp;
 	sigset_t set, oset;
 	static int first;
 	int fd;
@@ -127,7 +127,7 @@
 }
 
 void
-error(char *name)
+error(char const *name)
 {
 
 	err(1, "%s", name);


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]