diff options
author | sabetts <sabetts> | 2006-09-27 01:00:45 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2006-09-27 01:00:45 +0000 |
commit | b80a2d14bf72a4758eca46156a7c3ad606473bb7 (patch) | |
tree | 7a86b490490b7c947d331c02e618c07d5239db18 /src/main.c | |
parent | ad859c2d9b0f19ff55ea016d23a97853ef99b89e (diff) | |
download | ratpoison-b80a2d14bf72a4758eca46156a7c3ad606473bb7.zip |
*** empty log message ***
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -151,6 +151,37 @@ xsprintf (char *fmt, ...) return buffer; } +/* strtok but do it for whitespace and be locale compliant. */ +char * +strtok_ws (char *s) +{ + char *nonws; + static char *pointer = NULL; + + printf ("pointer: %p\n", pointer); + + if (s) + pointer = s; + + /* skip to first non-whitespace char. */ + while (*pointer && isspace (*pointer)) pointer++; + + /* If we reached the end of the string here then there is no more + data. */ + if (*pointer == 0) + return NULL; + + /* Now skip to the end of the data. */ + nonws = pointer; + while (*pointer && !isspace (*pointer)) pointer++; + if (*pointer) + { + *pointer = 0; + pointer++; + } + return nonws; +} + /* A case insensitive strncmp. */ int str_comp (char *s1, char *s2, int len) |