aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2016-05-16 11:59:26 +0100
committerIan C <ianc@noddybox.co.uk>2016-05-16 11:59:26 +0100
commitb6b86b40135b448c91177984a8d25518a66d7cdc (patch)
tree65a56c0dc9a8ff12fb87401b333a6beb5a2e9107 /src/util.c
parent5e6a1c3434b96ea16485b160c25732df3b00b2b8 (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.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index d7ac2b9..fba0753 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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);