diff options
author | Rob Landley <rob@landley.net> | 2014-06-09 07:12:49 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-06-09 07:12:49 -0500 |
commit | 8115fc121c0ee0b11ba2752438ff500cce48e347 (patch) | |
tree | 97a41f560ce8556fae7b13469c5d4d38cc4bd5ff /lib/lib.c | |
parent | e031a5e24e5b0479717474d5d08ca9abda2f580a (diff) | |
download | toybox-8115fc121c0ee0b11ba2752438ff500cce48e347.tar.gz |
Forgot to check in strstart().
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -280,6 +280,16 @@ int stridx(char *haystack, char needle) return off-haystack; } +// If *a starts with b, advance *a past it and return 1, else return 0; +int strstart(char **a, char *b) +{ + int len = strlen(b), i = !strncmp(*a, b, len); + + if (i) *a += len; + + return i; +} + // Return how long the file at fd is, if there's any way to determine it. off_t fdlength(int fd) { |