Compiling bin/ed with WARNS=6

Giorgos Keramidas <[email protected]>
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
There are only two small changes that need to be done to ed(1) to make
it compile cleanly with WARNS=6 in i386/CURRENT.  I have tested the
following changes by doing:

	$ cd src/bin/ed
	$ make WARNS=6 cleandir all
	$ ./ed -x /tmp/foo
	Enter key: foobar123

	$ /bin/ed -x /tmp/foo
	Enter key: foobar123

How does it look?

%%%
Declare an array of bytes as `char[]' and not `unsigned char[]'.
Move two `extern' declarations outside of a function body.
This enables ed to build with WARNS=6.

Index: ed/Makefile
===================================================================
RCS file: /home/ncvs/src/bin/ed/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- ed/Makefile	6 Dec 2001 10:50:23 -0000	1.21
+++ ed/Makefile	9 Jun 2002 04:53:26 -0000
@@ -2,6 +2,7 @@
 
 PROG=	ed
 SRCS=	buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c
+WARNS=	6
 LINKS=	${BINDIR}/ed ${BINDIR}/red
 MLINKS=	ed.1 red.1
 
Index: ed/cbc.c
===================================================================
RCS file: /home/ncvs/src/bin/ed/cbc.c,v
retrieving revision 1.15
diff -u -r1.15 cbc.c
--- ed/cbc.c	2 Feb 2002 06:36:49 -0000	1.15
+++ ed/cbc.c	9 Jun 2002 04:51:14 -0000
@@ -95,7 +95,7 @@
 };
 int pflag;				/* 1 to preserve parity bits */
 
-unsigned char des_buf[8];	/* shared buffer for get_des_char/put_des_char */
+char des_buf[8];		/* shared buffer for get_des_char/put_des_char */
 int des_ct = 0;			/* count for get_des_char/put_des_char */
 int des_n = 0;			/* index for put_des_char/get_des_char */
 
Index: ed/main.c
===================================================================
RCS file: /home/ncvs/src/bin/ed/main.c,v
retrieving revision 1.22
diff -u -r1.22 main.c
--- ed/main.c	2 Feb 2002 06:36:49 -0000	1.22
+++ ed/main.c	9 Jun 2002 04:48:27 -0000
@@ -444,14 +444,14 @@
 
 long rows = 22;		/* scroll length: ws_row - 2 */
 
+extern long u_current_addr;
+extern long u_addr_last;
+
 /* exec_command: execute the next command in command buffer; return print
    request, if any */
 int
 exec_command(void)
 {
-	extern long u_current_addr;
-	extern long u_addr_last;
-
 	static pattern_t *pat = NULL;
 	static int sgflag = 0;
 	static long sgnum = 0;
%%%

- Giorgos


To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.