Add string conversion function from C string to pascal string

This commit is contained in:
Laurent Vivier 2004-06-21 22:40:10 +00:00
parent 574e8bdd9d
commit df7b2625d1
2 changed files with 13 additions and 0 deletions

View File

@ -48,6 +48,18 @@ char *strncpy (char *__restrict __dest,
return __dest;
}
unsigned char *c2pstring(char* s)
{
int len = strlen(s);
int i;
for (i = len; i > 0; i--)
s[i] = s[i - 1];
s[0] = len;
return (unsigned char*)s;
}
void error(char *x)
{
printf("\n\n");

View File

@ -11,5 +11,6 @@ typedef signed short int16_t;
typedef unsigned int u_int32_t;
typedef signed int int32_t;
extern unsigned char *c2pstring(char* s);
extern void memdump(unsigned char* addr, unsigned long size);
extern void error(char *x) __attribute__ ((noreturn));