Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=yaxmenu.git;a=commitdiff;h=f02f0a2f637fefca3d65a198b6e1d8fbfabc12e4

commit f02f0a2f637fefca3d65a198b6e1d8fbfabc12e4
Author: James Buren <r...@frugalware.org>
Date:   Sun Dec 6 23:10:05 2009 -0600

utility.c
* add xstrtrim function

diff --git a/src/utility.c b/src/utility.c
index 539a71c..a6fb610 100644
--- a/src/utility.c
+++ b/src/utility.c
@@ -1,3 +1,4 @@
+#include "globals.h"
#include "utility.h"

void *xmalloc(size_t size) {
@@ -34,3 +35,21 @@ size_t xstrclen(const char *str,char c) {

return n;
}
+
+char *xstrtrim(char *str) {
+  char *t1, *t2;
+
+  assert(str);
+
+  str += strspn(str,G->whitespace_chars);
+
+  for( t1 = str ; *t1 ; ) {
+    t1 += strcspn(t1,G->whitespace_chars);
+    t2 = t1;
+    t1 += strspn(t1,G->whitespace_chars);
+  }
+
+  *t2 = '\0';
+
+  return str;
+}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to