Update of /cvsroot/monetdb/MonetDB5/src/tools
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17933

Modified Files:
        monetdb.mx 
Log Message:
Quote database names when appropriate.
Show help message when not using -a and specifying no databases to status


Index: monetdb.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/monetdb.mx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- monetdb.mx  3 Sep 2007 08:04:53 -0000       1.26
+++ monetdb.mx  4 Sep 2007 14:01:31 -0000       1.27
@@ -430,6 +430,7 @@
                return;
        }
 
+       doall = 0;  /* temporarily misuse this as db counter */
        for (i = 1; i < argc; i++) {
                if (argv[i] != NULL) {
                        if ((e = SABAOTHgetStatus(&stats, argv[i])) != 
MAL_SUCCEED) {
@@ -444,8 +445,14 @@
                                printStatus(stats, mode);
                                SABAOTHfreeStatus(&stats);
                        }
+                       doall++;
                }
        }
+
+       if (doall == 0) {
+               command_help(2, &argv[-1]);
+               exit(1);
+       }
 }
 
 typedef enum {
@@ -648,11 +655,11 @@
                         * ':' in there twice... */
                        fwrite("bla:", 4, 1, f);
                        fclose(f);
-                       printf("successfully created database %s%s\n", dbname,
+                       printf("successfully created database '%s'%s\n", dbname,
                                        (maintenance == 1 ? " in maintenance 
mode" : ""));
                } else {
                        SABAOTHfreeStatus(&stats);
-                       fprintf(stderr, "create: database %s already exists\n", 
dbname);
+                       fprintf(stderr, "create: database '%s' already 
exists\n", dbname);
                        exit(1);
                }
        }
@@ -765,13 +772,13 @@
                        err e;
 
                        if (stats->state == SABdbRunning) {
-                               fprintf(stderr, "destroy: database %s is still 
running, "
+                               fprintf(stderr, "destroy: database '%s' is 
still running, "
                                                "stop database first\n", 
dbname);
                                SABAOTHfreeStatus(&stats);
                                exit(1);
                        }
                        if (stats->locked == 1) {
-                               fprintf(stderr, "destroy: database %s is under 
maintenance"
+                               fprintf(stderr, "destroy: database '%s' is 
under maintenance"
                                                ", release database first\n", 
dbname);
                                SABAOTHfreeStatus(&stats);
                                exit(1);
@@ -779,7 +786,7 @@
 
                        if (force == 0) {
                                char answ;
-                               printf("you are about to remove database %s\n", 
dbname);
+                               printf("you are about to remove database 
'%s'\n", dbname);
                                printf("ALL data in this database will get 
lost, "
                                                "are you sure? [y/N] ");
                                scanf("%c", &answ);
@@ -794,13 +801,13 @@
                        /* annoyingly we have to delete file by file, and
                         * directories recursively... */
                        if ((e = deletedir(stats->path)) != NULL) {
-                               fprintf(stderr, "destroy: failed to destroy %s: 
%s\n",
+                               fprintf(stderr, "destroy: failed to destroy 
'%s': %s\n",
                                                argv[1], e);
                                GDKfree(e);
                                exit(1);
                        }
                        SABAOTHfreeStatus(&stats);
-                       printf("successfully destroyed database %s\n", dbname);
+                       printf("successfully destroyed database '%s'\n", 
dbname);
                } else {
                        fprintf(stderr, "destroy: no such database: %s\n", 
dbname);
                        exit(1);
@@ -832,7 +839,7 @@
                        char path[8096];
 
                        if (stats->locked == 1) {
-                               fprintf(stderr, "lock: database %s already is "
+                               fprintf(stderr, "lock: database '%s' already is 
"
                                                "under maintenance\n", dbname);
                                SABAOTHfreeStatus(&stats);
                                exit(1);
@@ -844,7 +851,7 @@
                        printf("database %s is now under maintenance\n", 
dbname);
                        SABAOTHfreeStatus(&stats);
                } else {
-                       fprintf(stderr, "lock: no such database %s\n", dbname);
+                       fprintf(stderr, "lock: no such database: %s\n", dbname);
                        exit(1);
                }
        }
@@ -874,7 +881,7 @@
                        char path[8096];
 
                        if (stats->locked != 1) {
-                               fprintf(stderr, "release: database %s is not "
+                               fprintf(stderr, "release: database '%s' is not "
                                                "under maintenance\n", dbname);
                                SABAOTHfreeStatus(&stats);
                                exit(1);
@@ -883,16 +890,16 @@
                        /* put this database in maintenance mode */
                        snprintf(path, 8095, "%s/.maintenance", stats->path);
                        if (unlink(path) != 0) {
-                               fprintf(stderr, "failed to take database %s out 
of maintenance"
-                                               " mode: %s\n", dbname, 
strerror(errno));
+                               fprintf(stderr, "failed to take database '%s' 
out of "
+                                               " maintenance mode: %s\n", 
dbname, strerror(errno));
                                SABAOTHfreeStatus(&stats);
                                exit(1);
                        }
-                       printf("database %s has been taken out of maintenance 
mode\n",
+                       printf("database '%s' has been taken out of maintenance 
mode\n",
                                        dbname);
                        SABAOTHfreeStatus(&stats);
                } else {
-                       fprintf(stderr, "release: no such database %s\n", 
dbname);
+                       fprintf(stderr, "release: no such database: %s\n", 
dbname);
                        exit(1);
                }
        }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to