From: Enrico Scholz Date: Tue, 4 Nov 2003 13:50:48 +0000 (+0000) Subject: added '--help' and '--version' X-Git-Tag: VERSION_0_10~1088 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78076ffb4d9c1c4406612b3c070cc340219edeec;p=util-vserver.git added '--help' and '--version' git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@370 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/tests/vserver-info.c b/util-vserver/tests/vserver-info.c index 0204958..46dd587 100644 --- a/util-vserver/tests/vserver-info.c +++ b/util-vserver/tests/vserver-info.c @@ -25,10 +25,29 @@ #include "src/util.h" #include +static void +checkArgs(int argc, char *argv[]) +{ + if (argc==2) { + if (strcmp(argv[1], "--help")==0) { + WRITE_MSG(1, "Usage: vserver-info \n"); + exit(0); + } + if (strcmp(argv[1], "--version")==0) { + WRITE_MSG(1, "vserver-info " VERSION "\n"); + exit(0); + } + } + else { + WRITE_MSG(2, "No vserver specified; try '--help' for more inforamtion\n"); + exit(1); + } +} + int main(int argc, char *argv[]) { - vcCfgStyle style = vc_getVserverCfgStyle(argv[1]); + vcCfgStyle style = (checkArgs(argc, argv), vc_getVserverCfgStyle(argv[1])); char const * name = vc_getVserverName(argv[1], style); char const * vdir = vc_getVserverVdir(argv[1], style);