Skip to content

Commit 758eb0f

Browse files
author
pixelherodev
authored
Merge pull request #5 from KnightOS/CI+fix
Add CI, remove Werror by default, fix KnightOS/KnightOS#406
2 parents ead9b59 + b9280de commit 758eb0f

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

.build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
image: archlinux
2+
packages:
3+
- cmake
4+
- asciidoc
5+
- samurai
6+
sources:
7+
- https://github.com/KnightOS/patchrom
8+
environment:
9+
project: patchrom
10+
tasks:
11+
- test: |
12+
cd ${project}
13+
mkdir build
14+
cd build
15+
cmake .. -GNinja
16+
samu

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.5)
22

33
project(patchrom C)
44

5-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Werror")
5+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic")
66

77
add_executable(patchrom main.c)
88

main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct {
2222
} context;
2323

2424
void show_help() {
25-
printf(
25+
puts(
2626
"patchrom - Patch jump table into a ROM dump\n"
2727
"\n"
2828
"Usage: patchrom [-c] CONFIG ROM PAGE < SYMBOLS\n"
@@ -34,12 +34,12 @@ void show_help() {
3434
"Examples:\n"
3535
"\tpatchrom 00.config example.rom 0x00 <00.sym >00.inc\n"
3636
"\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"
3838
);
3939
}
4040

4141
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`";
4343
context.c_headers = 0;
4444
int i;
4545
for (i = 1; i < argc; i++) {
@@ -50,14 +50,14 @@ void parse_context(int argc, char **argv) {
5050
} else if (strcmp(argv[i], "-c") == 0) {
5151
context.c_headers = 1;
5252
} else {
53-
fprintf(stderr, errorMessage);
53+
fputs(errorMessage, stderr);
5454
exit(1);
5555
}
5656
}
5757
}
5858
if (argc > 5) {
59-
fprintf(stderr, errorMessage);
60-
exit(1);
59+
fputs(errorMessage, stderr);
60+
exit(1);
6161
}
6262

6363
context.config = fopen(argv[1 + context.c_headers], "r");
@@ -72,7 +72,7 @@ void parse_context(int argc, char **argv) {
7272
}
7373
if (sscanf(argv[3 + context.c_headers], "0x%hhX", &context.page) != 1 &&
7474
sscanf(argv[3 + context.c_headers], "%hhu", &context.page) != 1) {
75-
fprintf(stderr, errorMessage);
75+
fputs(errorMessage, stderr);
7676
exit(1);
7777
}
7878
}
@@ -197,9 +197,9 @@ int main(int argc, char **argv) {
197197
fputc(ent->address >> 8, context.rom);
198198
fseek(context.rom, -6, SEEK_CUR);
199199
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);
201201
} 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);
203203
}
204204
}
205205

0 commit comments

Comments
 (0)