Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=xbdmenu.git;a=commitdiff;h=20b8e03f781ab9eee792f7400f5e60369234bfaf
commit 20b8e03f781ab9eee792f7400f5e60369234bfaf Author: James Buren <[email protected]> Date: Tue Mar 10 19:45:43 2009 -0500 str.c * initial draft diff --git a/str.c b/str.c new file mode 100644 index 0000000..0e4d37a --- /dev/null +++ b/str.c @@ -0,0 +1,31 @@ +#include <string.h> +#include <ctype.h> +#include "mem.h" +#include "str.h" + +extern char *zstrdup(const char *str) +{ + char *ptr = zmalloc(strlen(str)+1); + strcpy(ptr,str); + return(ptr); +} + +extern char *strcmb(const char *str1,const char *str2) +{ + char *ptr = zmalloc(strlen(str1)+strlen(str2)+1); + strcpy(ptr,str1); + strcat(ptr,str2); + return(ptr); +} + +extern void strtrim(char str[]) +{ + unsigned int l=0,t=0,i,len=strlen(str); + while(isspace(str[l])) + ++l; + while(isspace(str[len-t-1])) + ++t; + for(i=0;i<len-l-t;++i) + str[i] = str[i+l]; + str[len-l-t] = '\0'; +} _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
