trunk: changeset 35

Fri, 05 Jan 2001 17:31:37 +0100

author
tuomov
date
Fri, 05 Jan 2001 17:31:37 +0100
changeset 32
7e74a8d61b76
parent 31
e9cad8bd8ec8
child 33
3a0064eb9421

trunk: changeset 35
Added 'stripws'.

include/libtu/misc.h file | annotate | diff | comparison | revisions
misc.c file | annotate | diff | comparison | revisions
--- a/include/libtu/misc.h	Tue Jan 02 01:45:46 2001 +0100
+++ b/include/libtu/misc.h	Fri Jan 05 17:31:37 2001 +0100
@@ -29,6 +29,7 @@
 extern char* scat(const char *p1, const char *p2);
 extern char* scatn(const char *p1, ssize_t n1, const char *p2, ssize_t n2);
 extern char* scat3(const char *p1, const char *p2, const char *p3);
+extern void stripws(char *p);
 
 extern const char* simple_basename(const char *name);
 
--- a/misc.c	Tue Jan 02 01:45:46 2001 +0100
+++ b/misc.c	Fri Jan 05 17:31:37 2001 +0100
@@ -160,6 +160,23 @@
 }
 
 
+void stripws(char *p)
+{
+	int l;
+	
+	l=strspn(p, " ");
+	if(l!=0)
+		strcpy(p, p+l);
+	l=strlen(p);
+	
+	while(--l>=0){
+		if(*(p+l)!=' ')
+			break;
+	}
+	*(p+l+1)='\0';
+}
+
+
 /* */
 
 

mercurial