www.pudn.com > arm_uDisk.rar > F_system.c


/***************************************************************/ 
/* 
 * F_system.c, 20070206, denny 
 * 
 * A Marconix Software Product 
 * Copyright(c) Marconix Co., Ltd. 2007 
 * All Rights Reserved. Reproduction, adaption, or 
 * translation without prior written permission is 
 * prohibited, except as allowed under the copyright laws. 
 */ 
/***************************************************************/ 
 
#include "inc.h"  
#include "F_system.h" 
 
u8 Intnum2Char(u8 Intnum) 
{ 
	if(Intnum>9) 
		return (0x41 + Intnum - 10); 
	else 
		return (0x30 + Intnum); 
} 
 
char *strupr(char *string) 
{ 
	unsigned char i=0; 
 
	do 
	{ 
		if(string[i]>='a'&&string[i]<='z') 
			string[i] -= 0x20; 
		i++; 
	}while(string[i]!='\0'); 
 
	return NULL; 
} 
 
char *strlwr(char *string) 
{ 
	unsigned char i=0; 
 
	do 
	{ 
		if(string[i]>='A' && string[i]<='Z') 
			string[i]+=0x20; 
		i++; 
	}while(string[i]!='\0'); 
} 
 
void memcpy(void *s1, const void *s2, int n) 
{ 
	int i; 
 
	for (i = 0; i < n; i++) 
		((char *)(s1))[i] = ((const char *)(s2))[i]; 
} 
 
void memset(void *s, const char ch, int n) 
{ 
	int i; 
 
	for (i = 0; i < n; i++) 
		((char *)(s))[i] = ch; 
} 
 
 
char *strcpy(char *dest, char *src) 
{ 
	u16 i,j; 
 
	for(i=0;; i++) 
	{ 
		if(src[i]!=0) 
			dest[i]=src[i]; 
		else{ 
			dest[i]='\0'; 
			break; 
		} 
	} 
	return NULL; 
} 
 
int strcmp(const char *s1, const char *s2) 
{ 
	u16 i; 
 
	for(i=0; ; i++) 
	{ 
		if(s1[i] != s2[i]) 
			return 1; 
		if(s1[i] =='\0' ) 
			break; 
	} 
	return 0; 
}