Add missing static keywords to csplit(1)

This commit is contained in:
Ed Schouten
2011-11-06 08:14:45 +00:00
parent 9ff0c16a5b
commit b168c3c84b
+30 -30
View File
@@ -60,36 +60,36 @@ __FBSDID("$FreeBSD$");
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
void cleanup(void); static void cleanup(void);
void do_lineno(const char *); static void do_lineno(const char *);
void do_rexp(const char *); static void do_rexp(const char *);
char *getline(void); static char *getline(void);
void handlesig(int); static void handlesig(int);
FILE *newfile(void); static FILE *newfile(void);
void toomuch(FILE *, long); static void toomuch(FILE *, long);
void usage(void); static void usage(void);
/* /*
* Command line options * Command line options
*/ */
const char *prefix; /* File name prefix */ static const char *prefix; /* File name prefix */
long sufflen; /* Number of decimal digits for suffix */ static long sufflen; /* Number of decimal digits for suffix */
int sflag; /* Suppress output of file names */ static int sflag; /* Suppress output of file names */
int kflag; /* Keep output if error occurs */ static int kflag; /* Keep output if error occurs */
/* /*
* Other miscellaneous globals (XXX too many) * Other miscellaneous globals (XXX too many)
*/ */
long lineno; /* Current line number in input file */ static long lineno; /* Current line number in input file */
long reps; /* Number of repetitions for this pattern */ static long reps; /* Number of repetitions for this pattern */
long nfiles; /* Number of files output so far */ static long nfiles; /* Number of files output so far */
long maxfiles; /* Maximum number of files we can create */ static long maxfiles; /* Maximum number of files we can create */
char currfile[PATH_MAX]; /* Current output file */ static char currfile[PATH_MAX]; /* Current output file */
const char *infn; /* Name of the input file */ static const char *infn; /* Name of the input file */
FILE *infile; /* Input file handle */ static FILE *infile; /* Input file handle */
FILE *overfile; /* Overflow file for toomuch() */ static FILE *overfile; /* Overflow file for toomuch() */
off_t truncofs; /* Offset this file should be truncated at */ static off_t truncofs; /* Offset this file should be truncated at */
int doclean; /* Should cleanup() remove output? */ static int doclean; /* Should cleanup() remove output? */
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@@ -209,7 +209,7 @@ main(int argc, char *argv[])
return (0); return (0);
} }
void static void
usage(void) usage(void)
{ {
@@ -218,7 +218,7 @@ usage(void)
exit(1); exit(1);
} }
void static void
handlesig(int sig __unused) handlesig(int sig __unused)
{ {
const char msg[] = "csplit: caught signal, cleaning up\n"; const char msg[] = "csplit: caught signal, cleaning up\n";
@@ -229,7 +229,7 @@ handlesig(int sig __unused)
} }
/* Create a new output file. */ /* Create a new output file. */
FILE * static FILE *
newfile(void) newfile(void)
{ {
FILE *fp; FILE *fp;
@@ -245,7 +245,7 @@ newfile(void)
} }
/* Remove partial output, called before exiting. */ /* Remove partial output, called before exiting. */
void static void
cleanup(void) cleanup(void)
{ {
char fnbuf[PATH_MAX]; char fnbuf[PATH_MAX];
@@ -269,7 +269,7 @@ cleanup(void)
} }
/* Read a line from the input into a static buffer. */ /* Read a line from the input into a static buffer. */
char * static char *
getline(void) getline(void)
{ {
static char lbuf[LINE_MAX]; static char lbuf[LINE_MAX];
@@ -292,7 +292,7 @@ again: if (fgets(lbuf, sizeof(lbuf), src) == NULL) {
} }
/* Conceptually rewind the input (as obtained by getline()) back `n' lines. */ /* Conceptually rewind the input (as obtained by getline()) back `n' lines. */
void static void
toomuch(FILE *ofp, long n) toomuch(FILE *ofp, long n)
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
@@ -351,7 +351,7 @@ toomuch(FILE *ofp, long n)
} }
/* Handle splits for /regexp/ and %regexp% patterns. */ /* Handle splits for /regexp/ and %regexp% patterns. */
void static void
do_rexp(const char *expr) do_rexp(const char *expr)
{ {
regex_t cre; regex_t cre;
@@ -433,7 +433,7 @@ do_rexp(const char *expr)
} }
/* Handle splits based on line number. */ /* Handle splits based on line number. */
void static void
do_lineno(const char *expr) do_lineno(const char *expr)
{ {
long lastline, tgtline; long lastline, tgtline;