Update of /cvsroot/monetdb/clients/src/mapiclient
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12904

Modified Files:
        Makefile.ag MapiClient.mx 
Log Message:
The readline history should not be polluted with the small (debugger) lines.

Punishment of string columns should still use maximal space allowed.



Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/clients/src/mapiclient/Makefile.ag,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.ag 12 Apr 2007 09:33:55 -0000      1.4
+++ Makefile.ag 18 Aug 2007 15:02:28 -0000      1.5
@@ -24,6 +24,7 @@
        SOURCES = dump.c prompt.c
 }
 
+#Backward compatibility requirement
 bin_MapiClient = {
        SOURCES = MapiClient.mx ReadlineTools.mx
        LIBS = libmcutil ../mapilib/libMapi $(MAPI_LIBS) $(READLINE_LIBS) \
@@ -31,6 +32,14 @@
                $(ICONV_LIBS)
 }
 
+#Name alignment of tools in M5 context. 
+bin_mclient = {
+       SOURCES = MapiClient.mx ReadlineTools.mx
+       LIBS = libmcutil ../mapilib/libMapi $(MAPI_LIBS) $(READLINE_LIBS) \
+               $(MONETDB_LIBS) -lmutils -lstream \
+               $(ICONV_LIBS)
+}
+
 bin_msqldump = {
        SOURCES = msqldump.c
        LIBS = libmcutil ../mapilib/libMapi $(MAPI_LIBS) \

Index: MapiClient.mx
===================================================================
RCS file: /cvsroot/monetdb/clients/src/mapiclient/MapiClient.mx,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- MapiClient.mx       17 Aug 2007 15:29:57 -0000      1.59
+++ MapiClient.mx       18 Aug 2007 15:02:28 -0000      1.60
@@ -628,7 +628,7 @@
                                total = 0;
                                for (i = 0; i < fields; i++)
                                        total += len[i];
-                               while (2 * fields + total >= pagewidth && max) {
+                               while (2 * fields + 2 + total >= pagewidth && 
max) {
                                        max = 0;
                                        total = 0;
                                        for (i = 0; i < fields; i++)
@@ -642,28 +642,26 @@
                                                    len[i] > MINCOLSIZE) {
                                                        len[i]--;
                                                        total--;
-                                                       if (2 * fields + total 
== pagewidth)
+                                                       if (2 * fields + 2+ 
total == pagewidth)
                                                                break;
                                                        max = 1;
                                                }
                                        }
                                }
                                /* punish the long value fields */
-                               while (2 * fields + total >= pagewidth && 
len[max] > 1) {
+                               while (2 * fields + 2 + total >= pagewidth ) {
                                        total = 0;
-                                       max = 1;
+                                       max = 0;
                                        for (i = 0; i < fields; i++) {
                                                total += len[i];
                                                if (len[i] > len[max])
                                                        max = i;
                                        }
 
-                                       if (2 * fields + total >= pagewidth) {
-                                               /* penalty for largest field */
-                                               total -= len[max];
-                                               len[max] *= 0.9;
-                                               total += len[max];
-                                       }
+                                       /* penalty for largest field */
+                                       len[max] --;
+                                       total--;
+                                       if( len[max]==1) break;
                                }
                        }
 
@@ -824,13 +822,8 @@
                                fclose(fp);
                                file = NULL;
                        }
-                       if (hdl == NULL) {
-                               /* nothing more to do */
-                               timerEnd();
-                               free(buf);
-                               return 0;
-                       }
-                       /* hdl != NULL, we should finish the current query */
+                       if (hdl == NULL) 
+                               break; /* nothing more to do */
                }
 
                if (hdl == NULL) {
@@ -906,7 +899,8 @@
 
        } while (length > 0);
        /* reached on end of file */
-       assert(hdl == NULL);
+       if( hdl)
+               mapi_close_handle(hdl);
        timerEnd();
 
        free(buf);
@@ -1004,9 +998,11 @@
                                continue_completion(func);
                        /* add a newline to the end since that makes
                           further processing easier */
+                       /* don't store shortcut command in the history */
                        if (buf) {
-                               add_history(buf);
                                length = strlen(buf);
+                               if( length > 1 )
+                                       add_history(buf);
                                buf = realloc(buf, length + 2);
                                buf[length++] = '\n';
                                buf[length] = 0;
@@ -1260,6 +1256,7 @@
                                        continue;
                                }
                                default:
+                                       showCommands();
                                        continue;
                                }
                        }
@@ -1663,8 +1660,10 @@
                }
        }
        /* language value is mandatory */
-       if (mode == 0)
+       if (mode == 0){
+               fprintf(stderr,"Please specify a language option\n\n");
                usage(argv[0]);
+       }
 
        setlen = mo_system_config(&set, setlen);
 


-------------------------------------------------------------------------
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