mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
util: add delete_chars() call
This commit is contained in:
parent
fc22fc6efc
commit
ee9b5e0118
17
util.c
17
util.c
@ -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;
|
||||
|
2
util.h
2
util.h
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user