Module Name: src Committed By: dholland Date: Thu Aug 13 02:10:50 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 static To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/error/error.h \ src/usr.bin/error/filter.c cvs rdiff -u -r1.11 -r1.12 src/usr.bin/error/input.c src/usr.bin/error/main.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/error/pi.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/error/subr.c cvs rdiff -u -r1.16 -r1.17 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.10 src/usr.bin/error/error.h:1.11 --- src/usr.bin/error/error.h:1.10 Thu Jul 19 05:43:23 2007 +++ src/usr.bin/error/error.h Thu Aug 13 02:10:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: error.h,v 1.10 2007/07/19 05:43:23 lukem Exp $ */ +/* $NetBSD: error.h,v 1.11 2009/08/13 02:10:50 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -123,15 +123,6 @@ #define Q_YES 3 /* 'Y' */ #define Q_yes 4 /* 'y' */ -int probethisfile(char *); -/* - * codes for probethisfile to return - */ -#define F_NOTEXIST 1 -#define F_NOTREAD 2 -#define F_NOTWRITE 3 -#define F_TOUCHIT 4 - /* * Describes attributes about a language */ @@ -189,7 +180,7 @@ */ extern int nerrors; extern Eptr er_head; -extern Eptr *errors; + /* * Resources for each of the files mentioned */ @@ -210,40 +201,25 @@ void arrayify(int *, Eptr **, Eptr); char *Calloc(int, int); void clob_last(char *, char); -int countfiles(Eptr *); Errorclass discardit(Eptr); -void diverterrors(char *, int, Eptr **, int, boolean, int); void eaterrors(int *, Eptr **); -boolean edit(char *); void erroradd(int, char **, Errorclass, Errorclass); -void errorprint(FILE *, Eptr, boolean); -void execvarg(int, int *, char ***); void filenames(int, Eptr **); void findfiles(int, Eptr *, int *, Eptr ***); char firstchar(char *); void getignored(char *); -void hackfile(char *, Eptr **, int, int); -void insert(int); char lastchar(char *); -int mustoverwrite(FILE *, FILE *); -int mustwrite(char *, int, FILE *); char next_lastchar(char *); -int nopertain(Eptr **); -int oktotouch(char *); void onintr(int); boolean persperdexplode(char *, char **, char **); +Errorclass pi(void); int position(char *, char); -boolean preview(char *, int, Eptr **, int); void printerrors(boolean, int, Eptr []); char *plural(int); -boolean qpersperdexplode(char *, char **, char **); -int settotouch(char *); char *substitute(char *, char, char); -void text(Eptr, boolean); boolean touchfiles(int, Eptr **, int *, char ***); char *verbform(int); void wordvbuild(char *, int*, char ***); int wordvcmp(char **, int, char **); void wordvprint(FILE *, int, char **); char **wordvsplice(int, int, char **); -boolean writetouched(int); Index: src/usr.bin/error/filter.c diff -u src/usr.bin/error/filter.c:1.10 src/usr.bin/error/filter.c:1.11 --- src/usr.bin/error/filter.c:1.10 Thu Aug 7 11:13:37 2003 +++ src/usr.bin/error/filter.c Thu Aug 13 02:10:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: filter.c,v 1.10 2003/08/07 11:13:37 agc Exp $ */ +/* $NetBSD: filter.c,v 1.11 2009/08/13 02:10:50 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.10 2003/08/07 11:13:37 agc Exp $"); +__RCSID("$NetBSD: filter.c,v 1.11 2009/08/13 02:10:50 dholland Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -47,15 +47,16 @@ #include "error.h" #include "pathnames.h" -char *lint_libs[] = { +static char *lint_libs[] = { IG_FILE1, IG_FILE2, IG_FILE3, IG_FILE4, 0 }; -int lexsort(const void *, const void *); -int search_ignore(char *); + +static int lexsort(const void *, const void *); +static int search_ignore(char *); /* * Read the file ERRORNAME of the names of functions in lint @@ -129,7 +130,7 @@ #endif } -int +static int lexsort(const void *c1, const void *c2) { char **cpp1, **cpp2; @@ -139,7 +140,7 @@ return(strcmp(*cpp1, *cpp2)); } -int +static int search_ignore(char *key) { int ub, lb; Index: src/usr.bin/error/input.c diff -u src/usr.bin/error/input.c:1.11 src/usr.bin/error/input.c:1.12 --- src/usr.bin/error/input.c:1.11 Sun Apr 9 19:27:22 2006 +++ src/usr.bin/error/input.c Thu Aug 13 02:10:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.11 2006/04/09 19:27:22 christos Exp $ */ +/* $NetBSD: input.c,v 1.12 2009/08/13 02:10:50 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.11 2006/04/09 19:27:22 christos Exp $"); +__RCSID("$NetBSD: input.c,v 1.12 2009/08/13 02:10:50 dholland Exp $"); #endif /* not lint */ #include <stdio.h> @@ -46,21 +46,20 @@ int wordc; /* how long the current error message is */ char **wordv; /* the actual error message */ -Errorclass catchall(void); -Errorclass cpp(void); -Errorclass f77(void); -Errorclass lint0(void); -Errorclass lint1(void); -Errorclass lint2(void); -Errorclass lint3(void); -Errorclass make(void); -Errorclass mod2(void); -Errorclass onelong(void); -Errorclass pccccom(void); /* Portable C Compiler C Compiler */ -Errorclass pi(void); -Errorclass ri(void); -Errorclass richieccom(void); /* Richie Compiler for 11 */ -Errorclass troff(void); +static Errorclass catchall(void); +static Errorclass cpp(void); +static Errorclass f77(void); +static Errorclass lint0(void); +static Errorclass lint1(void); +static Errorclass lint2(void); +static Errorclass lint3(void); +static Errorclass make(void); +static Errorclass mod2(void); +static Errorclass onelong(void); +static Errorclass pccccom(void); /* Portable C Compiler C Compiler */ +static Errorclass ri(void); +static Errorclass richieccom(void); /* Richie Compiler for 11 */ +static Errorclass troff(void); /* * Eat all of the lines in the input file, attempting to categorize @@ -159,7 +158,7 @@ } /* length > 0 */ } -Errorclass +static Errorclass onelong(void) { char **nwordv; @@ -206,7 +205,7 @@ return(C_UNKNOWN); } /* end of one long */ -Errorclass +static Errorclass cpp(void) { /* @@ -231,7 +230,7 @@ return(C_UNKNOWN); } /*end of cpp*/ -Errorclass +static Errorclass pccccom(void) { /* @@ -272,7 +271,7 @@ * */ -Errorclass +static Errorclass richieccom(void) { char *cp; @@ -303,7 +302,7 @@ return(C_UNKNOWN); } -Errorclass +static Errorclass lint0(void) { char **nwordv; @@ -334,7 +333,7 @@ return (C_UNKNOWN); } -Errorclass +static Errorclass lint1(void) { char *line1 = NULL, *line2 = NULL; @@ -380,7 +379,7 @@ return(C_UNKNOWN); } /* end of lint 1*/ -Errorclass +static Errorclass lint2(void) { char *file; @@ -412,10 +411,10 @@ return(C_UNKNOWN); } /* end of lint 2*/ -char *Lint31[4] = {"returns", "value", "which", "is"}; -char *Lint32[6] = {"value", "is", "used,", "but", "none", "returned"}; +static char *Lint31[4] = {"returns", "value", "which", "is"}; +static char *Lint32[6] = {"value", "is", "used,", "but", "none", "returned"}; -Errorclass +static Errorclass lint3(void) { if (wordc < 3) @@ -431,12 +430,12 @@ /* * Special word vectors for use by F77 recognition */ -char *F77_fatal[3] = {"Compiler", "error", "line"}; -char *F77_error[3] = {"Error", "on", "line"}; -char *F77_warning[3] = {"Warning", "on", "line"}; -char *F77_no_ass[3] = {"Error.","No","assembly."}; +static char *F77_fatal[3] = {"Compiler", "error", "line"}; +static char *F77_error[3] = {"Error", "on", "line"}; +static char *F77_warning[3] = {"Warning", "on", "line"}; +static char *F77_no_ass[3] = {"Error.","No","assembly."}; -Errorclass +static Errorclass f77(void) { char **nwordv; @@ -474,10 +473,10 @@ return(C_UNKNOWN); } /* end of f77 */ -char *Make_Croak[3] = {"***", "Error", "code"}; -char *Make_NotRemade[5] = {"not", "remade", "because", "of", "errors"}; +static char *Make_Croak[3] = {"***", "Error", "code"}; +static char *Make_NotRemade[5] = {"not", "remade", "because", "of", "errors"}; -Errorclass +static Errorclass make(void) { if (wordvcmp(wordv+1, 3, Make_Croak) == 0){ @@ -491,7 +490,7 @@ return(C_UNKNOWN); } -Errorclass +static Errorclass ri(void) { /* @@ -529,7 +528,7 @@ return(C_UNKNOWN); } -Errorclass +static Errorclass catchall(void) { /* @@ -539,7 +538,7 @@ return(C_NONSPEC); } /* end of catch all*/ -Errorclass +static Errorclass troff(void) { /* @@ -568,7 +567,7 @@ return(C_UNKNOWN); } -Errorclass +static Errorclass mod2(void) { /* Index: src/usr.bin/error/main.c diff -u src/usr.bin/error/main.c:1.11 src/usr.bin/error/main.c:1.12 --- src/usr.bin/error/main.c:1.11 Mon Jul 21 14:19:22 2008 +++ src/usr.bin/error/main.c Thu Aug 13 02:10:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.11 2008/07/21 14:19:22 lukem Exp $ */ +/* $NetBSD: main.c,v 1.12 2009/08/13 02:10:50 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.11 2008/07/21 14:19:22 lukem Exp $"); +__RCSID("$NetBSD: main.c,v 1.12 2009/08/13 02:10:50 dholland Exp $"); #endif /* not lint */ #include <signal.h> @@ -59,7 +59,7 @@ int nerrors = 0; Eptr er_head; -Eptr *errors; +static Eptr *errors; int nfiles = 0; Eptr **files; /* array of pointers into errors*/ @@ -68,19 +68,18 @@ char *currentfilename = "????"; char *processname; -char im_on[] = _PATH_TTY; /* my tty name */ boolean query = FALSE; /* query the operator if touch files */ -boolean notouch = FALSE; /* don't touch ANY files */ -boolean piflag = FALSE; /* this is not pi */ boolean terse = FALSE; /* Terse output */ +static char im_on[] = _PATH_TTY; /* my tty name */ +static boolean notouch = FALSE; /* don't touch ANY files */ + char *suffixlist = ".*"; /* initially, can touch any file */ -int errorsort(const void *, const void *); -void forkvi(int, char **); -int main(int, char **); -void try(char *, int, char **); +static int errorsort(const void *, const void *); +static void forkvi(int, char **); +static void try(char *, int, char **); /* * error [-I ignorename] [-n] [-q] [-t suffixlist] [-s] [-v] [infile] @@ -226,7 +225,7 @@ return (0); } -void +static void forkvi(int argc, char **argv) { if (query){ @@ -252,7 +251,7 @@ fprintf(stdout, "Can't find any editors.\n"); } -void +static void try(char *name, int argc, char **argv) { argv[0] = name; @@ -268,7 +267,8 @@ execvp(name, argv); } -int errorsort(const void *x1, const void *x2) +static int +errorsort(const void *x1, const void *x2) { Eptr *epp1 = (Eptr *)x1, *epp2 = (Eptr *)x2; Eptr ep1, ep2; Index: src/usr.bin/error/pi.c diff -u src/usr.bin/error/pi.c:1.12 src/usr.bin/error/pi.c:1.13 --- src/usr.bin/error/pi.c:1.12 Sun Apr 9 19:21:26 2006 +++ src/usr.bin/error/pi.c Thu Aug 13 02:10:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pi.c,v 1.12 2006/04/09 19:21:26 christos Exp $ */ +/* $NetBSD: pi.c,v 1.13 2009/08/13 02:10:50 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.12 2006/04/09 19:21:26 christos Exp $"); +__RCSID("$NetBSD: pi.c,v 1.13 2009/08/13 02:10:50 dholland Exp $"); #endif /* not lint */ #include <stdio.h> @@ -47,11 +47,10 @@ static char *unk_hdr[] = {"In", "program", "???"}; static char **c_header = &unk_hdr[0]; -boolean alldigits(char *); -boolean isdateformat(int, char **); -boolean instringset(char *, char **); -Errorclass pi(void); -boolean piptr(char *); +static boolean alldigits(char *); +static boolean isdateformat(int, char **); +static boolean instringset(char *, char **); +static boolean piptr(char *); /* @@ -137,33 +136,33 @@ * w - function bletch is never used * E - z undefined on lines 9 13 */ -char *Months[] = { +static char *Months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct","Nov", "Dec", 0 }; -char *Days[] = { +static char *Days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", 0 }; -char *Piroutines[] = { +static char *Piroutines[] = { "program", "function", "procedure", 0 }; static boolean structured, multiple; -char *pi_Endmatched[] = {"End", "matched"}; -char *pi_Inserted[] = {"Inserted", "keyword", "end", "matching"}; +static char *pi_Endmatched[] = {"End", "matched"}; +static char *pi_Inserted[] = {"Inserted", "keyword", "end", "matching"}; -char *pi_multiple[] = {"Mutiply", "defined", "label", "in", "case,", "line"}; -char *pi_structured[] = {"is", "into", "a", "structured", "statement"}; +static char *pi_multiple[] = {"Mutiply", "defined", "label", "in", "case,", "line"}; +static char *pi_structured[] = {"is", "into", "a", "structured", "statement"}; -char *pi_und1[] = {"undefined", "on", "line"}; -char *pi_und2[] = {"undefined", "on", "lines"}; -char *pi_imp1[] = {"improperly", "used", "on", "line"}; -char *pi_imp2[] = {"improperly", "used", "on", "lines"}; +static char *pi_und1[] = {"undefined", "on", "line"}; +static char *pi_und2[] = {"undefined", "on", "lines"}; +static char *pi_imp1[] = {"improperly", "used", "on", "line"}; +static char *pi_imp2[] = {"improperly", "used", "on", "lines"}; -boolean +static boolean alldigits(char *string) { for (; *string && isdigit((unsigned char)*string); string++) @@ -171,7 +170,7 @@ return(*string == '\0'); } -boolean +static boolean instringset(char *member, char **set) { for(; *set; set++){ @@ -181,7 +180,7 @@ return(FALSE); } -boolean +static boolean isdateformat(int wordc, char **wordv) { return( @@ -192,7 +191,7 @@ && (alldigits(wordv[4])) ); } -boolean +static boolean piptr(char *string) { if (*string != '-') Index: src/usr.bin/error/subr.c diff -u src/usr.bin/error/subr.c:1.14 src/usr.bin/error/subr.c:1.15 --- src/usr.bin/error/subr.c:1.14 Thu Aug 7 11:13:38 2003 +++ src/usr.bin/error/subr.c Thu Aug 13 02:10:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: subr.c,v 1.14 2003/08/07 11:13:38 agc Exp $ */ +/* $NetBSD: subr.c,v 1.15 2009/08/13 02:10:50 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.14 2003/08/07 11:13:38 agc Exp $"); +__RCSID("$NetBSD: subr.c,v 1.15 2009/08/13 02:10:50 dholland Exp $"); #endif /* not lint */ #include <ctype.h> @@ -43,6 +43,7 @@ #include <stdlib.h> #include <string.h> #include "error.h" + /* * Arrayify a list of rules */ @@ -187,11 +188,12 @@ return(FALSE); } +#if 0 /* unused */ /* * parse a quoted string that is the result of a format \"%s\"(%d) * return TRUE if this is of the proper format */ -boolean +static boolean qpersperdexplode(char *string, char **r_perd, char **r_pers) { char *cp; @@ -217,6 +219,7 @@ } return(FALSE); } +#endif /* 0 - unused */ static char cincomment[] = CINCOMMENT; static char coutcomment[] = COUTCOMMENT; Index: src/usr.bin/error/touch.c diff -u src/usr.bin/error/touch.c:1.16 src/usr.bin/error/touch.c:1.17 --- src/usr.bin/error/touch.c:1.16 Fri Oct 5 07:27:42 2007 +++ src/usr.bin/error/touch.c Thu Aug 13 02:10:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: touch.c,v 1.16 2007/10/05 07:27:42 lukem Exp $ */ +/* $NetBSD: touch.c,v 1.17 2009/08/13 02:10:50 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.16 2007/10/05 07:27:42 lukem Exp $"); +__RCSID("$NetBSD: touch.c,v 1.17 2009/08/13 02:10:50 dholland Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -57,10 +57,35 @@ #define ECITERATE(ei, p, lb) for (ei = lb; p = errors[ei],ei < nerrors; ei++) #define FILEITERATE(fi, lb) for (fi = lb; fi <= nfiles; fi++) -int touchstatus = Q_YES; +static int touchstatus = Q_YES; extern char *suffixlist; +/* + * codes for probethisfile to return + */ +#define F_NOTEXIST 1 +#define F_NOTREAD 2 +#define F_NOTWRITE 3 +#define F_TOUCHIT 4 + +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 execvarg(int, int *, char ***); +static boolean edit(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 void errorprint(FILE *, Eptr, boolean); +static int probethisfile(char *); + void findfiles(int nerrors, Eptr *errors, int *r_nfiles, Eptr ***r_files) { @@ -111,7 +136,7 @@ *r_files = files; } -int +static int countfiles(Eptr *errors) { char *name; @@ -183,7 +208,7 @@ /* * Dump out errors that don't pertain to any file */ -int +static int nopertain(Eptr **files) { int type; @@ -273,7 +298,7 @@ } } -void +static void hackfile(char *name, Eptr **files, int ix, int nerrors) { boolean previewed; @@ -303,7 +328,7 @@ } } -boolean +static boolean preview(char *name, int nerrors, Eptr **files, int ix) { int back; @@ -332,7 +357,7 @@ return(back); } -int +static int settotouch(char *name) { int dest = TOSTDOUT; @@ -382,7 +407,7 @@ return(dest); } -void +static void diverterrors(char *name, int dest, Eptr **files, int ix, boolean previewed, int nterrors) { @@ -422,7 +447,7 @@ } } -int +static int oktotouch(char *filename) { char *src; @@ -474,7 +499,7 @@ * We fill in the initial search string. * We fill in the arguments, and the null. */ -void +static void execvarg(int n_pissed_on, int *r_argc, char ***r_argv) { Eptr p; @@ -505,18 +530,18 @@ (*r_argv)[n_pissed_on] = 0; } -FILE *o_touchedfile; /* the old file */ -FILE *n_touchedfile; /* the new file */ -char *o_name; -char n_name[MAXPATHLEN]; -int o_lineno; -int n_lineno; -boolean tempfileopen = FALSE; +static FILE *o_touchedfile; /* the old file */ +static FILE *n_touchedfile; /* the new file */ +static char *o_name; +static char n_name[MAXPATHLEN]; +static int o_lineno; +static int n_lineno; +static boolean tempfileopen = FALSE; /* * open the file; guaranteed to be both readable and writable * Well, if it isn't, then return TRUE if something failed */ -boolean +static boolean edit(char *name) { int fd; @@ -549,9 +574,9 @@ /* * Position to the line (before, after) the line given by place */ -char edbuf[BUFSIZ]; +static char edbuf[BUFSIZ]; -void +static void insert(int place) { --place; /* always insert messages before the offending line*/ @@ -562,7 +587,7 @@ } } -void +static void text(Eptr p, boolean use_all) { int offset = use_all ? 0 : 2; @@ -580,7 +605,7 @@ * write the touched file to its temporary copy, * then bring the temporary in over the local file */ -boolean +static boolean writetouched(int overwrite) { int nread; @@ -646,7 +671,7 @@ /* * return 1 if the tmpfile can be removed after writing it out */ -int +static int mustoverwrite(FILE *preciousfile, FILE *tmpfile) { int nread; @@ -660,7 +685,7 @@ /* * return 0 on catastrophe */ -int +static int mustwrite(char *base, int n, FILE *preciousfile) { int nwrote; @@ -720,7 +745,7 @@ /*NOTREACHED*/ } -void +static void errorprint(FILE *place, Eptr errorp, boolean print_all) { int offset = print_all ? 0 : 2; @@ -758,7 +783,7 @@ } } -int +static int probethisfile(char *name) { struct stat statbuf;