X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Ffoobar.c;h=e979045ffe766859dabeee6184ff1ab9da971b0f;hb=cc18a9ce4adf8aab58e7fa4096dd667e0b78903d;hp=c4205e9f7e1bf5d451eb4f0b680235427afb74af;hpb=7d0a87a73a3962d361a2d3eb85ff346ffc7f4406;p=template.git diff --git a/src/foobar.c b/src/foobar.c index c4205e9..e979045 100644 --- a/src/foobar.c +++ b/src/foobar.c @@ -20,71 +20,7 @@ * A short description of this module... */ -#if HAVE_CONFIG_H -# include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "foobar.h" -#if HAVE_LIBGEN_H -# include -#else /* HAVE_LIBGEN_H */ -# define basename(path) (path) -#endif /* ! HAVE_LIBGEN_H */ - -#include -#include - -#include - -void exit_usage(char *name, int status) -{ - printf("Usage: %s \n" - - "\nOptions:\n" - " -h display this help and exit\n" - " -V display the version number and copyright\n" - - "\nfoobar "VERSION", http://tokkee.org\n", basename(name)); - exit(status); -} /* exit_usage */ - -void exit_version(void) -{ - printf("foobar version "VERSION", built "BUILD_DATE"\n" - "Copyright (C) 2008 Sebastian Harl \n" - - "\nThis is free software under the terms of the GNU GPLv2; see " - "the source for\ncopying conditions. There is NO WARRANTY; not " - "even for MERCHANTABILITY or\nFITNESS FOR A PARTICULAR " - "PURPOSE.\n"); - exit(0); -} /* exit_version */ - -int main(int argc, char **argv) -{ - while (42) { - int opt = getopt(argc, argv, "hV"); - - if (-1 == opt) - break; - - switch (opt) { - case 'h': - exit_usage(argv[0], 0); - break; - case 'V': - exit_version(); - break; - default: - exit_usage(argv[0], 1); - } - } - - if (optind < argc) - exit_usage(argv[0], 1); - return 0; -} /* main */ - /* vim: set tw=78 sw=4 ts=4 noexpandtab : */