summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex/grot/split.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-12-13 03:51:49 +0000
committerngie <ngie@FreeBSD.org>2015-12-13 03:51:49 +0000
commit3a310452301f899fcd378d09a5e284aa0b0e4bff (patch)
tree963f33cb99ff76dd9a0d1f773bc344ab00ba0cb8 /lib/libc/regex/grot/split.c
parente7a647fe8fd40eb273e9ce43da0e68f02ddb96cf (diff)
downloadFreeBSD-src-3a310452301f899fcd378d09a5e284aa0b0e4bff.zip
FreeBSD-src-3a310452301f899fcd378d09a5e284aa0b0e4bff.tar.gz
MFC r291832,r291833,r291834,r291835,r291836,r291838:
r291832: Fix -Wformat warnings by using the correct format qualifiers Sponsored by: EMC / Isilon Storage Division r291833: - Use ANSI C function prototypes/definitions instead of K&R style ones - Add a missing return type for main(..) Sponsored by: EMC / Isilon Storage Division r291834: Add missing headers and sort #includes per style(9) Sponsored by: EMC / Isilon Storage Division r291835: Use ANSI C function prototypes/definitions instead of K&R style ones Sponsored by: EMC / Isilon Storage Division r291836: Use `==` instead of `=` in the function comment above split(..) so mkh -p exposes split(..). Sponsored by: EMC / Isilon Storage Division r291838: Fix -Wformat issues and minor whitespace issues in surrounding areas Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'lib/libc/regex/grot/split.c')
-rw-r--r--lib/libc/regex/grot/split.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/libc/regex/grot/split.c b/lib/libc/regex/grot/split.c
index 70e0ec5..07ab8f1 100644
--- a/lib/libc/regex/grot/split.c
+++ b/lib/libc/regex/grot/split.c
@@ -6,14 +6,13 @@ __FBSDID("$FreeBSD$");
/*
- 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 */
-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;
OpenPOWER on IntegriCloud