Use ANSI C function prototypes/definitions instead of K&R style ones

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
ngie 2015-12-05 02:07:55 +00:00
parent 1a9e649e9e
commit ac2d4b2c97

View File

@ -7,13 +7,12 @@ __FBSDID("$FreeBSD$");
/* /*
- split - divide a string into fields, like awk split() - split - divide a string into fields, like awk split()
= int split(char *string, char *fields[], int nfields, char *sep); = int split(char *string, char *fields[], int nfields, char *sep);
- fields: list is not NULL-terminated
- nfields: number of entries available in fields[]
- sep: "" white, "c" single char, "ab" [ab]+
*/ */
int /* number of fields, including overflow */ int /* number of fields, including overflow */
split(string, fields, nfields, sep) split(char *string, char *fields[], int nfields, char *sep)
char *string;
char *fields[]; /* list is not NULL-terminated */
int nfields; /* number of entries available in fields[] */
char *sep; /* "" white, "c" single char, "ab" [ab]+ */
{ {
char *p = string; char *p = string;
char c; /* latest character */ char c; /* latest character */
@ -151,9 +150,7 @@ char *sep; /* "" white, "c" single char, "ab" [ab]+ */
* pgm str sep n splits str by sep n times * pgm str sep n splits str by sep n times
*/ */
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
char buf[512]; char buf[512];
int n; int n;
@ -182,9 +179,8 @@ char *argv[];
exit(0); exit(0);
} }
dosplit(string, seps) void
char *string; dosplit(char *string, char *seps)
char *seps;
{ {
# define NF 5 # define NF 5
char *fields[NF]; char *fields[NF];
@ -194,10 +190,8 @@ char *seps;
print(nf, NF, fields); print(nf, NF, fields);
} }
print(nf, nfp, fields) void
int nf; print(int nf, int nfp, char *fields[])
int nfp;
char *fields[];
{ {
int fn; int fn;
int bound; int bound;
@ -277,7 +271,8 @@ struct {
NULL, NULL, 0, { NULL }, NULL, NULL, 0, { NULL },
}; };
regress() void
regress(void)
{ {
char buf[512]; char buf[512];
int n; int n;