diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,24 @@ +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include "memory.h" +#include "util.h" + + +char* copy_buf(char *buf,int len){ + char *dst=malloc(len+1,char); + memcpy(dst,buf,len); + dst[len]='\0'; + return dst; +} + +char* copy_str(char *str){ + return copy_buf(str,strlen(str)); +} + +void str_toupper(char *str){ + while(*str!='\0'){ + *str=toupper(*str); + str++; + } +} |