4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: On Sun systems opening /dev/fd/N doesn't work, and they are used
12 by process substitutions.
13 Solution: Allow opening specific character special files for Sun systems.
15 Files: src/fileio.c, src/os_unix.h
18 *** ../vim-7.1.026/src/fileio.c Thu Jun 28 21:57:08 2007
19 --- src/fileio.c Mon Jul 9 11:19:50 2007
23 /* Is there any system that doesn't have access()? */
24 #define USE_MCH_ACCESS
26 + #if defined(sun) && defined(S_ISCHR)
27 + # define OPEN_CHR_FILES
28 + static int is_dev_fd_file(char_u *fname);
31 static char_u *next_fenc __ARGS((char_u **pp));
37 && !S_ISSOCK(perm) /* ... or socket */
39 + # ifdef OPEN_CHR_FILES
40 + && !(S_ISCHR(perm) && is_dev_fd_file(fname))
41 + /* ... or a character special file named /dev/fd/<n> */
52 + # ifdef OPEN_CHR_FILES
53 + if (S_ISCHR(perm)) /* or character special */
55 + STRCAT(IObuff, _("[character special]"));
69 + #ifdef OPEN_CHR_FILES
71 + * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+",
72 + * which is the name of files used for process substitution output by
73 + * some shells on some operating systems, e.g., bash on SunOS.
74 + * Do not accept "/dev/fd/[012]", opening these may hang Vim.
77 + is_dev_fd_file(fname)
80 + return (STRNCMP(fname, "/dev/fd/", 8) == 0
81 + && VIM_ISDIGIT(fname[8])
82 + && *skipdigits(fname + 9) == NUL
84 + || (fname[8] != '0' && fname[8] != '1' && fname[8] != '2')));
90 *** ../vim-7.1.026/src/os_unix.h Thu May 10 19:43:10 2007
91 --- src/os_unix.h Sat Jul 7 13:08:56 2007
95 #if !defined(S_ISFIFO) && defined(S_IFIFO)
96 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
98 + #if !defined(S_ISCHR) && defined(S_IFCHR)
99 + # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
102 /* Note: Some systems need both string.h and strings.h (Savage). However,
103 * some systems can't handle both, only use string.h in that case. */
104 *** ../vim-7.1.026/src/version.c Tue Jul 10 14:02:51 2007
105 --- src/version.c Tue Jul 10 17:00:43 2007
109 { /* Add new patch number below this line */
115 Every exit is an entrance into something else.
117 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
118 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
119 \\\ download, build and distribute -- http://www.A-A-P.org ///
120 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///