[Initng-svn] r4004 - in initng/trunk: plugins/stcmd
svn at initng.thinktux.net
svn at initng.thinktux.net
Thu May 4 09:53:16 CEST 2006
Author: jimmy
Date: Thu May 4 09:53:15 2006
New Revision: 4004
Modified:
initng/trunk/plugins/stcmd/initng_stcmd.c
initng/trunk/src/initng_string_tools.c
initng/trunk/src/initng_string_tools.h
Log:
Removed unused function split_n
Modified: initng/trunk/plugins/stcmd/initng_stcmd.c
==============================================================================
--- initng/trunk/plugins/stcmd/initng_stcmd.c (original)
+++ initng/trunk/plugins/stcmd/initng_stcmd.c Thu May 4 09:53:15 2006
@@ -536,13 +536,13 @@
static int cmd_new_init(char *arg)
{
char *new_i;
- int i = 0;
+ size_t i = 0;
if (!arg)
return (FALSE);
new_i = strdup(arg);
- g.new_init = split_n(new_i, &i, 0, 0);
+ g.new_init = split_delim(new_i, WHITESPACE, &i, 0);
g.when_out = THEN_NEW_INIT;
initng_handler_stop_all();
Modified: initng/trunk/src/initng_string_tools.c
==============================================================================
--- initng/trunk/src/initng_string_tools.c (original)
+++ initng/trunk/src/initng_string_tools.c Thu May 4 09:53:15 2006
@@ -32,53 +32,6 @@
#include "initng_string_tools.h"
#include "initng_toolbox.h"
-/*
- * this splits an long string, with separators, like \n , ; ' '
- * into an char **
- * buf: the line to split.
- * len; An pointer sent back with length
- * plus: Allocate this much extra char ** size;
- * ofs: (offset) start a bit into the buf
- *
- * OBS, this functions only creates a pointer list, that links
- * to buf, if buf is freed, the list dies!
- */
-char **split_n(char *buf, int *len, int plus, int ofs)
-{
- int n = 1;
- char **v = 0;
- char **w;
-
- /* step 1: count tokens */
- char *s;
-
- assert(buf);
-
- for (s = buf; *s; s++)
- if (*s == '\n' || *s == ',' || *s == ';' || *s == ' ')
- n++;
- /* step 2: allocate space for pointers */
- v = (char **) i_calloc((n + plus), sizeof(char *));
- if (!v)
- return 0;
- w = v + ofs;
- *w++ = buf;
- for (s = buf;; s++)
- {
- while (*s && *s != '\n' && *s != ',' && *s != ';' && *s != ' ')
- s++;
- if (*s == 0)
- break;
- if (*s == '\n' || *s == ',' || *s == ';' || *s == ' ')
- {
- *s = 0;
- *w++ = s + 1;
- }
- }
- *len = w - v;
- return v;
-}
-
/** Re-links a string to a argv-like string-array.
* Example: \t /bin/executable --ham -flt --moohoho lalala
Modified: initng/trunk/src/initng_string_tools.h
==============================================================================
--- initng/trunk/src/initng_string_tools.h (original)
+++ initng/trunk/src/initng_string_tools.h Thu May 4 09:53:15 2006
@@ -62,7 +62,6 @@
(s)++; \
while ((s)[0] == ' ' || (s)[0] == '\t') (s)++;
-char **split_n(char *buf, int *len, int plus, int ofs);
int st_cmp(char **string, const char *to_cmp);
char *st_dup_next_word(char **string);
char *st_dup_line(char **string);
More information about the Initng-svn
mailing list