From 386abde4df1b1fee4c933a47989c986c30856df9 Mon Sep 17 00:00:00 2001 From: Axel Wagner Date: Thu, 26 Aug 2010 00:01:24 +0200 Subject: [PATCH] Put usage-message in own function --- i3bar/src/main.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/i3bar/src/main.c b/i3bar/src/main.c index 75f21382..63b60367 100644 --- a/i3bar/src/main.c +++ b/i3bar/src/main.c @@ -35,6 +35,17 @@ char *expand_path(char *path) { return result; } +void print_usage(char *elf_name) { + printf("Usage: %s [-s sock_path] [-c command] [-m] [-f font] [-h]\n", elf_name); + printf("-s \tConnect to i3 via \n"); + printf("-c \tExecute to get stdin\n"); + printf("-m\t\tHide the bars, when mod4 is not pressed.\n"); + printf("\t\tIf -c is specified, the childprocess is sent a SIGSTOP on hiding,\n"); + printf("\t\tand a SIGCONT on unhiding of the bars\n"); + printf("-f \tUse X-Core-Font for display\n"); + printf("-h\t\tDisplay this help-message and exit\n"); +} + int main(int argc, char **argv) { int opt; int option_index = 0; @@ -65,12 +76,9 @@ int main(int argc, char **argv) { case 'v': printf("i3bar version " I3BAR_VERSION " © 2010 Axel Wagner and contributors\n"); exit(EXIT_SUCCESS); + break; default: - printf("Usage: %s [-s socket_path] [-c command] [-f font] [-h]\n", argv[0]); - printf("-s : Connect to i3 via \n"); - printf("-c : Execute to get stdin\n"); - printf("-f : Use X-Core-Font for display\n"); - printf("-h: Display this help-message and exit\n"); + print_usage(argv[0]); exit(EXIT_SUCCESS); break; } -- 2.39.5