Go to the source code of this file.
Functions |
| bool | DllsLoad (const char *libdir) |
| void | InitAll (const char *cfgdir) |
| void | LogAll (void) |
| void | LogNone (void) |
| void | SDump (const unsigned char *buffer, int n) |
| int | ReadRaw (const char *name, unsigned char *buff, int maxlen) |
Function Documentation
| bool DllsLoad |
( |
const char * |
libdir | ) |
|
| void InitAll |
( |
const char * |
cfgdir | ) |
|
| int ReadRaw |
( |
const char * |
name, |
|
|
unsigned char * |
buff, |
|
|
int |
maxlen |
|
) |
| |
Definition at line 91 of file compat.c.
{
FILE *f=fopen(name,"r");
if(f) {
char line[512];
int len=0;
while(len<maxlen && fgets(line,sizeof(line),f)) {
if(strstr(line,"dump: n=")) continue;
char *p=index(line,'#');
if(p) *p=0;
p=index(line,'[');
if(p) {
p=index(p,']');
if(p) {
strcpy(line,p+1);
}
}
p=index(line,':');
if(p) p++; else p=line;
while(1) {
char *np;
int val=strtol(p,&np,16);
if(p!=np) {
buff[len++]=val;
p=np;
}
else break;
}
}
fclose(f);
return len;
}
printf("failed to open raw file %s: %s\n",name,strerror(errno));
exit(1);
}
| void SDump |
( |
const unsigned char * |
buffer, |
|
|
int |
n |
|
) |
| |
Definition at line 85 of file compat.c.
{
for(int l=0 ; l<n ; l++) printf("%02x ",buffer[l]);
printf("\n");
}