summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex/grot/split.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/regex/grot/split.c')
-rw-r--r--lib/libc/regex/grot/split.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/libc/regex/grot/split.c b/lib/libc/regex/grot/split.c
index 70e0ec5..c5d5264 100644
--- a/lib/libc/regex/grot/split.c
+++ b/lib/libc/regex/grot/split.c
@@ -4,16 +4,17 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <string.h>
+#include "split.ih"
+
/*
- 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 +152,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 +181,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 +192,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 +273,8 @@ struct {
NULL, NULL, 0, { NULL },
};
-regress()
+void
+regress(void)
{
char buf[512];
int n;
OpenPOWER on IntegriCloud