summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/util.c b/util.c
new file mode 100644
index 0000000..e8c92cc
--- /dev/null
+++ b/util.c
@@ -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++;
+ }
+}