wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

trim.c (288B)


      1 /* Written by Kris Maglione <maglione.k at Gmail> */
      2 /* Public domain */
      3 #include "util.h"
      4 
      5 void
      6 trim(char *str, const char *chars) {
      7 	const char *r;
      8 	char *p, *q;
      9 
     10 	for(p=str, q=str; *p; p++) {
     11 		for(r=chars; *r; r++)
     12 			if(*p == *r)
     13 				break;
     14 		if(!*r)
     15 			*q++ = *p;
     16 	}
     17 	*q = '\0';
     18 }
     19