Hello
The following is a bit more general...
Note that I did change the regular expression to include \n.
This also works with arguments having quotes in them.
(defun rcp-shell-quote-argument (argument)
"Quote an argument for passing as argument to an inferior shell."
(if (eq system-type 'ms-dos)
;; MS-DOS shells don't have quoting, so don't do any.
argument
(if (eq system-type 'windows-nt)
(concat "\"" argument "\"")
;; Quote everything except POSIX filename characters.
;; This should be safe enough even for really weird shells.
(let ((result "") (start 0) end)
(while (string-match "[^-0-9a-zA-Z_./\n]" argument start)
(setq end (match-beginning 0)
result (concat result (substring argument start end)
"\\" (substring argument end (1+ end)))
start (1+ end)))
(setq result (concat result (substring argument start) ))
(if (string-match "\n" argument 0)
(concat "\"" result "\"")
result
)
))))
Best regards
Mario
"DE WEERD, Mario" wrote:
>
> Hello
>
> I may have found something.
>
> Consider the following:
> An argument can be grouped if quoted simply by using "" or ''.
> In order to test, I have copied the rcp-shell-quote-argument function
> and I modified it.
> In case the argument has got newlines, I simply put "" around it.
> Result: this works.
>
> Now one should consider the following:
> - In this case the newlines may not be quoted. If they are qouted,
> they are seen as simple continuance characters (so a single line
> command).
> The regular expression probably needs to change in the
> shell-quote-argument thing.
> - Put quotes around the argument (with unquoted newlines).
>
> I do not know if this would work for the other shells.
>
> My test function (I replaced shell-quote-argument in the vc-do-command
> function with rcp-...).
>
> (defun rcp-shell-quote-argument (argument)
> "Quote an argument for passing as argument to an inferior shell."
> (if (eq system-type 'ms-dos)
> ;; MS-DOS shells don't have quoting, so don't do any.
> argument
> (if (eq system-type 'windows-nt)
> (concat "\"" argument "\"")
> ;; Quote everything except POSIX filename characters.
> ;; This should be safe enough even for really weird shells.
> (if (string-match "\n" argument 0) ; Newline in argument
> (concat "\"" argument "\"") ; Simply quote this
> (let ((result "") (start 0) end) ; Do standard stuff
> (while (string-match "[^-0-9a-zA-Z_./]" argument start)
> (setq end (match-beginning 0)
> result (concat result (substring argument start end)
> "\\" (substring argument end (1+ end)))
> start (1+ end)))
> (concat result (substring argument start) ))
> )
>
>
> )
> )))
>
> Regards
>
> Mario
>
> "DE WEERD, Mario" wrote:
> >
> > Kai Gro�johann wrote:
> > >
> > > "DE WEERD, Mario" <[EMAIL PROTECTED]> writes:
> > >
> > > > It looks like a real problem this VC/RCS thing.
> > > > Producing at least a space in the output is already something.
> > > > But in that case, we would still end up with very long lines which are
> > > > not manageable by vi (I use vi if I want to have a quick look).
> > >
> > > Well, if you can suggest a better implementation of rcp-vc-do-command,
> > > please do. I don't like the -m problem, either, but I don't know what
> > > else to do about it.
> > >
> > I do not know if printf(1) is a standard command on most (all) systems.
> > It might help if this is the case...
> > >
> > > kai
> > > --
> > > A preposition is not a good thing to end a sentence with.
> >
> > --
> > # ir. Mario De Weerd ##### mailto:[EMAIL PROTECTED] ##
> > # Senior Design Engineer
> > # Alcatel Microelectronics, Velizy, France
> > # France: Tel: +33-1-46328284 Fax: +33-1-46325568
> > ########################### Personal mailto:[EMAIL PROTECTED] ##
>
> --
> # ir. Mario De Weerd ##### mailto:[EMAIL PROTECTED] ##
> # Senior Design Engineer
> # Alcatel Microelectronics, Velizy, France
> # France: Tel: +33-1-46328284 Fax: +33-1-46325568
> ########################### Personal mailto:[EMAIL PROTECTED] ##
--
# ir. Mario De Weerd ##### mailto:[EMAIL PROTECTED] ##
# Senior Design Engineer
# Alcatel Microelectronics, Velizy, France
# France: Tel: +33-1-46328284 Fax: +33-1-46325568
########################### Personal mailto:[EMAIL PROTECTED] ##