comparison src/misc1.c @ 6663:056809de0b29 v7.4.656

updated for version 7.4.656 Problem: Missing changes for glob() in one file. Solution: Add the missing changes.
author Bram Moolenaar <bram@vim.org>
date Thu, 05 Mar 2015 21:21:19 +0100
parents f8f2a61e538d
children 9fda0c52db0b
comparison
equal deleted inserted replaced
6662:5e7cbaa2417b 6663:056809de0b29
10166 /* remove backslashes for the remaining components only */ 10166 /* remove backslashes for the remaining components only */
10167 (void)unix_expandpath(gap, buf, len + 1, flags, FALSE); 10167 (void)unix_expandpath(gap, buf, len + 1, flags, FALSE);
10168 } 10168 }
10169 else 10169 else
10170 { 10170 {
10171 struct stat sb;
10172
10171 /* no more wildcards, check if there is a match */ 10173 /* no more wildcards, check if there is a match */
10172 /* remove backslashes for the remaining components only */ 10174 /* remove backslashes for the remaining components only */
10173 if (*path_end != NUL) 10175 if (*path_end != NUL)
10174 backslash_halve(buf + len + 1); 10176 backslash_halve(buf + len + 1);
10175 if (mch_getperm(buf) >= 0) /* add existing file */ 10177 /* add existing file or symbolic link */
10178 if ((flags & EW_ALLLINKS) ? mch_lstat(buf, &sb) >= 0
10179 : mch_getperm(buf) >= 0)
10176 { 10180 {
10177 #ifdef MACOS_CONVERT 10181 #ifdef MACOS_CONVERT
10178 size_t precomp_len = STRLEN(buf)+1; 10182 size_t precomp_len = STRLEN(buf)+1;
10179 char_u *precomp_buf = 10183 char_u *precomp_buf =
10180 mac_precompose_path(buf, precomp_len, &precomp_len); 10184 mac_precompose_path(buf, precomp_len, &precomp_len);
10917 * EW_DIR add directories 10921 * EW_DIR add directories
10918 * EW_FILE add files 10922 * EW_FILE add files
10919 * EW_EXEC add executable files 10923 * EW_EXEC add executable files
10920 * EW_NOTFOUND add even when it doesn't exist 10924 * EW_NOTFOUND add even when it doesn't exist
10921 * EW_ADDSLASH add slash after directory name 10925 * EW_ADDSLASH add slash after directory name
10926 * EW_ALLLINKS add symlink also when the referred file does not exist
10922 */ 10927 */
10923 void 10928 void
10924 addfile(gap, f, flags) 10929 addfile(gap, f, flags)
10925 garray_T *gap; 10930 garray_T *gap;
10926 char_u *f; /* filename */ 10931 char_u *f; /* filename */
10927 int flags; 10932 int flags;
10928 { 10933 {
10929 char_u *p; 10934 char_u *p;
10930 int isdir; 10935 int isdir;
10931 10936 struct stat sb;
10932 /* if the file/dir doesn't exist, may not add it */ 10937
10933 if (!(flags & EW_NOTFOUND) && mch_getperm(f) < 0) 10938 /* if the file/dir/link doesn't exist, may not add it */
10939 if (!(flags & EW_NOTFOUND) && ((flags & EW_ALLLINKS)
10940 ? mch_lstat(f, &sb) < 0 : mch_getperm(f) < 0))
10934 return; 10941 return;
10935 10942
10936 #ifdef FNAME_ILLEGAL 10943 #ifdef FNAME_ILLEGAL
10937 /* if the file/dir contains illegal characters, don't add it */ 10944 /* if the file/dir contains illegal characters, don't add it */
10938 if (vim_strpbrk(f, (char_u *)FNAME_ILLEGAL) != NULL) 10945 if (vim_strpbrk(f, (char_u *)FNAME_ILLEGAL) != NULL)