diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-13 16:13:06 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-13 16:13:06 +0200 |
commit | 9566646cd54a34c0dfe2dbdd89ee3858372a6c28 (patch) | |
tree | 1aa3942cb421b2fc90426b8e0984120511128a9d /src/main.c | |
parent | ae0520e57267dbd866fc8cd25f66f4e6af2ac118 (diff) |
Move string utils to their own file
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 46 |
1 files changed, 1 insertions, 45 deletions
@@ -2,6 +2,7 @@ #include "fileutils.h" #include "transmission.h" #include "fileutils.h" +#include "stringutils.h" #include "rss.h" #include "json.h" @@ -184,51 +185,6 @@ static int compare_downloaded_item(const void *a, const void *b) { return list_data_a->timestamp - list_data_b->timestamp; } -static void string_replace(char *str, char old, char new) { - for(;;) { - char c = *str; - if(c == old) - *str = new; - else if(c == '\0') - break; - ++str; - } -} - -static char* lstrip(char *str) { - for(;;) { - char c = *str; - if(c != ' ' && c != '\t' && c != '\n') - break; - else if(c == '\0') - break; - ++str; - } - return str; -} - -static void rstrip(char *str) { - int len = strlen(str); - if(len == 0) - return; - - char *p = str + len - 1; - while(p != str) { - char c = *p; - if(c != ' ' && c != '\t' && c != '\n') - break; - --p; - } - - p[1] = '\0'; -} - -static char* strip(char *str) { - str = lstrip(str); - rstrip(str); - return str; -} - static void command_add(int argc, char **argv, char *rss_config_dir, char *html_config_dir) { if(argc < 2) usage_add(); |