aboutsummaryrefslogtreecommitdiff
path: root/src/wordsplit.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-10-30 18:55:04 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2015-12-17 15:26:28 +0200
commit5ce27a8cdee32f53a922c459a4f9beae307543f7 (patch)
tree0e3d4c6e0a4b260df941bd160b5b47b3990a8b9f /src/wordsplit.c
parent59d4374b24e9f9f077f2e2e973fa75f3c3d505e0 (diff)
downloadgrecs-5ce27a8cdee32f53a922c459a4f9beae307543f7.tar.gz
grecs-5ce27a8cdee32f53a922c459a4f9beae307543f7.tar.bz2
wordsplit: improve docs, add new function
* src/wordsplit.c (wordsplit_getwords): New functon. * src/wordsplit.h (wordsplit_getwords): New proto. * doc/wordsplit.3: Add example section, document wordsplit_getwords.
Diffstat (limited to 'src/wordsplit.c')
-rw-r--r--src/wordsplit.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wordsplit.c b/src/wordsplit.c
index 671fcb9..29547f6 100644
--- a/src/wordsplit.c
+++ b/src/wordsplit.c
@@ -2267,6 +2267,18 @@ wordsplit_free (struct wordsplit *ws)
wordsplit_free_envbuf (ws);
}
+void
+wordsplit_getwords (struct wordsplit *ws, int *wordc, char ***wordv)
+{
+ char **p = realloc (ws->ws_wordv,
+ (ws->ws_wordc + 1) * sizeof (ws->ws_wordv[0]));
+ *wordv = p ? p : ws->ws_wordv;
+ *wordc = ws->ws_wordc;
+ ws->ws_wordv = NULL;
+ ws->ws_wordc = 0;
+ ws->ws_wordn = 0;
+}
+
const char *_wordsplit_errstr[] = {
N_("no error"),
N_("missing closing quote"),

Return to:

Send suggestions and report system problems to the System administrator.