From 238fb93856cbc72c257468f30504eeaf42987bc8 Mon Sep 17 00:00:00 2001 From: Oz Tiram Date: Fri, 29 Nov 2024 22:23:45 +0100 Subject: [PATCH] chore: rename function usage to help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this prevent warning from GCC15: In file included from main.c:38: mh.h:93:6: error: conflicting types for ‘usage’; have ‘void(void)’ 93 | void usage(); | ^~~~~ In file included from main.c:37: cmd.h:71:6: note: previous definition of ‘usage’ with type ‘void(struct command *)’ 71 | void usage(struct command *cmd) { | ^~~~~ --- cmd.h | 14 ++++++++------ main.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd.h b/cmd.h index dfa5432..f567fd0 100644 --- a/cmd.h +++ b/cmd.h @@ -68,12 +68,12 @@ find_cmd(const char *arg) } -void usage(const struct command *cmd) { +void help(const struct command *cmd) { fprintf(stderr, PROGNAME " [ --help | --version | --file ] [target]\n"); fprintf(stderr, "\nOptions:\n"); - for (int i = 0; cmd[i].name != NULL; i++) { - fprintf(stderr, " %s, %s\t\t\t%s\n", cmd[i].shortcut, cmd[i].name, cmd[i].descr); - } + for (int i = 0; cmd[i].name != NULL; i++) { + fprintf(stderr, " %s, %s\t\t\t%s\n", cmd[i].shortcut, cmd[i].name, cmd[i].descr); + } } void version(void) { @@ -95,14 +95,14 @@ parse_args(int argc, char *argv[], char **filename, char **lookup) { int ch = find_cmd(argv[1]); switch (ch) { case CMD_HELP: - usage(cmd); + help(cmd); exit(1); case CMD_VERSION: version(); exit(0); case CMD_FILE: if (argc < 3) { - usage(cmd); + help(cmd); exit(1); } *filename = argv[2]; @@ -120,3 +120,5 @@ parse_args(int argc, char *argv[], char **filename, char **lookup) { } } } + +/* vim: set ts=4 sw=4 et: */ diff --git a/main.c b/main.c index a911e64..e320107 100644 --- a/main.c +++ b/main.c @@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "mh.h" -static int find_cmd(const char *); +static int find_cmd(const char *); int main(int argc, char *argv[])