[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using `call-process-shell-command' in `process-lines'

From: Lennart Borgman (gmail)
Subject: Re: Using `call-process-shell-command' in `process-lines'
Date: Mon, 26 Nov 2007 20:58:55 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Juanma Barranquero wrote:
On Nov 26, 2007 6:28 PM, Lennart Borgman (gmail)
<address@hidden> wrote:

Doesn't it look like arg passing in find.exe is a bit strange?

I think "yes" is the only sensible answer...

A summary using gnuwin32 find.exe:

- This gives the error "paths must precede expressions"

  (apply #'call-process "find.exe" nil
         (get-buffer-create "output")
         '("c:/emacs-lisp/old/" "-name" "*.el" ))

- The same for this in cmd.exe

  find -name *.el

- These two works:

  (apply #'call-process "find.exe" nil
         (get-buffer-create "output")
         '("c:/emacs-lisp/old/" "-name" "*l.el" ))

  (apply #'call-process "find.exe" nil
         (get-buffer-create "output")
         '("c:/emacs-lisp/old/" "-name" "m*.el" ))

- and these works in cmd.exe:

  find -name *l.el
  find -name m*.el
  find -name "*.el"

The arg parsing loop in find looks like this (though I do not know if it matters here):

  parse_open (argv, &argc);
  /* Build the input order list. */
  while (i < argc)
      if (strchr ("-!(),", argv[i][0]) == NULL)
        usage (_("paths must precede expression"));
      predicate_name = argv[i];
      parse_function = find_parser (predicate_name);
      if (parse_function == NULL)
        /* Command line option not recognized */
        error (1, 0, _("invalid predicate `%s'"), predicate_name);
      if (!(*parse_function) (argv, &i))
          if (argv[i] == NULL)
            /* Command line option requires an argument */
            error (1, 0, _("missing argument to `%s'"), predicate_name);
            error (1, 0, _("invalid argument `%s' to `%s'"),
                   argv[i], predicate_name);

Trying to understand what parse_function does is beyond my time table ;-) -- However from the loop above one can see that somehow parse_function seems to make a bad guess, but strangely enough not if the argument *.el is enclosed like "*.el" when it is called from the cmd.exe shell.

Is anyone able to understand what is going on?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]