Module Name:    src
Committed By:   dholland
Date:           Thu Aug 13 03:50:02 UTC 2009

Modified Files:
        src/usr.bin/error: error.h filter.c input.c main.c pi.c subr.c touch.c

Log Message:
Sprinkle const.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/error/error.h \
    src/usr.bin/error/filter.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/error/input.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/error/main.c src/usr.bin/error/pi.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/error/subr.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/error/touch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/error/error.h
diff -u src/usr.bin/error/error.h:1.12 src/usr.bin/error/error.h:1.13
--- src/usr.bin/error/error.h:1.12	Thu Aug 13 03:07:49 2009
+++ src/usr.bin/error/error.h	Thu Aug 13 03:50:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: error.h,v 1.12 2009/08/13 03:07:49 dholland Exp $	*/
+/*	$NetBSD: error.h,v 1.13 2009/08/13 03:50:02 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -115,7 +115,7 @@
 
 extern boolean query;
 extern boolean terse;
-int inquire(char *, ...);	/* inquire for yes/no */
+int inquire(const char *, ...);	/* inquire for yes/no */
 
 /*
  * codes for inquire() to return
@@ -131,8 +131,8 @@
  */
 struct lang_desc {
 	char *lang_name;
-	char *lang_incomment;	/* one of the following defines */
-	char *lang_outcomment;	/* one of the following defines */
+	const char *lang_incomment;	/* one of the following defines */
+	const char *lang_outcomment;	/* one of the following defines */
 };
 extern struct lang_desc lang_table[];
 
@@ -212,19 +212,19 @@
 void erroradd(int, char **, Errorclass, Errorclass);
 void filenames(int, Eptr **);
 void findfiles(int, Eptr *, int *, Eptr ***);
-char firstchar(char *);
-void getignored(char *);
-char lastchar(char *);
-char next_lastchar(char *);
+char firstchar(const char *);
+void getignored(const char *);
+char lastchar(const char *);
+char next_lastchar(const char *);
 void onintr(int);
 boolean persperdexplode(char *, char **, char **);
 Errorclass pi(void);
-int position(char *, char);
+int position(const char *, char);
 void printerrors(boolean, int, Eptr []);
-char *plural(int);
+const char *plural(int);
 char *substitute(char *, char, char);
 boolean touchfiles(int, Eptr **, int *, char ***);
-char *verbform(int);
+const char *verbform(int);
 void wordvbuild(char *, int*, char ***);
 int wordvcmp(char **, int, char **);
 void wordvprint(FILE *, int, char **);
Index: src/usr.bin/error/filter.c
diff -u src/usr.bin/error/filter.c:1.12 src/usr.bin/error/filter.c:1.13
--- src/usr.bin/error/filter.c:1.12	Thu Aug 13 03:07:49 2009
+++ src/usr.bin/error/filter.c	Thu Aug 13 03:50:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: filter.c,v 1.12 2009/08/13 03:07:49 dholland Exp $	*/
+/*	$NetBSD: filter.c,v 1.13 2009/08/13 03:50:02 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)filter.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: filter.c,v 1.12 2009/08/13 03:07:49 dholland Exp $");
+__RCSID("$NetBSD: filter.c,v 1.13 2009/08/13 03:50:02 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -47,7 +47,7 @@
 #include "error.h"
 #include "pathnames.h"
 
-static char *lint_libs[] = {
+static const char *lint_libs[] = {
 	IG_FILE1,
 	IG_FILE2,
 	IG_FILE3,
@@ -56,21 +56,21 @@
 };
 
 static int lexsort(const void *, const void *);
-static int search_ignore(char *);
+static int search_ignore(const char *);
 
 /*
  * Read the file ERRORNAME of the names of functions in lint
  * to ignore complaints about.
  */
 void
