mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-22 04:18:01 +00:00
Include filename in error output
This commit is contained in:
parent
9d4ee102b4
commit
69a5ca0bb9
@ -75,7 +75,7 @@ void json_print(json_object *j, int depth) {
|
||||
}
|
||||
}
|
||||
|
||||
void process(FILE *f) {
|
||||
void process(FILE *f, char *fname) {
|
||||
json_pull *jp = json_begin_file(f);
|
||||
json_object *j = NULL;
|
||||
|
||||
@ -88,13 +88,13 @@ void process(FILE *f) {
|
||||
}
|
||||
|
||||
if (jp->error != NULL) {
|
||||
fprintf(stderr, "%d: %s\n", jp->line, jp->error);
|
||||
fprintf(stderr, "%s: %d: %s\n", fname, jp->line, jp->error);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc == 1) {
|
||||
process(stdin);
|
||||
process(stdin, "standard input");
|
||||
} else {
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
@ -103,7 +103,7 @@ int main(int argc, char **argv) {
|
||||
perror(argv[i]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
process(f);
|
||||
process(f, argv[i]);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user