From 8543ae7cee0ca6a58f34355c6675142e14065694 Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Sat, 28 May 2011 01:11:25 +0200 Subject: [PATCH 1/1] Implement basic --help option --- nbd-trdump.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nbd-trdump.c b/nbd-trdump.c index 49f4f9e..82b7688 100644 --- a/nbd-trdump.c +++ b/nbd-trdump.c @@ -43,6 +43,17 @@ int main(int argc, char**argv) { char * ctext; int readfd = 0; /* stdin */ + if(argc > 1) { + int retval=0; + if(strcmp(argv[1], "--help") && strcmp(argv[1], "-h")) { + printf("E: unknown option %s.\n", argv[1]); + retval=1; + } + printf("This is nbd-trdump, part of nbd %s.\n", PACKAGE_VERSION); + printf("Use: %s < transactionlog\n", argv[0]); + return retval; + } + while (1) { /* Read a request or reply from the transaction file */ doread(readfd, &magic, sizeof(magic)); -- 1.7.10.4