Add p2cstring()

This commit is contained in:
Laurent Vivier 2005-09-22 23:04:43 +00:00
parent 58875373bb
commit 606df3c2a6
2 changed files with 11 additions and 0 deletions

View File

@ -69,6 +69,16 @@ unsigned char *c2pstring(char* s)
return (unsigned char*)s;
}
static char buffer[256];
unsigned char *p2cstring(unsigned char* s)
{
memcpy(buffer, s + 1, s[0]);
buffer[(int)s[0]] = (char)0;
return buffer;
}
void error(char *x)
{
console_putstring("\n\n");

View File

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