diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-12-25 10:14:11 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-12-25 10:14:11 +0100 |
commit | ef28fcb0f59d11bdf9f574a999045bc24ca40e18 (patch) | |
tree | 5e998366f3ef2f2be88216d28631656c84036e41 /util.c |
Initial
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++; + } +} |