diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-07 20:27:05 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-07 20:27:05 +0200 |
commit | ee9b5e011857ff4a75ceaa9aaf3b2ed8ceacfadf (patch) | |
tree | d039d839f4338388ddc8f83bc2966c8c9b751100 | |
parent | fc22fc6efc4f6a46faf6547f33f42dffc1e35c15 (diff) |
util: add delete_chars() call
-rw-r--r-- | util.c | 17 | ||||
-rw-r--r-- | util.h | 2 |
2 files changed, 19 insertions, 0 deletions
@@ -611,6 +611,23 @@ char *strstrip(char *s) { } +char *delete_chars(char *s, const char *bad) { + char *f, *t; + + /* Drops all whitespace, regardless where in the string */ + + for (f = s, t = s; *f; f++) { + if (strchr(bad, *f)) + continue; + + *(t++) = *f; + } + + *t = 0; + + return s; +} + char *file_in_same_dir(const char *path, const char *filename) { char *e, *r; size_t k; @@ -129,6 +129,8 @@ char **strv_path_make_absolute_cwd(char **l); int reset_all_signal_handlers(void); char *strstrip(char *s); +char *delete_chars(char *s, const char *bad); + char *file_in_same_dir(const char *path, const char *filename); int mkdir_parents(const char *path, mode_t mode); |