diff options
author | Ian C <ianc@noddybox.co.uk> | 2016-05-16 11:59:26 +0100 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2016-05-16 11:59:26 +0100 |
commit | b6b86b40135b448c91177984a8d25518a66d7cdc (patch) | |
tree | 65a56c0dc9a8ff12fb87401b333a6beb5a2e9107 /src/util.c | |
parent | 5e6a1c3434b96ea16485b160c25732df3b00b2b8 (diff) |
SPC700 additions.
* First completed version of SPC700. Very untested.
* Fixed an oddity in the parser regarding quoted values not ending with a
separator. These values now appear unquoted with the additional text included
in the same argument.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -109,6 +109,27 @@ char *Trim(char *p) } +char *TrimChars(char *p, const char *chars) +{ + if (p) + { + size_t l = strlen(p); + + while (l > 0 && strchr(chars, *p)) + { + memmove(p, p + 1, l--); + } + + while(l > 1 && strchr(chars, p[l-1])) + { + p[--l] = 0; + } + } + + return p; +} + + char *CopyStr(char *dest, const char *src, size_t size) { strncpy(dest, src, size); |