Better message on help and failure with -n.
This commit is contained in:
parent
3c6bec3dff
commit
1707803ff7
10
baked.c
10
baked.c
@ -36,6 +36,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DESC \
|
#define DESC \
|
||||||
|
"Options [Must always be first]\n" \
|
||||||
|
"\t-h, this message, -n dryrun\n" \
|
||||||
|
"In-file expansions\n" \
|
||||||
"\t$@ returns target-file\n" \
|
"\t$@ returns target-file\n" \
|
||||||
"\t$* returns target-file without suffix\n" \
|
"\t$* returns target-file without suffix\n" \
|
||||||
"\t$+ returns arguments\n"
|
"\t$+ returns arguments\n"
|
||||||
@ -290,7 +293,7 @@ main(int argc, char ** argv)
|
|||||||
|
|
||||||
if (argc < 2
|
if (argc < 2
|
||||||
|| !strcmp(argv[1], "-h"))
|
|| !strcmp(argv[1], "-h"))
|
||||||
{ fprintf(stderr, "%s: %s", argv[0], HELP DESC); return 1; }
|
{ goto help; }
|
||||||
|
|
||||||
g_filename = argv[1];
|
g_filename = argv[1];
|
||||||
|
|
||||||
@ -299,7 +302,7 @@ main(int argc, char ** argv)
|
|||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
{ ret = 1; g_filename = argv[2]; }
|
{ ret = 1; g_filename = argv[2]; }
|
||||||
else
|
else
|
||||||
{ return 1; }
|
{ goto help; }
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = find_region(g_filename);
|
buf = find_region(g_filename);
|
||||||
@ -321,4 +324,7 @@ main(int argc, char ** argv)
|
|||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return ret;
|
return ret;
|
||||||
|
help:
|
||||||
|
fprintf(stderr, "%s: %s", argv[0], HELP DESC);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user