Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv32491
Modified Files:
Makefile.ag monetdb.c
Removed Files:
monetdb_discover.c
Log Message:
Move monetdb_discover back into monetdb.c now it's only wrapper code
U Makefile.ag
Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/Makefile.ag,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile.ag 10 Sep 2009 09:44:57 -0000 1.11
+++ Makefile.ag 14 Sep 2009 18:20:05 -0000 1.12
@@ -33,7 +33,6 @@
merovingian_proxy.c
MONETDB_TMP_SUBS = \
- monetdb_discover.c \
monetdb_get.c \
monetdb_status.c
U monetdb.c
Index: monetdb.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/monetdb.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- monetdb.c 14 Sep 2009 15:14:08 -0000 1.47
+++ monetdb.c 14 Sep 2009 18:20:05 -0000 1.48
@@ -181,7 +181,91 @@
#include "monetdb_status.c"
-#include "monetdb_discover.c"
+
+static void
+command_discover(int argc, char *argv[])
+{
+ char path[8096];
+ char *buf;
+ char *p, *q;
+ size_t twidth = TERMWIDTH;
+ char location[twidth + 1];
+ char *match = NULL;
+ size_t numlocs = 50;
+ size_t posloc = 0;
+ size_t loclen = 0;
+ char **locations = malloc(sizeof(char*) * numlocs);
+
+ /* if Merovingian isn't running, there's not much we can do */
+ if (mero_running == 0) {
+ fprintf(stderr, "discover: cannot perform: MonetDB Database
Server "
+ "(merovingian) is not running\n");
+ exit(1);
+ }
+
+ if (argc == 0) {
+ exit(2);
+ } else if (argc > 2) {
+ /* print help message for this command */
+ command_help(2, &argv[-1]);
+ exit(1);
+ } else if (argc == 2) {
+ match = argv[1];
+ }
+
+ snprintf(path, 8095, "%s/.merovingian_control", dbfarm);
+ path[8095] = '\0';
+
+ /* Send the pass phrase to unlock the information available in
+ * merovingian. Anelosimus eximius is a social species of spiders,
+ * which help each other, just like merovingians do among each
+ * other. */
+ p = control_send(&buf, path, -1, "anelosimus", "eximius");
+ if (p != NULL) {
+ printf("FAILED:\n%s\n", p);
+ free(p);
+ return;
+ }
+
+ if ((p = strtok(buf, "\n")) != NULL) {
+ do {
+ if ((q = strchr(p, '\t')) == NULL) {
+ /* doesn't look correct */
+ printf("discover: WARNING: discarding incorrect
line: %s\n", p);
+ continue;
+ }
+ *q++ = '\0';
+
+ snprintf(path, sizeof(path), "%s%s", q, p);
+
+ if (match == NULL || glob(match, path)) {
+ /* cut too long location name */
+ abbreviateString(location, path, twidth);
+ /* store what we found */
+ if (posloc == numlocs)
+ locations = realloc(locations,
+ sizeof(char) * (numlocs
= numlocs * 2));
+ locations[posloc++] = strdup(location);
+ if (strlen(location) > loclen)
+ loclen = strlen(location);
+ }
+ } while ((p = strtok(NULL, "\n")) != NULL);
+ }
+
+ free(buf);
+
+ if (posloc > 0) {
+ printf("%*slocation\n",
+ (int)(loclen - 8 /* "location" */ - ((loclen -
8) / 2)), "");
+ /* could qsort the array here but we don't :P */
+ for (loclen = 0; loclen < posloc; loclen++) {
+ printf("%s\n", locations[loclen]);
+ free(locations[loclen]);
+ }
+ }
+
+ free(locations);
+}
typedef enum {
START = 0,
--- monetdb_discover.c DELETED ---
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins