Changeset: 6b5f99bf34ea for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6b5f99bf34ea
Modified Files:
        clients/ChangeLog.Aug2011
        clients/mapiclient/msqldump.1
        clients/mapiclient/msqldump.c
Branch: Aug2011
Log Message:

Like mclient, in msqldump the -d part of the option is optional.


diffs (60 lines):

diff --git a/clients/ChangeLog.Aug2011 b/clients/ChangeLog.Aug2011
--- a/clients/ChangeLog.Aug2011
+++ b/clients/ChangeLog.Aug2011
@@ -1,6 +1,10 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Aug 31 2011 Sjoerd Mullender <[email protected]>
+- msqldump now also accepts the database name as last argument on the
+  command line (i.e. without -d).
+
 * Fri Aug 26 2011 Fabian Groffen <[email protected]>
 - Made error messages from the server in mclient go to stderr, instead
   of stdout.
diff --git a/clients/mapiclient/msqldump.1 b/clients/mapiclient/msqldump.1
--- a/clients/mapiclient/msqldump.1
+++ b/clients/mapiclient/msqldump.1
@@ -5,6 +5,8 @@ msqldump \- dump a MonetDB/SQL database
 .B msqldump
 [
 .I options
+] [
+.I dbname
 ]
 .SH DESCRIPTION
 MonetDB is a database management system that is developed from a
@@ -22,6 +24,9 @@ Print usage information and exit.
 .TP
 \fB\-\-database=\fP\fIdatabase\fP (\fB\-d\fP \fIdatabase\fP)
 Specify the name of the database to connect to.
+The
+.B \-d
+can be omitted if it is the last option.
 .TP
 \fB\-\-host=\fP\fIhostname\fP (\fB\-h\fP \fIhostname\fP)
 Specify the name of the host on which the server runs (default:
diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c
--- a/clients/mapiclient/msqldump.c
+++ b/clients/mapiclient/msqldump.c
@@ -56,7 +56,7 @@ static void usage(const char *prog, int 
 static void
 usage(const char *prog, int xit)
 {
-       fprintf(stderr, "Usage: %s [ options ]\n", prog);
+       fprintf(stderr, "Usage: %s [ options ] [ dbname ]\n", prog);
        fprintf(stderr, "\nOptions are:\n");
        fprintf(stderr, " -h hostname | --host=hostname    host to connect 
to\n");
        fprintf(stderr, " -p portnr   | --port=portnr      port to connect 
to\n");
@@ -208,6 +208,11 @@ main(int argc, char **argv)
                }
        }
 
+       if (optind == argc - 1)
+               dbname = argv[optind];
+       else if (optind != argc)
+               usage(argv[0], -1);
+
        /* when config file would provide defaults */
        if (user_set_as_flag)
                passwd = NULL;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to