OSDN Git Service

I guess I'd vote for changing the code to be
authorBruce Momjian <bruce@momjian.us>
Wed, 14 Aug 2002 05:49:22 +0000 (05:49 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 14 Aug 2002 05:49:22 +0000 (05:49 +0000)
        sys = malloc(strlen(editorName) + strlen(fname) + 10 + 1);
        if (!sys)
                return false;
        sprintf(sys, "exec '%s' '%s'", editorName, fname);

(note the added quotes to provide a little protection against spaces
and such).  Then it's perfectly obvious what the calculation is doing.
I don't care about wasting 20-some bytes, but confusing readers of the
code is worth avoiding.

                        regards, tom lane

doc/TODO
src/bin/psql/command.c

index 86574fe..68690e4 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,6 +1,6 @@
 TODO list for PostgreSQL
 ========================
-Last updated:          Wed Aug 14 00:57:54 EDT 2002
+Last updated:          Wed Aug 14 01:46:11 EDT 2002
 
 Current maintainer:    Bruce Momjian (pgman@candle.pha.pa.us)
 
@@ -205,7 +205,8 @@ Commands
        o Add ALTER TABLE tab SET WITHOUT OIDS
 
 * CLUSTER
-       o Cluster all tables at once
+       o Cluster all tables at once using pg_index.indisclustered or primary
+          key
        o Prevent loss of indexes, permissions, inheritance
        o Automatically maintain clustering on a table
 
index c677c4e..1311209 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.77 2002/08/13 21:04:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.78 2002/08/14 05:49:22 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -1510,10 +1510,10 @@ editFile(const char *fname)
        if (!editorName)
                editorName = DEFAULT_EDITOR;
 
-       sys = malloc(strlen(editorName) + strlen(fname) + 32 + 1);
+       sys = malloc(strlen(editorName) + strlen(fname) + 10 + 1);
        if (!sys)
                return false;
-       sprintf(sys, "exec %s %s", editorName, fname);
+       sprintf(sys, "exec  '%s' '%s'", editorName, fname);
        result = system(sys);
        if (result == -1)
                psql_error("could not start editor %s\n", editorName);