@@ -22,7 +22,7 @@ struct {
22
22
} context ;
23
23
24
24
void show_help () {
25
- printf (
25
+ puts (
26
26
"patchrom - Patch jump table into a ROM dump\n"
27
27
"\n"
28
28
"Usage: patchrom [-c] CONFIG ROM PAGE < SYMBOLS\n"
@@ -34,12 +34,12 @@ void show_help() {
34
34
"Examples:\n"
35
35
"\tpatchrom 00.config example.rom 0x00 <00.sym >00.inc\n"
36
36
"\t\tPatch example.rom with a jump table containing symbols listed in 00.config\n"
37
- "\t\tand output the jump table index definitions to 00.inc\n "
37
+ "\t\tand output the jump table index definitions to 00.inc"
38
38
);
39
39
}
40
40
41
41
void parse_context (int argc , char * * argv ) {
42
- const char * errorMessage = "Invalid usage - see `patchrom --help`\n " ;
42
+ const char * errorMessage = "Invalid usage - see `patchrom --help`" ;
43
43
context .c_headers = 0 ;
44
44
int i ;
45
45
for (i = 1 ; i < argc ; i ++ ) {
@@ -50,14 +50,14 @@ void parse_context(int argc, char **argv) {
50
50
} else if (strcmp (argv [i ], "-c" ) == 0 ) {
51
51
context .c_headers = 1 ;
52
52
} else {
53
- fprintf ( stderr , errorMessage );
53
+ fputs ( errorMessage , stderr );
54
54
exit (1 );
55
55
}
56
56
}
57
57
}
58
58
if (argc > 5 ) {
59
- fprintf ( stderr , errorMessage );
60
- exit (1 );
59
+ fputs ( errorMessage , stderr );
60
+ exit (1 );
61
61
}
62
62
63
63
context .config = fopen (argv [1 + context .c_headers ], "r" );
@@ -72,7 +72,7 @@ void parse_context(int argc, char **argv) {
72
72
}
73
73
if (sscanf (argv [3 + context .c_headers ], "0x%hhX" , & context .page ) != 1 &&
74
74
sscanf (argv [3 + context .c_headers ], "%hhu" , & context .page ) != 1 ) {
75
- fprintf ( stderr , errorMessage );
75
+ fputs ( errorMessage , stderr );
76
76
exit (1 );
77
77
}
78
78
}
@@ -197,9 +197,9 @@ int main(int argc, char **argv) {
197
197
fputc (ent -> address >> 8 , context .rom );
198
198
fseek (context .rom , -6 , SEEK_CUR );
199
199
if (context .c_headers ) {
200
- printf ("#define %s 0x%.2hX %.2hX\n" , ent -> symbol , index ++ , context .page );
200
+ printf ("#define %s 0x%.2X %.2hX\n" , ent -> symbol , index ++ , context .page );
201
201
} else {
202
- printf (".equ %s 0x%.2hX %.2hX\n" , ent -> symbol , index ++ , context .page );
202
+ printf (".equ %s 0x%.2X %.2hX\n" , ent -> symbol , index ++ , context .page );
203
203
}
204
204
}
205
205
0 commit comments