diff --git a/include/log.h b/include/log.h index 15e5be7c1235971987bfb78f3852af378772301a..330eb6ffc642c0c4a91cde76b6258f3530fb1540 100644 --- a/include/log.h +++ b/include/log.h @@ -10,7 +10,6 @@ void pen(); void report(int num, char *s); void log_setmode(const char *s); -void strwordx(char *buf, char *wrd); long getint(char *s, long def); void sortshints(short *x, short *y); long glowcol(log_nrec *n, long def); diff --git a/include/utils/strings.h b/include/utils/strings.h index 85c32b3ba0a22707809879eec0058a76d1c05902..5fd6bdbdf3652043dd3da836b718582449fc906e 100644 --- a/include/utils/strings.h +++ b/include/utils/strings.h @@ -51,6 +51,7 @@ void strcomment (char *s, char* bracket); void strcompress (char *s, char *chars, int all); void strdispose (char **sp); void strchange (char** sp, char *); +void strwordx(char *buf, char *wrd); /** * \deprecated diff --git a/src/log.c b/src/log.c index af72f3786f0935481bf2a85e976af2f22cfb7ad6..677165b9feaa984e904eb0a8fce56cdb5c41e039 100644 --- a/src/log.c +++ b/src/log.c @@ -427,31 +427,6 @@ void log_setmode(const char *s) drawstr2(across + menux3, line2, modename); } -void strwordx(char *buf, char *wrd) -{ - size_t i; - char *str1; - char *str2; - - str1 = malloc(strlen(buf) + 1); - str2 = malloc(strlen(buf) + 1); - strcpy(str1, strltrim(strrtrim(strcpy(str2, buf)))); - strcpy(buf, str1); - free(str1); - free(str2); - - if (*buf != '"') - { - strword(buf, wrd); - return; - } - i = strposc(buf, '"', 2L); - if (i == 0) - i = strlen(buf) + 1; - strpart(wrd, buf, 2, i - 1); - strcpy_overlap(buf, buf + i); -} - static void unprobe() { gg.probenode = NULL; diff --git a/src/utils/strings.c b/src/utils/strings.c index ef91bd91caf6bcd2c3c095e1f4d761dd18269786..8397f5c11295bb768c83220b5da65f615d062688 100644 --- a/src/utils/strings.c +++ b/src/utils/strings.c @@ -564,3 +564,29 @@ char *strcpy_overlap(char *dst, char *src) } while (1); return dst; } + +void strwordx(char *buf, char *wrd) +{ + size_t i; + char *str1; + char *str2; + + str1 = malloc(strlen(buf) + 1); + str2 = malloc(strlen(buf) + 1); + strcpy(str1, strltrim(strrtrim(strcpy(str2, buf)))); + strcpy(buf, str1); + free(str1); + free(str2); + + if (*buf != '"') + { + strword(buf, wrd); + return; + } + i = strposc(buf, '"', 2L); + if (i == 0) + i = strlen(buf) + 1; + strpart(wrd, buf, 2, i - 1); + strcpy_overlap(buf, buf + i); +} +