From a607590ecdc63848b9a3e996f64aa7ef975a1711 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Wed, 9 Nov 2011 18:35:19 +0100 Subject: Print complete usage --- src/pjctl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/pjctl.c b/src/pjctl.c index 3084d94..91f6bb2 100644 --- a/src/pjctl.c +++ b/src/pjctl.c @@ -556,11 +556,12 @@ static struct pjctl_command { }; static void -print_commands(struct pjctl *pjctl) +usage(struct pjctl *pjctl) { int i; - g_print("Commands:\n"); + g_print("usage: pjctl command [args..]\n\n"); + g_print("commands:\n"); for (i = 0; i < G_N_ELEMENTS(commands); ++i) g_print(" %s %s\n", commands[i].name, commands[i].help); } @@ -581,7 +582,7 @@ main(int argc, char **argv) g_type_init(); if (argc <= 2) { - print_commands(&pjctl); + usage(&pjctl); return 1; } @@ -595,7 +596,7 @@ main(int argc, char **argv) /* Nothing got into queue? User gave invalid command. */ if (g_list_length(pjctl.queue) == 0) { g_printerr("error: invalid command\n"); - print_commands(&pjctl); + usage(&pjctl); return 1; } -- cgit