~ubuntu-branches/ubuntu/maverick/vim/maverick

« back to all changes in this revision

Viewing changes to src/ex_getln.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-06-26 13:42:18 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080626134218-703edeyb8k70qpbz
Tags: 1:7.1.314-3ubuntu1
* Resynchronise with Debian. Remaining changes:
  - Enable detection of GNU screen as a mouse-capable terminal.
  - Add NoDisplay=true to gvim.desktop.
  - Drop vim-lesstif package and lesstif2-dev build-dependency.
  - Build-depend on libxt-dev.
  - Enable Python interpreter on basic builds.
  - Create a .pot file for translations.
  - Disable autoindent, line-wrapping, and backup files by default.
* Fixes various vulnerabilities due to improper quoting of 'execute'
  arguments (LP: #240216).
* Drop fixes for upgrade problems from Ubuntu 6.06 LTS; direct upgrades
  from 6.06 to 8.10 will not be supported.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3657
3657
                    }
3658
3658
                }
3659
3659
#ifdef BACKSLASH_IN_FILENAME
3660
 
                {
3661
 
                    char_u      buf[20];
3662
 
                    int         j = 0;
3663
 
 
3664
 
                    /* Don't escape '[' and '{' if they are in 'isfname'. */
3665
 
                    for (p = PATH_ESC_CHARS; *p != NUL; ++p)
3666
 
                        if ((*p != '[' && *p != '{') || !vim_isfilec(*p))
3667
 
                            buf[j++] = *p;
3668
 
                    buf[j] = NUL;
3669
 
                    p = vim_strsave_escaped(files[i], buf);
3670
 
                }
 
3660
                p = vim_strsave_fnameescape(files[i], FALSE);
3671
3661
#else
3672
 
                p = vim_strsave_escaped(files[i],
3673
 
                             xp->xp_shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
 
3662
                p = vim_strsave_fnameescape(files[i], xp->xp_shell);
3674
3663
#endif
3675
3664
                if (p != NULL)
3676
3665
                {
3710
3699
}
3711
3700
 
3712
3701
/*
 
3702
 * Escape special characters in "fname" for when used as a file name argument
 
3703
 * after a Vim command, or, when "shell" is non-zero, a shell command.
 
3704
 * Returns the result in allocated memory.
 
3705
 */
 
3706
    char_u *
 
3707
vim_strsave_fnameescape(fname, shell)
 
3708
    char_u *fname;
 
3709
    int    shell;
 
3710
{
 
3711
#ifdef BACKSLASH_IN_FILENAME
 
3712
    char_u      buf[20];
 
3713
    int         j = 0;
 
3714
    char_u      *p;
 
3715
 
 
3716
    /* Don't escape '[' and '{' if they are in 'isfname'. */
 
3717
    for (p = PATH_ESC_CHARS; *p != NUL; ++p)
 
3718
        if ((*p != '[' && *p != '{') || !vim_isfilec(*p))
 
3719
            buf[j++] = *p;
 
3720
    buf[j] = NUL;
 
3721
    return vim_strsave_escaped(fname, buf);
 
3722
#else
 
3723
    return vim_strsave_escaped(fname, shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
 
3724
#endif
 
3725
}
 
3726
 
 
3727
/*
3713
3728
 * Put a backslash before the file name in "pp", which is in allocated memory.
3714
3729
 */
3715
3730
    static void