unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
Cc: F.J.Wright@qmul.ac.uk, emacs-devel@gnu.org, emacs-pretest-bug@gnu.org
Subject: Re: Emacsclient/server filename quoting error
Date: Fri, 15 Dec 2006 13:07:01 +0100	[thread overview]
Message-ID: <f7ccd24b0612150407m25d3d312va7e68f00e243c47f@mail.gmail.com> (raw)
In-Reply-To: <u1wn1xvtj.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

On 12/15/06, Eli Zaretskii <eliz@gnu.org> wrote:

> Actually, a cleaner way of fixing this would be to have a
> WINDOWSNT-only wrapper for execvp, called, say w32_execvp, that does
> TRT with quoting the arguments.

You like this one better, then?

                    /L/e/k/t/u


Index: lib-src/emacsclient.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v
retrieving revision 1.98
diff -u -2 -r1.98 emacsclient.c
--- lib-src/emacsclient.c	30 Nov 2006 22:49:38 -0000	1.98
+++ lib-src/emacsclient.c	15 Dec 2006 11:49:57 -0000
@@ -299,4 +299,35 @@

 \f
+#ifdef WINDOWSNT
+
+/*
+  execvp() wrapper for Windows.
+  Quotes arguments with embedded spaces.
+*/
+int
+w32_execvp (path, argv)
+     char *path;
+     char **argv;
+{
+  int i;
+
+  argv[0] = (char *) alternate_editor;
+
+  for (i = 0; argv[i]; i++)
+    if (strchr (argv[i], ' '))
+      {
+	char *quoted = alloca (strlen (argv[i]) + 3);
+	sprintf (quoted, "\"%s\"", argv[i]);
+	argv[i] = quoted;
+      }
+
+  return execvp (path, argv);
+}
+
+#undef execvp
+#define execvp w32_execvp
+
+#endif /* WINDOWSNT */
+
 /*
   Try to run a different command, or --if no alternate editor is
@@ -311,7 +342,5 @@
     {
       int i = optind - 1;
-#ifdef WINDOWSNT
-      argv[i] = (char *)alternate_editor;
-#endif
+
       execvp (alternate_editor, argv + i);
       message (TRUE, "%s: error executing alternate editor \"%s\"\n",

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

  reply	other threads:[~2006-12-15 12:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <001701c71c53$1be9a9f0$041df159@Monolith>
2006-12-15 10:31 ` Emacsclient/server filename quoting error Juanma Barranquero
2006-12-15 11:06   ` Eli Zaretskii
2006-12-15 12:07     ` Juanma Barranquero [this message]
2006-12-15 14:19       ` Eli Zaretskii
2006-12-15 15:42         ` Juanma Barranquero
2006-12-15 15:50           ` David Kastrup
2006-12-15 16:03             ` Juanma Barranquero
2006-12-15 15:52           ` Eli Zaretskii
2006-12-15 15:14       ` Werner LEMBERG
2006-12-15 15:41         ` Juanma Barranquero
2006-12-15 15:54         ` Eli Zaretskii
2006-12-17 17:24       ` Francis Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0612150407m25d3d312va7e68f00e243c47f@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=F.J.Wright@qmul.ac.uk \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).