diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 06:59:56 +0200 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-10 18:40:23 +1000 |
| commit | 63b80e79f69beec9a375f53d5cd8f20f55fb4746 (patch) | |
| tree | 7d191a80abccb7a3d9f89a4863a51f4b8c73b41d | |
| parent | b8ba0563f25d5ac40d80718d5d05503c27806765 (diff) | |
| download | busybox-w32-63b80e79f69beec9a375f53d5cd8f20f55fb4746.tar.gz busybox-w32-63b80e79f69beec9a375f53d5cd8f20f55fb4746.tar.bz2 busybox-w32-63b80e79f69beec9a375f53d5cd8f20f55fb4746.zip | |
win32: add strsep()
| -rw-r--r-- | include/mingw.h | 2 | ||||
| -rw-r--r-- | win32/mingw.c | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/include/mingw.h b/include/mingw.h index 40c11aabf..7fff1ad38 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
| @@ -140,7 +140,7 @@ IMPL(unsetenv,void,,const char *env UNUSED_PARAM); | |||
| 140 | /* | 140 | /* |
| 141 | * string.h | 141 | * string.h |
| 142 | */ | 142 | */ |
| 143 | IMPL(strsep,char *,NULL,char **stringp UNUSED_PARAM, const char *delim UNUSED_PARAM); | 143 | char *strsep(char **stringp, const char *delim); |
| 144 | 144 | ||
| 145 | /* | 145 | /* |
| 146 | * sys/ioctl.h | 146 | * sys/ioctl.h |
diff --git a/win32/mingw.c b/win32/mingw.c index eccd37cc3..937e9422c 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
| @@ -348,3 +348,21 @@ int link(const char *oldpath, const char *newpath) | |||
| 348 | } | 348 | } |
| 349 | return 0; | 349 | return 0; |
| 350 | } | 350 | } |
| 351 | |||
| 352 | char *strsep(char **stringp, const char *delim) | ||
| 353 | { | ||
| 354 | char *s, *old_stringp; | ||
| 355 | if (!*stringp) | ||
| 356 | return NULL; | ||
| 357 | old_stringp = s = *stringp; | ||
| 358 | while (*s) { | ||
| 359 | if (strchr(delim, *s)) { | ||
| 360 | *s = '\0'; | ||
| 361 | *stringp = s+1; | ||
| 362 | return old_stringp; | ||
| 363 | } | ||
| 364 | s++; | ||
| 365 | } | ||
| 366 | *stringp = NULL; | ||
| 367 | return old_stringp; | ||
| 368 | } | ||
