Better message on help and failure with -n.

This commit is contained in:
Emil 2023-09-30 03:04:53 +00:00
parent 3c6bec3dff
commit 1707803ff7
No known key found for this signature in database
GPG Key ID: 5432DB986FDBCF8A

10
baked.c
View File

@ -36,6 +36,9 @@
#endif
#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 without suffix\n" \
"\t$+ returns arguments\n"
@ -290,7 +293,7 @@ main(int argc, char ** argv)
if (argc < 2
|| !strcmp(argv[1], "-h"))
{ fprintf(stderr, "%s: %s", argv[0], HELP DESC); return 1; }
{ goto help; }
g_filename = argv[1];
@ -299,7 +302,7 @@ main(int argc, char ** argv)
if (argc > 2)
{ ret = 1; g_filename = argv[2]; }
else
{ return 1; }
{ goto help; }
}
buf = find_region(g_filename);
@ -321,4 +324,7 @@ main(int argc, char ** argv)
free(buf);
return ret;
help:
fprintf(stderr, "%s: %s", argv[0], HELP DESC);
return 1;
}