#include <stdio.h>
#include <stdlib.h>
#include <string.h>
gehe zum Quellcode dieser Datei
|
void | usage (void) |
|
int | main (int argc, char **argv) |
|
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definiert in Zeile 51 der Datei dumpchk.c.
56 char *dumpname =
NULL;
59 for(i = 1; i < argc; i++) {
60 if (
strcmp(argv[i],
"-vxworks") == 0 ) {
63 else if (
strcmp(argv[i],
"-dryos") == 0 ) {
66 else if (
strcmp(argv[i],
"-fix") == 0 ) {
69 else if (
strcmp(argv[i],
"-quiet") == 0 ) {
72 else if ( argv[i][0] ==
'-' ) {
73 fprintf(stderr,
"%s unknown option %s\n",argv[0],argv[i]);
80 fprintf(stderr,
"%s unexpected %s\n",argv[0],argv[i]);
88 dumpfile =
fopen(dumpname,
"rb");
90 fprintf(stderr,
"%s unable to open %s\n",argv[0],dumpname);
101 printf(
"%s TOO SMALL: 0x%X (%d) bytes\n",dumpname,size,size);
107 fprintf(stderr,
"%s out of memory\n",argv[0]);
111 fread(buf, 1, size, dumpfile);
112 for(i=0; i<size; i++) {
124 printf(
"%s %s ",dumpname,found);
126 printf(
"@0x%X (%d) REMAINING 0x%X (%d) bytes\n",i,i,size-i,size-i);
129 printf(
"@Start SIZE 0x%X (%d)\n",size,size);
135 printf(
"%s 0x%X (%d) bytes no sig found\n",dumpname,size,size);
139 if(fix && i && i < size) {
140 dumpfile =
fopen(dumpname,
"wb");
141 printf(
"fix: %s trim 0x%X (%d) ...",dumpname,i,i);
143 fprintf(stderr,
"\n%s unable to open %s for write\n",argv[0],dumpname);
146 fwrite(buf+i,1,size-i,dumpfile);
147 printf(
" wrote 0x%X (%d)\n",size-i,size-i);
164 fprintf(stderr,
"%s out of memory\n",argv[0]);
168 if( (
int)
fread(buf,1,sigsize,dumpfile) != sigsize) {
172 retval = (
memcmp(buf,sig,sigsize) == 0);
178 printf(
"%s valid %s 0x%X (%d) bytes\n",dumpname,osname,size,size);
181 printf(
"%s NOT valid %s 0x%X (%d) bytes\n",dumpname,osname,size,size);
Definiert in Zeile 27 der Datei dumpchk.c.
28 fprintf(stderr,
"usage: dumpchk [-vxworks|-dryos|-fix] [-quiet] <dump>\n");
const char dryos_start_sig[] |
Initialisierung:= {
0x01, 0x00, 0x00, 0xEA,
'g', 'a','o', 'n', 'i', 's', 'o' ,'y'
}
Definiert in Zeile 42 der Datei dumpchk.c.
const char vxworks_start_sig[] |
Initialisierung:= {
0x02, 0x00, 0xA0, 0xE3,
0x12, 0x00, 0x00, 0xEA,
'C', 'o', 'p', 'y', 'r', 'i', 'g', 'h'
}
Definiert in Zeile 35 der Datei dumpchk.c.