/*
* Command line utility for making sense of C declarations.
- * Copyright © 2011-2012, 2020 Nick Bowler
+ * Copyright © 2011-2012, 2020-2021 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
puts(PACKAGE_STRING);
- printf("Copyright %s 2020 Nick Bowler.\n", copysign);
+ printf("Copyright %s 2021 Nick Bowler.\n", copysign);
puts("License GPLv3+: GNU GPL version 3 or any later version.");
puts("This is free software: you are free to change and redistribute it.");
puts("There is NO WARRANTY, to the extent permitted by law.");
static void print_usage(FILE *f)
{
fprintf(f, "Usage: %s [options]\n", progname);
+ if (f != stdout)
+ fprintf(f, _("Try %s --help for more information.\n"),
+ progname);
}
/*
tmp = realloc(buf, rc + 1);
if (!tmp) {
- fprintf(stderr, "failed to allocate memory\n");
+ fprintf(stderr, "%s\n", _("failed to allocate memory"));
return NULL;
}
{
bool show_intro = true, interactive = true, execute = false;
const char *filename = NULL;
- int opt, rc;
+ int i, opt, rc;
if (argc > 0)
progname = argv[0];
}
}
+ if (optind < argc) {
+ fprintf(stderr, _("%s: excess command-line arguments:"),
+ progname);
+ for (i = optind; i < argc; i++) {
+ fprintf(stderr, " %s", argv[i]);
+ }
+ fprintf(stderr, "\n");
+ print_usage(stderr);
+ return EXIT_FAILURE;
+ }
+
/* --filename and --execute imply --batch. */
if (filename || execute)
interactive = false;