X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Famservice.c;h=b5346a128c5391450abf6dc3bccf366e54285f1c;hb=refs%2Ftags%2Fupstream%2F3.3.1;hp=286a77059ad103b63cb82c33a57d682c7a993966;hpb=cd0b924f27312d57bd42f6c4fae2b795139e2d0b;p=debian%2Famanda diff --git a/common-src/amservice.c b/common-src/amservice.c index 286a770..b5346a1 100644 --- a/common-src/amservice.c +++ b/common-src/amservice.c @@ -35,6 +35,12 @@ #include "protocol.h" #include "amfeatures.h" #include "event.h" +#include "getopt.h" + +static struct option long_options[] = { + {"version" , 0, NULL, 1}, + {NULL, 0, NULL, 0} +}; static int copy_stream = 0; static time_t conf_ctimeout; @@ -58,7 +64,7 @@ static void read_server(void *cookie, void *buf, ssize_t size); void usage(void) { - error(_("Usage: amservice [-o configoption]* [-f input_file [-s]] host auth service")); + error(_("Usage: amservice [--version] [-o configoption]* [-f input_file [-s]] host auth service")); /*NOTREACHED*/ } @@ -110,8 +116,11 @@ main( cfg_ovr = new_config_overrides(argc/2); input_file = stdin; - while((opt = getopt(argc, argv, "o:f:s")) != EOF) { + while((opt = getopt_long(argc, argv, "o:f:s", long_options, NULL)) != EOF) { switch(opt) { + case 1: printf("amservice-%s\n", VERSION); + return(0); + break; case 'o': add_config_override_opt(cfg_ovr, optarg); break; case 'f': got_input_file = 1;