Mercurial > vim
comparison src/fileio.c @ 1877:b5c1cb6f8d56 v7.2.174
updated for version 7.2-174
author | vimboss |
---|---|
date | Fri, 15 May 2009 19:33:18 +0000 |
parents | 6c7719f94811 |
children | e5602d92da8c |
comparison
equal
deleted
inserted
replaced
1876:932ff0c0f57b | 1877:b5c1cb6f8d56 |
---|---|
3496 ignored = fchown(fd, st_old.st_uid, st_old.st_gid); | 3496 ignored = fchown(fd, st_old.st_uid, st_old.st_gid); |
3497 # endif | 3497 # endif |
3498 if (mch_stat((char *)IObuff, &st) < 0 | 3498 if (mch_stat((char *)IObuff, &st) < 0 |
3499 || st.st_uid != st_old.st_uid | 3499 || st.st_uid != st_old.st_uid |
3500 || st.st_gid != st_old.st_gid | 3500 || st.st_gid != st_old.st_gid |
3501 || st.st_mode != perm) | 3501 || (long)st.st_mode != perm) |
3502 backup_copy = TRUE; | 3502 backup_copy = TRUE; |
3503 # endif | 3503 # endif |
3504 /* Close the file before removing it, on MS-Windows we | 3504 /* Close the file before removing it, on MS-Windows we |
3505 * can't delete an open file. */ | 3505 * can't delete an open file. */ |
3506 close(fd); | 3506 close(fd); |
5961 else if (*ext == '/' || *ext == '_') | 5961 else if (*ext == '/' || *ext == '_') |
5962 #else | 5962 #else |
5963 else if (*ext == '.') | 5963 else if (*ext == '.') |
5964 #endif | 5964 #endif |
5965 { | 5965 { |
5966 if (s - ptr > (size_t)8) | 5966 if ((size_t)(s - ptr) > (size_t)8) |
5967 { | 5967 { |
5968 s = ptr + 8; | 5968 s = ptr + 8; |
5969 *s = '\0'; | 5969 *s = '\0'; |
5970 } | 5970 } |
5971 } | 5971 } |
6458 * Also check if the file for a new buffer unexpectedly appeared. | 6458 * Also check if the file for a new buffer unexpectedly appeared. |
6459 * return 1 if a changed buffer was found. | 6459 * return 1 if a changed buffer was found. |
6460 * return 2 if a message has been displayed. | 6460 * return 2 if a message has been displayed. |
6461 * return 0 otherwise. | 6461 * return 0 otherwise. |
6462 */ | 6462 */ |
6463 /*ARGSUSED*/ | |
6464 int | 6463 int |
6465 buf_check_timestamp(buf, focus) | 6464 buf_check_timestamp(buf, focus) |
6466 buf_T *buf; | 6465 buf_T *buf; |
6467 int focus; /* called for GUI focus event */ | 6466 int focus UNUSED; /* called for GUI focus event */ |
6468 { | 6467 { |
6469 struct stat st; | 6468 struct stat st; |
6470 int stat_res; | 6469 int stat_res; |
6471 int retval = 0; | 6470 int retval = 0; |
6472 char_u *path; | 6471 char_u *path; |
6866 /* restore curwin/curbuf and a few other things */ | 6865 /* restore curwin/curbuf and a few other things */ |
6867 aucmd_restbuf(&aco); | 6866 aucmd_restbuf(&aco); |
6868 /* Careful: autocommands may have made "buf" invalid! */ | 6867 /* Careful: autocommands may have made "buf" invalid! */ |
6869 } | 6868 } |
6870 | 6869 |
6871 /*ARGSUSED*/ | |
6872 void | 6870 void |
6873 buf_store_time(buf, st, fname) | 6871 buf_store_time(buf, st, fname) |
6874 buf_T *buf; | 6872 buf_T *buf; |
6875 struct stat *st; | 6873 struct stat *st; |
6876 char_u *fname; | 6874 char_u *fname UNUSED; |
6877 { | 6875 { |
6878 buf->b_mtime = (long)st->st_mtime; | 6876 buf->b_mtime = (long)st->st_mtime; |
6879 buf->b_orig_size = (size_t)st->st_size; | 6877 buf->b_orig_size = (size_t)st->st_size; |
6880 #ifdef HAVE_ST_MODE | 6878 #ifdef HAVE_ST_MODE |
6881 buf->b_orig_mode = (int)st->st_mode; | 6879 buf->b_orig_mode = (int)st->st_mode; |
6934 * The temp file is NOT created. | 6932 * The temp file is NOT created. |
6935 * | 6933 * |
6936 * The returned pointer is to allocated memory. | 6934 * The returned pointer is to allocated memory. |
6937 * The returned pointer is NULL if no valid name was found. | 6935 * The returned pointer is NULL if no valid name was found. |
6938 */ | 6936 */ |
6939 /*ARGSUSED*/ | |
6940 char_u * | 6937 char_u * |
6941 vim_tempname(extra_char) | 6938 vim_tempname(extra_char) |
6942 int extra_char; /* character to use in the name instead of '?' */ | 6939 int extra_char UNUSED; /* char to use in the name instead of '?' */ |
6943 { | 6940 { |
6944 #ifdef USE_TMPNAM | 6941 #ifdef USE_TMPNAM |
6945 char_u itmp[L_tmpnam]; /* use tmpnam() */ | 6942 char_u itmp[L_tmpnam]; /* use tmpnam() */ |
6946 #else | 6943 #else |
6947 char_u itmp[TEMPNAMELEN]; | 6944 char_u itmp[TEMPNAMELEN]; |
6966 if (vim_tempdir == NULL) | 6963 if (vim_tempdir == NULL) |
6967 { | 6964 { |
6968 /* | 6965 /* |
6969 * Try the entries in TEMPDIRNAMES to create the temp directory. | 6966 * Try the entries in TEMPDIRNAMES to create the temp directory. |
6970 */ | 6967 */ |
6971 for (i = 0; i < sizeof(tempdirs) / sizeof(char *); ++i) | 6968 for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i) |
6972 { | 6969 { |
6973 /* expand $TMP, leave room for "/v1100000/999999999" */ | 6970 /* expand $TMP, leave room for "/v1100000/999999999" */ |
6974 expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20); | 6971 expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20); |
6975 if (mch_isdir(itmp)) /* directory exists */ | 6972 if (mch_isdir(itmp)) /* directory exists */ |
6976 { | 6973 { |
9586 * If FEAT_OSFILETYPE defined then pass initial <type> through unchanged. Eg: | 9583 * If FEAT_OSFILETYPE defined then pass initial <type> through unchanged. Eg: |
9587 * '<html>myfile' becomes '<html>^myfile$' -- leonard. | 9584 * '<html>myfile' becomes '<html>^myfile$' -- leonard. |
9588 * | 9585 * |
9589 * Returns NULL when out of memory. | 9586 * Returns NULL when out of memory. |
9590 */ | 9587 */ |
9591 /*ARGSUSED*/ | |
9592 char_u * | 9588 char_u * |
9593 file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) | 9589 file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) |
9594 char_u *pat; | 9590 char_u *pat; |
9595 char_u *pat_end; /* first char after pattern or NULL */ | 9591 char_u *pat_end; /* first char after pattern or NULL */ |
9596 char *allow_dirs; /* Result passed back out in here */ | 9592 char *allow_dirs; /* Result passed back out in here */ |
9597 int no_bslash; /* Don't use a backward slash as pathsep */ | 9593 int no_bslash UNUSED; /* Don't use a backward slash as pathsep */ |
9598 { | 9594 { |
9599 int size; | 9595 int size; |
9600 char_u *endp; | 9596 char_u *endp; |
9601 char_u *reg_pat; | 9597 char_u *reg_pat; |
9602 char_u *p; | 9598 char_u *p; |