-getignored(char *auxname)
+getignored(const char *auxname)
 {
 	int i;
 	FILE *fyle;
 	char inbuffer[256];
 	uid_t uid;
 	char filename[MAXPATHLEN];
-	char *username;
+	const char *username;
 	struct passwd *passwdentry;
 
 	nignored = 0;
@@ -134,15 +134,16 @@
 static int
 lexsort(const void *c1, const void *c2)
 {
-	char **cpp1, **cpp2;
+	const char *const *cpp1;
+	const char *const *cpp2;
 
-	cpp1 = (char **)c1;
-	cpp2 = (char **)c2;
+	cpp1 = c1;
+	cpp2 = c2;
 	return (strcmp(*cpp1, *cpp2));
 }
 
 static int
-search_ignore(char *key)
+search_ignore(const char *key)
 {
 	int ub, lb;
 	int halfway;

Index: src/usr.bin/error/input.c
diff -u src/usr.bin/error/input.c:1.13 src/usr.bin/error/input.c:1.14
--- src/usr.bin/error/input.c:1.13	Thu Aug 13 03:07:49 2009
+++ src/usr.bin/error/input.c	Thu Aug 13 03:50:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: input.c,v 1.13 2009/08/13 03:07:49 dholland Exp $	*/
+/*	$NetBSD: input.c,v 1.14 2009/08/13 03:50:02 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)input.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: input.c,v 1.13 2009/08/13 03:07:49 dholland Exp $");
+__RCSID("$NetBSD: input.c,v 1.14 2009/08/13 03:50:02 dholland Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -70,7 +70,7 @@
 {
 	Errorclass errorclass = C_SYNC;
 	char *line;
-	char *inbuffer;
+	const char *inbuffer;
 	size_t inbuflen;
 
     for (;;) {
@@ -121,7 +121,7 @@
 	 Errorclass errorsubclass)
 {
 	Eptr newerror;
-	char *cp;
+	const char *cp;
 
 	if (errorclass == C_TRUE) {
 		/* check canonicalization of the second argument*/

Index: src/usr.bin/error/main.c
diff -u src/usr.bin/error/main.c:1.14 src/usr.bin/error/main.c:1.15
--- src/usr.bin/error/main.c:1.14	Thu Aug 13 03:10:03 2009
+++ src/usr.bin/error/main.c	Thu Aug 13 03:50:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.14 2009/08/13 03:10:03 dholland Exp $	*/
+/*	$NetBSD: main.c,v 1.15 2009/08/13 03:50:02 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: main.c,v 1.14 2009/08/13 03:10:03 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.15 2009/08/13 03:50:02 dholland Exp $");
 #endif /* not lint */
 
 #include <signal.h>
@@ -274,7 +274,8 @@
 static int
 errorsort(const void *x1, const void *x2)
 {
-	Eptr *epp1 = (Eptr *)x1, *epp2 = (Eptr *)x2;
+	const Eptr *epp1 = x1;
+	const Eptr *epp2 = x2;
 	Eptr ep1, ep2;
 	int order;
 
Index: src/usr.bin/error/pi.c
diff -u src/usr.bin/error/pi.c:1.14 src/usr.bin/error/pi.c:1.15
--- src/usr.bin/error/pi.c:1.14	Thu Aug 13 03:07:49 2009
+++ src/usr.bin/error/pi.c	Thu Aug 13 03:50:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pi.c,v 1.14 2009/08/13 03:07:49 dholland Exp $	*/
+/*	$NetBSD: pi.c,v 1.15 2009/08/13 03:50:02 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)pi.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: pi.c,v 1.14 2009/08/13 03:07:49 dholland Exp $");
+__RCSID("$NetBSD: pi.c,v 1.15 2009/08/13 03:50:02 dholland Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -47,10 +47,10 @@
 static char *unk_hdr[] = {"In", "program", "???"};
 static char **c_header = &unk_hdr[0];
 
-static boolean alldigits(char *);
+static boolean alldigits(const char *);
 static boolean isdateformat(int, char **);
-static boolean instringset(char *, char **);
-static boolean piptr(char *);
+static boolean instringset(const char *, char **);
+static boolean piptr(const char *);
 
 
 /*
@@ -163,7 +163,7 @@
 static char *pi_imp2[] = {"improperly", "used", "on", "lines"};
 
 static boolean
-alldigits(char *string)
+alldigits(const char *string)
 {
 	for (; *string && isdigit((unsigned char)*string); string++)
 		continue;
@@ -171,7 +171,7 @@
 }
 
 static boolean
-instringset(char *member, char **set)
+instringset(const char *member, char **set)
 {
 	for (; *set; set++) {
 		if (strcmp(*set, member) == 0)
@@ -192,7 +192,7 @@
 }
 
 static boolean
-piptr(char *string)
+piptr(const char *string)
 {
 	if (*string != '-')
 		return (FALSE);

Index: src/usr.bin/error/subr.c
diff -u src/usr.bin/error/subr.c:1.16 src/usr.bin/error/subr.c:1.17
--- src/usr.bin/error/subr.c:1.16	Thu Aug 13 03:07:49 2009
+++ src/usr.bin/error/subr.c	Thu Aug 13 03:50:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr.c,v 1.16 2009/08/13 03:07:49 dholland Exp $	*/
+/*	$NetBSD: subr.c,v 1.17 2009/08/13 03:50:02 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)subr.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: subr.c,v 1.16 2009/08/13 03:07:49 dholland Exp $");
+__RCSID("$NetBSD: subr.c,v 1.17 2009/08/13 03:50:02 dholland Exp $");
 #endif /* not lint */
 
 #include <ctype.h>
@@ -85,7 +85,7 @@
  * (one based)
  */
 int
-position(char *string, char ch)
+position(const char *string, char ch)
 {
 	int i;
 
@@ -117,7 +117,7 @@
 }
 
 char
-lastchar(char *string)
+lastchar(const char *string)
 {
 	int length;
 
@@ -131,7 +131,7 @@
 }
 
 char
-firstchar(char *string)
+firstchar(const char *string)
 {
 	if (string)
 		return (string[0]);
@@ -140,7 +140,7 @@
 }
 
 char
-next_lastchar(char *string)
+next_lastchar(const char *string)
 {
 	int length;
 
@@ -291,7 +291,7 @@
 wordvprint(FILE *fyle, int wordc, char **wordv)
 {
 	int i;
-	char *sep = "";
+	const char *sep = "";
 
 	for (i = 0; i < wordc; i++)
 		if (wordv[i]) {
@@ -384,16 +384,16 @@
 /*
  * plural'ize and verb forms
  */
-static char *S = "s";
-static char *N = "";
+static const char *S = "s";
+static const char *N = "";
 
-char *
+const char *
 plural(int n)
 {
 	return (n > 1 ? S : N);
 }
 
-char *
+const char *
 verbform(int n)
 {
 	return (n > 1 ? N : S);

Index: src/usr.bin/error/touch.c
diff -u src/usr.bin/error/touch.c:1.18 src/usr.bin/error/touch.c:1.19
--- src/usr.bin/error/touch.c:1.18	Thu Aug 13 03:07:49 2009
+++ src/usr.bin/error/touch.c	Thu Aug 13 03:50:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.18 2009/08/13 03:07:49 dholland Exp $	*/
+/*	$NetBSD: touch.c,v 1.19 2009/08/13 03:50:02 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)touch.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.18 2009/08/13 03:07:49 dholland Exp $");
+__RCSID("$NetBSD: touch.c,v 1.19 2009/08/13 03:50:02 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -71,20 +71,20 @@
 
 static int countfiles(Eptr *);
 static int nopertain(Eptr **);
-static void hackfile(char *, Eptr **, int, int);
-static boolean preview(char *,  int, Eptr **, int);
-static int settotouch(char *);
-static void diverterrors(char *, int, Eptr **, int, boolean,  int);
-static int oktotouch(char *);
+static void hackfile(const char *, Eptr **, int, int);
+static boolean preview(const char *,  int, Eptr **, int);
+static int settotouch(const char *);
+static void diverterrors(const char *, int, Eptr **, int, boolean,  int);
+static int oktotouch(const char *);
 static void execvarg(int, int *, char ***);
-static boolean edit(char *);
+static boolean edit(const char *);
 static void insert(int);
 static void text(Eptr, boolean);
 static boolean writetouched(int);
 static int mustoverwrite(FILE *, FILE *);
-static int mustwrite(char *, int, FILE *);
+static int mustwrite(const char *, int, FILE *);
 static void errorprint(FILE *, Eptr, boolean);
-static int probethisfile(char *);
+static int probethisfile(const char *);
 
 void
 findfiles(int nerrors, Eptr *errors, int *r_nfiles, Eptr ***r_files)
@@ -92,7 +92,7 @@
 	int nfiles;
 	Eptr **files;
 
-	char *name;
+	const char *name;
 	int ei;
 	int fi;
 	Eptr errorp;
@@ -139,7 +139,7 @@
 static int
 countfiles(Eptr *errors)
 {
-	char *name;
+	const char *name;
 	int ei;
 	Eptr errorp;
 	int nfiles;
@@ -175,7 +175,7 @@
 filenames(int nfiles, Eptr **files)
 {
 	int fi;
-	char *sep = " ";
+	const char *sep = " ";
 	int someerrors;
 
 	/*
@@ -245,7 +245,7 @@
 boolean
 touchfiles(int nfiles, Eptr **files, int *r_edargc, char ***r_edargv)
 {
-	char *name;
+	const char *name;
 	Eptr errorp;
 	int fi;
 	Eptr *erpp;
@@ -299,7 +299,7 @@
 }
 
 static void
-hackfile(char *name, Eptr **files, int ix, int nerrors)
+hackfile(const char *name, Eptr **files, int ix, int nerrors)
 {
 	boolean previewed;
 	int errordest;	/* where errors go */
@@ -329,7 +329,7 @@
 }
 
 static boolean
-preview(char *name, int nerrors, Eptr **files, int ix)
+preview(const char *name, int nerrors, Eptr **files, int ix)
 {
 	int back;
 	Eptr *erpp;
@@ -358,7 +358,7 @@
 }
 
 static int
-settotouch(char *name)
+settotouch(const char *name)
 {
 	int dest = TOSTDOUT;
 
@@ -408,8 +408,8 @@
 }
 
 static void
-diverterrors(char *name, int dest, Eptr **files, int ix, boolean previewed,
-	     int nterrors)
+diverterrors(const char *name, int dest, Eptr **files, int ix,
+	     boolean previewed, int nterrors)
 {
 	int nerrors;
 	Eptr *erpp;
@@ -448,11 +448,11 @@
 }
 
 static int
-oktotouch(char *filename)
+oktotouch(const char *filename)
 {
-	char *src;
+	const char *src;
 	char *pat;
-	char *osrc;
+	const char *osrc;
 
 	pat = suffixlist;
 	if (pat == 0)
@@ -503,7 +503,7 @@
 execvarg(int n_pissed_on, int *r_argc, char ***r_argv)
 {
 	Eptr p;
-	char *sep;
+	const char *sep;
 	int fi;
 
 	sep = NULL;
@@ -532,7 +532,7 @@
 
 static FILE *o_touchedfile;	/* the old file */
 static FILE *n_touchedfile;	/* the new file */
-static char *o_name;
+static const char *o_name;
 static char n_name[MAXPATHLEN];
 static int o_lineno;
 static int n_lineno;
@@ -543,7 +543,7 @@
  * Well, if it isn't, then return TRUE if something failed
  */
 static boolean
-edit(char *name)
+edit(const char *name)
 {
 	int fd;
 	const char *tmpdir;
@@ -689,7 +689,7 @@
  * return 0 on catastrophe
  */
 static int
-mustwrite(char *base, int n, FILE *preciousfile)
+mustwrite(const char *base, int n, FILE *preciousfile)
 {
 	int nwrote;
 
@@ -761,7 +761,7 @@
 }
 
 int
-inquire(char *fmt, ...)
+inquire(const char *fmt, ...)
 {
 	va_list ap;
 	char buffer[128];
@@ -787,7 +787,7 @@
 }
 
 static int
-probethisfile(char *name)
+probethisfile(const char *name)
 {
 	struct stat statbuf;
 

Reply via email to