|
|
|
|
@ -169,6 +169,38 @@ void d_print_init() {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define D_PRINT_COL 16
|
|
|
|
|
void d_print_data (char *data, int len) {
|
|
|
|
|
int i, j;
|
|
|
|
|
int val;
|
|
|
|
|
char txt1 [256] = {0};
|
|
|
|
|
char txt2 [256] = {0};
|
|
|
|
|
char left [256] = {0};
|
|
|
|
|
char right [256] = {0};
|
|
|
|
|
|
|
|
|
|
d_printf ("memdump: len:%d", len);
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
|
val = data[i] & 0x00FF;
|
|
|
|
|
sprintf (txt1, "%2x ", val);
|
|
|
|
|
if (data[i] >= ' ' && data[i] <= '~') sprintf (txt2, "%c", data[i]);
|
|
|
|
|
else sprintf (txt2, ".");
|
|
|
|
|
strncat (left, txt1, 256);
|
|
|
|
|
strncat (right, txt2, 256);
|
|
|
|
|
if ((i%D_PRINT_COL)==D_PRINT_COL-1 || i == len-1) {
|
|
|
|
|
sprintf (txt1, " ");
|
|
|
|
|
sprintf (txt2, " ");
|
|
|
|
|
for (j = i%D_PRINT_COL; j != 0 && j < D_PRINT_COL; j++) {
|
|
|
|
|
strncat (left, txt1, 256);
|
|
|
|
|
strncat (right, txt2, 256);
|
|
|
|
|
}
|
|
|
|
|
d_printf (" |%s | %s |", left, right);
|
|
|
|
|
memset (left, 0x0, 256);
|
|
|
|
|
memset (right, 0x0, 256);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned long long int getticks () {
|
|
|
|
|
static unsigned long long int ticks = 0;
|
|
|
|
|
|
|
|
|
|
@ -303,24 +335,24 @@ void memswap (void *mem1, void *mem2, int size) {
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct stat *file_exist (char *fn) {
|
|
|
|
|
static struct stat fs;
|
|
|
|
|
int file_exist (char *fn) {
|
|
|
|
|
struct stat fs;
|
|
|
|
|
|
|
|
|
|
if (stat(fn, &fs) != 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return &fs;
|
|
|
|
|
return 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct stat *dir_exist (char *fn) {
|
|
|
|
|
static struct stat fs;
|
|
|
|
|
int dir_exist (char *fn) {
|
|
|
|
|
struct stat fs;
|
|
|
|
|
|
|
|
|
|
if (stat(fn, &fs) == 0) {
|
|
|
|
|
if (S_ISDIR(fs.st_mode))
|
|
|
|
|
return &fs;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|