Changeset: e158276d1a82 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e158276d1a82
Modified Files:
        clients/mapiclient/stethoscope.c
Branch: Feb2013
Log Message:

stethoscope: like mclient, accept first non-option argument as dbname or uri


diffs (39 lines):

diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -92,7 +92,7 @@ static char hostname[128];
 static void
 usage(void)
 {
-       fprintf(stderr, "stethoscope [options] +[trace options] 
{<mod>.<fcn>}\n");
+       fprintf(stderr, "stethoscope [options] [dbname] +[trace options] 
{<mod>.<fcn>}\n");
        fprintf(stderr, "  -d | --dbname=<database_name>\n");
        fprintf(stderr, "  -u | --user=<user>\n");
        fprintf(stderr, "  -p | --port=<portnr>\n");
@@ -166,6 +166,7 @@ main(int argc, char **argv)
        char *uri = NULL;
        char *user = NULL;
        char *password = NULL;
+       struct stat statb;
        char *response, *x;
        char buf[BUFSIZ + 1];
        char *mod, *fcn;
@@ -221,6 +222,18 @@ main(int argc, char **argv)
                }
        }
 
+       if (dbname == NULL && optind != argc && argv[optind][0] != '+' &&
+                       (stat(argv[optind], &statb) != 0 || 
!S_ISREG(statb.st_mode)))
+       {
+               dbname = argv[optind];
+               optind++;
+       }
+
+       if (dbname != NULL && strncmp(dbname, "mapi:monetdb://", 15) == 0) {
+               uri = dbname;
+               dbname = NULL;
+       }
+
        i = optind;
        if (argc > 1 && i < argc && argv[i][0] == '+') {
                k = setCounter(argv[i] + 1);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to