comparison src/fileio.c @ 23:3f44e9abe4ec v7.0015

updated for version 7.0015
author vimboss
date Mon, 06 Sep 2004 17:44:46 +0000
parents cc049b00ee70
children 8ff7fd162d3c
comparison
equal deleted inserted replaced
22:cc049b00ee70 23:3f44e9abe4ec
368 * If the name ends in a path separator, we can't open it. Check here, 368 * If the name ends in a path separator, we can't open it. Check here,
369 * because reading the file may actually work, but then creating the swap 369 * because reading the file may actually work, but then creating the swap
370 * file may destroy it! Reported on MS-DOS and Win 95. 370 * file may destroy it! Reported on MS-DOS and Win 95.
371 * If the name is too long we might crash further on, quit here. 371 * If the name is too long we might crash further on, quit here.
372 */ 372 */
373 if (fname != NULL 373 if (fname != NULL && *fname != NUL)
374 && *fname != NUL 374 {
375 && (vim_ispathsep(*(fname + STRLEN(fname) - 1)) 375 p = fname + STRLEN(fname) - 1;
376 || STRLEN(fname) >= MAXPATHL)) 376 if ((vim_ispathsep(*p)
377 { 377 #ifdef FEAT_MBYTE
378 filemess(curbuf, fname, (char_u *)_("Illegal file name"), 0); 378 /* Do not use a multi-byte char as path separator. */
379 msg_end(); 379 && (!has_mbyte || (*mb_head_off)(fname, p) == 0)
380 msg_scroll = msg_save; 380 #endif
381 return FAIL; 381 ) || STRLEN(fname) >= MAXPATHL)
382 {
383 filemess(curbuf, fname, (char_u *)_("Illegal file name"), 0);
384 msg_end();
385 msg_scroll = msg_save;
386 return FAIL;
387 }
382 } 388 }
383 389
384 #ifdef UNIX 390 #ifdef UNIX
385 /* 391 /*
386 * On Unix it is possible to read a directory, so we have to 392 * On Unix it is possible to read a directory, so we have to
7524 /* find a window for this buffer and save some values */ 7530 /* find a window for this buffer and save some values */
7525 aucmd_prepbuf(&aco, buf); 7531 aucmd_prepbuf(&aco, buf);
7526 7532
7527 /* execute the autocommands for this buffer */ 7533 /* execute the autocommands for this buffer */
7528 retval = do_doautocmd(eap->arg, FALSE); 7534 retval = do_doautocmd(eap->arg, FALSE);
7529 do_modelines(); 7535 do_modelines(FALSE);
7530 7536
7531 /* restore the current window */ 7537 /* restore the current window */
7532 aucmd_restbuf(&aco); 7538 aucmd_restbuf(&aco);
7533 7539
7534 /* stop if there is some error or buffer was deleted */ 7540 /* stop if there is some error or buffer was deleted */