Commit 225151ef authored by chenhaowen's avatar chenhaowen

add command line option: -v/--version

parent 30e48dbb
#CC:=gcc
VERSION:=1.6.0
VERSION:=1.6.1
CFLAGS+= -Wall -fPIC -DDEBUG -DVERSION=\"$(VERSION)\"
objects= config.o auth.o
......
......@@ -29,13 +29,14 @@ int main(int argc, char *argv[])
{
{"help", no_argument, 0, 'h'},
{"config-file", required_argument, 0, 'c'},
{"version", no_argument, 0, 'v'},
{"remote-ip", required_argument, 0, 0},
{"remote-port", required_argument, 0, 1},
{"keep-alive1-flag", required_argument, 0, 2},
{"enable-crypt", no_argument, 0, 3},
{0, 0, 0, 0},
};
opt = getopt_long(argc, argv, "hc:", long_options, &option_index);
opt = getopt_long(argc, argv, "hc:v", long_options, &option_index);
if (opt == -1)
{
break;
......@@ -62,6 +63,10 @@ int main(int argc, char *argv[])
print_help(argv[0]);
exit(0);
break;
case 'v':
fprintf(stdout, "version: %s\n", VERSION);
exit(0);
break;
case '?':
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment