Mercurial > vim
comparison src/fileio.c @ 1313:dbd226be80b1 v7.1.027
updated for version 7.1-027
author | vimboss |
---|---|
date | Tue, 10 Jul 2007 15:10:54 +0000 |
parents | da0991871b02 |
children | c544a3507e83 |
comparison
equal
deleted
inserted
replaced
1312:b4b1b5324380 | 1313:dbd226be80b1 |
---|---|
42 #endif | 42 #endif |
43 | 43 |
44 /* Is there any system that doesn't have access()? */ | 44 /* Is there any system that doesn't have access()? */ |
45 #define USE_MCH_ACCESS | 45 #define USE_MCH_ACCESS |
46 | 46 |
47 #if defined(sun) && defined(S_ISCHR) | |
48 # define OPEN_CHR_FILES | |
49 static int is_dev_fd_file(char_u *fname); | |
50 #endif | |
47 #ifdef FEAT_MBYTE | 51 #ifdef FEAT_MBYTE |
48 static char_u *next_fenc __ARGS((char_u **pp)); | 52 static char_u *next_fenc __ARGS((char_u **pp)); |
49 # ifdef FEAT_EVAL | 53 # ifdef FEAT_EVAL |
50 static char_u *readfile_charconvert __ARGS((char_u *fname, char_u *fenc, int *fdp)); | 54 static char_u *readfile_charconvert __ARGS((char_u *fname, char_u *fenc, int *fdp)); |
51 # endif | 55 # endif |
403 # ifdef S_ISFIFO | 407 # ifdef S_ISFIFO |
404 && !S_ISFIFO(perm) /* ... or fifo */ | 408 && !S_ISFIFO(perm) /* ... or fifo */ |
405 # endif | 409 # endif |
406 # ifdef S_ISSOCK | 410 # ifdef S_ISSOCK |
407 && !S_ISSOCK(perm) /* ... or socket */ | 411 && !S_ISSOCK(perm) /* ... or socket */ |
412 # endif | |
413 # ifdef OPEN_CHR_FILES | |
414 && !(S_ISCHR(perm) && is_dev_fd_file(fname)) | |
415 /* ... or a character special file named /dev/fd/<n> */ | |
408 # endif | 416 # endif |
409 ) | 417 ) |
410 { | 418 { |
411 if (S_ISDIR(perm)) | 419 if (S_ISDIR(perm)) |
412 filemess(curbuf, fname, (char_u *)_("is a directory"), 0); | 420 filemess(curbuf, fname, (char_u *)_("is a directory"), 0); |
2263 STRCAT(IObuff, _("[socket]")); | 2271 STRCAT(IObuff, _("[socket]")); |
2264 c = TRUE; | 2272 c = TRUE; |
2265 } | 2273 } |
2266 # endif | 2274 # endif |
2267 # endif | 2275 # endif |
2276 # ifdef OPEN_CHR_FILES | |
2277 if (S_ISCHR(perm)) /* or character special */ | |
2278 { | |
2279 STRCAT(IObuff, _("[character special]")); | |
2280 c = TRUE; | |
2281 } | |
2282 # endif | |
2268 #endif | 2283 #endif |
2269 if (curbuf->b_p_ro) | 2284 if (curbuf->b_p_ro) |
2270 { | 2285 { |
2271 STRCAT(IObuff, shortmess(SHM_RO) ? _("[RO]") : _("[readonly]")); | 2286 STRCAT(IObuff, shortmess(SHM_RO) ? _("[RO]") : _("[readonly]")); |
2272 c = TRUE; | 2287 c = TRUE; |
2461 | 2476 |
2462 if (recoverymode && error) | 2477 if (recoverymode && error) |
2463 return FAIL; | 2478 return FAIL; |
2464 return OK; | 2479 return OK; |
2465 } | 2480 } |
2481 | |
2482 #ifdef OPEN_CHR_FILES | |
2483 /* | |
2484 * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+", | |
2485 * which is the name of files used for process substitution output by | |
2486 * some shells on some operating systems, e.g., bash on SunOS. | |
2487 * Do not accept "/dev/fd/[012]", opening these may hang Vim. | |
2488 */ | |
2489 static int | |
2490 is_dev_fd_file(fname) | |
2491 char_u *fname; | |
2492 { | |
2493 return (STRNCMP(fname, "/dev/fd/", 8) == 0 | |
2494 && VIM_ISDIGIT(fname[8]) | |
2495 && *skipdigits(fname + 9) == NUL | |
2496 && (fname[9] != NUL | |
2497 || (fname[8] != '0' && fname[8] != '1' && fname[8] != '2'))); | |
2498 } | |
2499 #endif | |
2466 | 2500 |
2467 #ifdef FEAT_MBYTE | 2501 #ifdef FEAT_MBYTE |
2468 | 2502 |
2469 /* | 2503 /* |
2470 * From the current line count and characters read after that, estimate the | 2504 * From the current line count and characters read after that, estimate the |