fix: correct clang-format and other files

This commit is contained in:
2025-10-28 21:31:26 -04:00
parent 6af34bfd0d
commit c5881e15bf
17 changed files with 795 additions and 651 deletions

View File

@@ -44,34 +44,40 @@
/* TODO(vx-clutch): default this to argv[0] */
const char *prog_name = "";
void set_prog_name(char *name) { prog_name = prog_name ? basename(name) : ""; }
void emit_try_help() {
printf("Try '%s --help' for more information\n", prog_name);
void set_prog_name(char *name)
{
prog_name = prog_name ? basename(name) : "";
}
void emit_version() {
printf("\
void emit_try_help()
{
printf("Try '%s --help' for more information\n", prog_name);
}
void emit_version()
{
printf("\
%s %s %d\n\
Copyright (C) %d GCK.\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRNTY, to the extent permitted by law.\n\
",
prog_name, VERSION, COMMIT, YEAR);
prog_name, VERSION, COMMIT, YEAR);
}
int parse_standard_options(int argc, char **argv, void (*print_help)(),
void (*print_version)()) {
for (int i = 0; i < argc; ++i) {
if (!strcmp(argv[i], "--help")) {
print_help();
exit(EXIT_SUCCESS);
} else if (!strcmp(argv[i], "--version")) {
emit_version();
exit(EXIT_SUCCESS);
}
}
return 0;
void (*print_version)())
{
for (int i = 0; i < argc; ++i) {
if (!strcmp(argv[i], "--help")) {
print_help();
exit(EXIT_SUCCESS);
} else if (!strcmp(argv[i], "--version")) {
emit_version();
exit(EXIT_SUCCESS);
}
}
return 0;
}
/* end of file proginfo.c */