Code

Updated copyright year to 2010.
[template.git] / src / foobar.c
index 523b57c6cd8f76ea926e05744b0c2d3e11249ded..fbb87759b87d2fab57badcad77a6c609d92a3ab8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * foobar - src/foobar.c
- * Copyright (C) 2008 Sebastian Harl <sh@tokkee.org>
+ * Copyright (C) 2010 Sebastian Harl <sh@tokkee.org>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
  * A short description of this module...
  */
 
-#if HAVE_CONFIG_H
-#      include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "foobar.h"
+#include "fb_features.h"
 
-#if HAVE_LIBGEN_H
-#      include <libgen.h>
-#else /* HAVE_LIBGEN_H */
-#      define basename(path) (path)
-#endif /* ! HAVE_LIBGEN_H */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <unistd.h>
+/*
+ * public API
+ */
 
-void exit_usage(char *name, int status)
+unsigned int
+fb_version(void)
 {
-       printf("Usage: %s <options>\n"
-
-                       "\nOptions:\n"
-                       "  -h    display this help and exit\n"
-                       "  -V    display the version number and copyright\n"
+       return FB_VERSION;
+} /* fb_version */
 
-                       "\nfoobar "VERSION", http://tokkee.org\n", basename(name));
-       exit(status);
-} /* exit_usage */
-
-void exit_version(void)
+const char *
+fb_version_string(void)
 {
-       printf("foobar version "VERSION", built "BUILD_DATE"\n"
-                       "Copyright (C) 2008 Sebastian Harl <sh@tokkee.org>\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 */
+       return FB_VERSION_STRING;
+} /* fb_version_string */
 
-int main(int argc, char **argv)
+const char *
+fb_version_extra(void)
 {
-       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 */
+       return FB_VERSION_EXTRA;
+} /* fb_version_extra */
 
 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */