diff options
author | Rob Landley <rob@landley.net> | 2015-12-29 11:52:12 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-12-29 11:52:12 -0600 |
commit | 4d3ad67ab37a25d0edfccdc34d29ec550e0802b6 (patch) | |
tree | 2ea5d17313d4efbd358add3d45580244c1190136 /lib | |
parent | 1bf844232802d2deec7a2e9bee355e4c26259101 (diff) | |
download | toybox-4d3ad67ab37a25d0edfccdc34d29ec550e0802b6.tar.gz |
Add strafter() to lib.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 8 | ||||
-rw-r--r-- | lib/lib.h | 1 |
2 files changed, 9 insertions, 0 deletions
@@ -342,6 +342,14 @@ char *strlower(char *s) return try; } +// strstr but returns pointer after match +char *strafter(char *haystack, char *needle) +{ + char *s = strstr(haystack, needle); + + return s ? s+strlen(needle) : s; +} + // Remove trailing \n char *chomp(char *s) { @@ -173,6 +173,7 @@ long atolx(char *c); long atolx_range(char *numstr, long low, long high); int stridx(char *haystack, char needle); char *strlower(char *s); +char *strafter(char *haystack, char *needle); char *chomp(char *s); int unescape(char c); int strstart(char **a, char *b); |