Subject: bin/6146: [PATCH] Arithmetic: patch to use const
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm@octomino.demon.co.uk>
List: netbsd-bugs
Date: 09/13/1998 12:46:59
>Number:         6146
>Category:       bin
>Synopsis:       [PATCH] Arithmetic: patch to use const
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 13 07:05:00 1998
>Last-Modified:
>Originator:     Joseph Samuel Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release:        NetBSD-current of 1998-09-12
>Environment:
[
System: Linux octomino 2.0.35 #1 Wed Aug 12 15:54:21 UTC 1998 i586 unknown
Architecture: i586
]
>Description:

The patch below makes arithmetic(6) use `const' where appropriate.

>How-To-Repeat:

>Fix:

diff -ruN arithmetic/arithmetic.c arithmetic+/arithmetic.c
--- arithmetic/arithmetic.c	Tue Feb  3 12:33:56 1998
+++ arithmetic+/arithmetic.c	Sun Sep 13 12:43:37 1998
@@ -97,9 +97,9 @@
 void	showstats __P((void));
 void	usage __P((void));
 
-char keylist[] = "+-x/";
-char defaultkeys[] = "+-";
-char *keys = defaultkeys;
+const char keylist[] = "+-x/";
+const char defaultkeys[] = "+-";
+const char *keys = defaultkeys;
 int nkeys = sizeof(defaultkeys) - 1;
 int rangemax = 10;
 int nright, nwrong;
@@ -125,7 +125,7 @@
 	while ((ch = getopt(argc, argv, "r:o:")) != -1)
 		switch(ch) {
 		case 'o': {
-			char *p;
+			const char *p;
 
 			for (p = keys = optarg; *p; ++p)
 				if (!strchr(keylist, *p))
>Audit-Trail:
>Unformatted: