[Frugalware-git] frugalwareutils: timeconfig: added --help and --version switches

Miklos Vajna vmiklos at frugalware.org
Mon Nov 5 16:01:11 CET 2007


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalwareutils.git;a=commitdiff;h=7bc50937de1cb8192758a25551c01d03d93779c5

commit 7bc50937de1cb8192758a25551c01d03d93779c5
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Mon Nov 5 15:52:10 2007 +0100

timeconfig: added --help and --version switches

diff --git a/timeconfig/Makefile b/timeconfig/Makefile
index b96704d..6c28594 100644
--- a/timeconfig/Makefile
+++ b/timeconfig/Makefile
@@ -17,7 +17,7 @@
#

-include ../config.mak
-CFLAGS = $(LIB_CFLAGS)
+CFLAGS = $(LIB_CFLAGS) -DVERSION="\"$(VERSION)\""
LDFLAGS=-ldialog -lcurses -lm
CFLAGS += $(shell pkg-config --cflags glib-2.0)
LDFLAGS += $(shell pkg-config --libs glib-2.0)
diff --git a/timeconfig/timeconfig.c b/timeconfig/timeconfig.c
index 0014f1b..a3bd6e9 100644
--- a/timeconfig/timeconfig.c
+++ b/timeconfig/timeconfig.c
@@ -107,6 +107,20 @@ int run(int argc, char **argv)
char *ptr;
GList *zones;

+	if(argc > 1)
+	{
+		if(!strcmp(argv[1], "--help"))
+		{
+			system("man timeconfig");
+			return(0);
+		}
+		else if(!strcmp(argv[1], "--version"))
+		{
+			printf("%s %s\n", argv[0], VERSION);
+			return(0);
+		}
+	}
+
fwutil_i18ninit(__FILE__);
if(argv!=NULL)
init_dialog(input, dialog_state.output);


More information about the Frugalware-git mailing list