Fabbio pointed to better solution of this problem. Patch attached.

Regards,
  Honza

Jan Friesse wrote:
> See SUBJ and Patch.
> 
> Regards,
>   Honza
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais

commit 282695479cfee7dc401345b449aaca688cfbe8c6
Author: Jan Friesse <[email protected]>
Date:   Tue Jul 28 11:56:15 2009 +0200

    Added support for -v (version) feature
    
    This can be usefull for easier way to get informations
    of the corosync version from users. Version (trunk) and SVN
    revision (get by svninfo -c) are displayed.

diff --git a/trunk/exec/Makefile.am b/trunk/exec/Makefile.am
index 5f83c64..40914b8 100644
--- a/trunk/exec/Makefile.am
+++ b/trunk/exec/Makefile.am
@@ -58,6 +58,7 @@ corosync_SOURCES 	= main.c util.c sync.c apidef.c service.c \
 corosync_LDADD	  	= -ltotem_pg -llogsys -lcoroipcs
 corosync_DEPENDENCIES	= libtotem_pg.so.$(SONAME) liblogsys.so.$(SONAME) libcoroipcs.so.$(SONAME)
 corosync_LDFLAGS	= $(OS_DYFLAGS) -L./
+corosync_CFLAGS 	= -DSVN_REVISION=\"$(shell svnversion -c)\"
 
 TOTEM_OBJS		= $(TOTEM_SRC:%.c=%.o)
 LOGSYS_OBJS		= $(LOGSYS_SRC:%.c=%.o)
diff --git a/trunk/exec/main.c b/trunk/exec/main.c
index 96919b6..42e974c 100644
--- a/trunk/exec/main.c
+++ b/trunk/exec/main.c
@@ -757,7 +757,7 @@ int main (int argc, char **argv)
 	background = 1;
 	setprio = 1;
 
- 	while ((ch = getopt (argc, argv, "fp")) != EOF) {
+	while ((ch = getopt (argc, argv, "fpv")) != EOF) {
 
 		switch (ch) {
 			case 'f':
@@ -767,11 +767,18 @@ int main (int argc, char **argv)
 			case 'p':
 				setprio = 0;
 				break;
+			case 'v':
+				printf ("Corosync Cluster Engine, version '%s' SVN revision '%s'\n", VERSION, SVN_REVISION);
+				printf ("Copyright (c) 2006-2009 Red Hat, Inc.\n");
+				return EXIT_SUCCESS;
+
+				break;
 			default:
 				fprintf(stderr, \
 					"usage:\n"\
 					"        -f     : Start application in foreground.\n"\
-					"        -p     : Do not set process priority.    \n");
+					"        -p     : Do not set process priority.    \n"\
+					"        -v     : Display version and SVN revision of Corosync and exit.\n");
 				return EXIT_FAILURE;
 		}
 	}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to