diff options
author | ngie <ngie@FreeBSD.org> | 2015-12-05 02:07:55 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-12-05 02:07:55 +0000 |
commit | ac2d4b2c97dd73f41094adb476fc3f8a5b0118d3 (patch) | |
tree | 31fea12bdf7cbbbfdfb7674e5730dd11023a7c5f /lib | |
parent | 1a9e649e9e64edf705a8b11cffb2a8f5a2b158f3 (diff) | |
download | FreeBSD-src-ac2d4b2c97dd73f41094adb476fc3f8a5b0118d3.zip FreeBSD-src-ac2d4b2c97dd73f41094adb476fc3f8a5b0118d3.tar.gz |
Use ANSI C function prototypes/definitions instead of K&R style ones
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/regex/grot/split.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/libc/regex/grot/split.c b/lib/libc/regex/grot/split.c index 70e0ec5..90739d1 100644 --- a/lib/libc/regex/grot/split.c +++ b/lib/libc/regex/grot/split.c @@ -7,13 +7,12 @@ __FBSDID("$FreeBSD$"); /* - split - divide a string into fields, like awk split() = 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 */ -split(string, fields, nfields, 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]+ */ +split(char *string, char *fields[], int nfields, char *sep) { char *p = string; 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 */ int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { char buf[512]; int n; @@ -182,9 +179,8 @@ char *argv[]; exit(0); } -dosplit(string, seps) -char *string; -char *seps; +void +dosplit(char *string, char *seps) { # define NF 5 char *fields[NF]; @@ -194,10 +190,8 @@ char *seps; print(nf, NF, fields); } -print(nf, nfp, fields) -int nf; -int nfp; -char *fields[]; +void +print(int nf, int nfp, char *fields[]) { int fn; int bound; @@ -277,7 +271,8 @@ struct { NULL, NULL, 0, { NULL }, }; -regress() +void +regress(void) { char buf[512]; int n; |