Fixed up copyright year mention.
[dabba.git] / dabbad / help.c
blob94bb0fbd43862ef5d78193691d84262805719bf8
1 /* __LICENSE_HEADER_BEGIN__ */
3 /*
4 * Copyright (C) 2012 Emmanuel Roullit <emmanuel.roullit@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
22 /* __LICENSE_HEADER_END__ */
24 #include <stdio.h>
25 #include <assert.h>
26 #include <getopt.h>
28 static const char _usage[] =
29 "usage: dabbad [<args>]\n\n" "The available options are:\n";
31 void show_usage(const struct option const *opt)
33 assert(opt);
35 printf("%s", _usage);
37 if (opt != NULL) {
38 while (opt->name != NULL) {
39 printf(" --%s", opt->name);
40 if (opt->has_arg == required_argument)
41 printf(" <arg>\n");
42 else if (opt->has_arg == optional_argument)
43 printf(" [arg]\n");
44 else
45 printf("\n");
46 opt++;