diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2014-04-12 19:59:21 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2014-04-12 19:59:21 +0300 |
commit | 311e4b36768a0d4e113ccf6d2256ca95c6621508 (patch) | |
tree | 04be6cb3158375ca9932481f279167eff145435d /lib/util.c | |
parent | cd73a1ba610db7cfa928b37039a1bbdaee88972a (diff) | |
download | bemenu-311e4b36768a0d4e113ccf6d2256ca95c6621508.tar.gz bemenu-311e4b36768a0d4e113ccf6d2256ca95c6621508.tar.bz2 bemenu-311e4b36768a0d4e113ccf6d2256ca95c6621508.zip |
Use strcspn instead of strtok
Diffstat (limited to 'lib/util.c')
-rw-r--r-- | lib/util.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -28,6 +28,19 @@ char* _bmStrdup(const char *string) } /** + * Replaces next token in string with '\0' and returns position for the replaced token. + * + * @param string C "string" where token will be replaced. + * @return Position of the replaced token. + */ +size_t _bmStripToken(char *string, const char *token) +{ + size_t len = strcspn(string, token); + string[len] = 0; + return len; +} + +/** * Portable case-insensitive strcmp. * * @param hay C "string" to match against. |