Skip to content

Commit 3d1e269

Browse files
committed
Don't quote the value of EDITOR on Unix, only on Windows. Per discussion.
1 parent ec7a6bd commit 3d1e269

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/bin/psql/command.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.134 2004/11/09 14:39:43 petere Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.135 2004/11/15 23:15:12 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -1096,12 +1096,20 @@ editFile(const char *fname)
10961096
if (!editorName)
10971097
editorName = DEFAULT_EDITOR;
10981098

1099+
/*
1100+
* On Unix the EDITOR value should *not* be quoted, since it might include
1101+
* switches, eg, EDITOR="pico -t"; it's up to the user to put quotes in it
1102+
* if necessary. But this policy is not very workable on Windows, due to
1103+
* severe brain damage in their command shell plus the fact that standard
1104+
* program paths include spaces.
1105+
*/
10991106
sys = pg_malloc(strlen(editorName) + strlen(fname) + 10 + 1);
1100-
sprintf(sys,
11011107
#ifndef WIN32
1102-
"exec "
1108+
sprintf(sys, "exec %s '%s'", editorName, fname);
1109+
#else
1110+
sprintf(sys, "%s\"%s\" \"%s\"%s",
1111+
SYSTEMQUOTE, editorName, fname, SYSTEMQUOTE);
11031112
#endif
1104-
"%s\"%s\" \"%s\"%s", SYSTEMQUOTE, editorName, fname, SYSTEMQUOTE);
11051113
result = system(sys);
11061114
if (result == -1)
11071115
psql_error("could not start editor \"%s\"\n", editorName);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy