Changeset: b331b521a1c7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b331b521a1c7
Modified Files:
clients/src/mapiclient/msqldump.c
Branch: Jun2010
Log Message:
Exit with status 0 if given the -? or --help option.
diffs (36 lines):
diff -r fcc2ce4e1a10 -r b331b521a1c7 clients/src/mapiclient/msqldump.c
--- a/clients/src/mapiclient/msqldump.c Wed Jul 21 12:51:56 2010 +0200
+++ b/clients/src/mapiclient/msqldump.c Wed Jul 21 14:45:33 2010 +0200
@@ -40,7 +40,7 @@
#endif
static void
-usage(const char *prog)
+usage(const char *prog, int xit)
{
fprintf(stderr, "Usage: %s [ options ]\n", prog);
fprintf(stderr, "\nOptions are:\n");
@@ -53,7 +53,7 @@
fprintf(stderr, " -q | --quiet don't print welcome
message\n");
fprintf(stderr, " -t | --trace trace mapi network
interaction\n");
fprintf(stderr, " -? | --help show this usage
message\n");
- exit(-1);
+ exit(xit);
}
/* hardwired defaults, only used if monet environment cannot be found */
@@ -179,9 +179,12 @@
trace = MAPI_TRACE;
break;
case '?':
- usage(argv[0]);
+ /* a bit of a hack: look at the option that the
+ current `c' is based on and see if we recognize
+ it: if -? or --help, exit with 0, else with -1 */
+ usage(argv[0], strcmp(argv[optind - 1], "-?") == 0 ||
strcmp(argv[optind - 1], "--help") == 0 ? 0 : -1);
default:
- usage(argv[0]);
+ usage(argv[0], -1);
}
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list