On 2008-05-08, Gary Johnson <[EMAIL PROTECTED]> wrote:
[...]
> The Problem:
>
> The basic problem is that "echo -n" is not portable. This is
> mentioned in the echo(1) man page on SunOS and has been discussed
> numerous times on comp.unix.shell. In particular, the echo commands
> in sh and ksh on HP-UX and Solaris do not have a -n option.
> Consequently, the sh_vimglob_func fails on those shells and systems.
>
> The Proposed Solution:
>
> I don't know the history or rationale behind the current
> implementation of sh_vimglob_func, but it seems odd that the first
> echo is given the -n option to suppress the final newline, then a
> second echo is used to create a newline in the same place. The
> solution, therefore, seems to be to eliminate the -n option to the
> first echo command and eliminate the second echo command completely.
> The resulting initial value of sh_vimglob_func is
>
> vimglob() { while [ $# -ge 1 ]; do echo "$1"; shift; done }; vimglob >
>
> This fixes the problem on SunOS with sh and ksh and would seem to
> improve portability. It does not fix the problem on SunOS with csh,
> but I think that problem has a different cause.
>
> I have made this change to vim 7.1.297 on Cygwin, Linux and SunOS
> and have so far not observed any adverse effects. The patch is
> included below.
>
> Regards,
> Gary
>
> -------------------------- os_unix.c.diff --------------------------
> *** os_unix.c.orig Wed May 7 17:17:29 2008
> --- os_unix.c Thu May 8 14:15:01 2008
> ***************
> *** 5152,5158 ****
> static int did_find_nul = FALSE;
> int ampersent = FALSE;
> /* vimglob() function to define for Posix shell */
> ! static char *sh_vimglob_func = "vimglob() { while [ $# -ge 1 ]; do echo
> -n \"$1\"; echo; shift; done }; vimglob >";
>
> *num_file = 0; /* default: no files found */
> *file = NULL;
> --- 5152,5158 ----
> static int did_find_nul = FALSE;
> int ampersent = FALSE;
> /* vimglob() function to define for Posix shell */
> ! static char *sh_vimglob_func = "vimglob() { while [ $# -ge 1 ]; do echo
> \"$1\"; shift; done }; vimglob >";
>
> *num_file = 0; /* default: no files found */
> *file = NULL;
>
Bram,
What's the status of this proposal? Is the official patch coming or
do you have reservations?
Regards,
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---