Support for -v (version) feature

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


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2381 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Jan Friesse 2009-08-04 07:39:03 +00:00
parent 27b55337ce
commit 9931d50b31
4 changed files with 16 additions and 6 deletions

View File

@ -14,6 +14,11 @@ AC_CANONICAL_HOST
AC_LANG([C])
# Define SVN revision
AC_DEFINE([SVN_REVISION],["m4_esyscmd([svnversion >/dev/null 2>&1 && \
svnversion -n || \
echo -n exported])"], [SVN revision])
dnl Fix default variables - "prefix" variable if not specified
if test "$prefix" = "NONE"; then
prefix="/usr"

View File

@ -70,7 +70,7 @@ SHARED_LIBS_SO_TWO = $(SHARED_LIBS:%.so.$(SONAME)=%.so.$(SOMAJOR))
noinst_HEADERS = apidef.h crypto.h mainconfig.h main.h \
quorum.h service.h sync.h timer.h tlist.h totemconfig.h \
totemmrp.h totemnet.h totemudp.h totemiba.h totemrrp.h \
totemsrp.h util.h version.h vsf.h wthread.h schedwrk.h \
totemsrp.h util.h vsf.h wthread.h schedwrk.h \
evil.h syncv2.h
EXTRA_DIST = $(LCRSO_SRC)

View File

@ -83,7 +83,6 @@
#include "apidef.h"
#include "service.h"
#include "schedwrk.h"
#include "version.h"
#include "evil.h"
LOGSYS_DECLARE_SYSTEM ("corosync",
@ -757,7 +756,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':
@ -766,12 +765,19 @@ int main (int argc, char **argv)
break;
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;
}
}
@ -790,7 +796,7 @@ int main (int argc, char **argv)
corosync_mlockall ();
log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine ('%s'): started and ready to provide service.\n", RELEASE_VERSION);
log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine ('%s'): started and ready to provide service.\n", VERSION);
(void)signal (SIGINT, sigintr_handler);
(void)signal (SIGUSR2, sigusr2_handler);

View File

@ -1 +0,0 @@
#define RELEASE_VERSION "trunk"