summaryrefslogtreecommitdiff
path: root/util.c
blob: e8c92ccab43990426a734c748df7998d7fd75a8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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++;
	}
}