Mercurial > vim
comparison src/os_msdos.c @ 39:410fa1a31baf v7.0023
updated for version 7.0023
author | vimboss |
---|---|
date | Sun, 19 Dec 2004 22:46:22 +0000 |
parents | 125e80798a85 |
children | e39657bbbb98 |
comparison
equal
deleted
inserted
replaced
38:c524f99c7925 | 39:410fa1a31baf |
---|---|
1698 if (*p == '\\' || *p == '/') | 1698 if (*p == '\\' || *p == '/') |
1699 while (*p) | 1699 while (*p) |
1700 { | 1700 { |
1701 if (*p == '\\') | 1701 if (*p == '\\') |
1702 *p = '/'; | 1702 *p = '/'; |
1703 #ifdef FEAT_MBYTE | 1703 mb_ptr_adv(p); |
1704 if (has_mbyte) | |
1705 p += (*mb_ptr2len_check)(p); | |
1706 else | |
1707 #endif | |
1708 ++p; | |
1709 } | 1704 } |
1710 else | 1705 else |
1711 #endif | 1706 #endif |
1712 while (*p) | 1707 while (*p) |
1713 { | 1708 { |
1714 if (*p == psepcN) | 1709 if (*p == psepcN) |
1715 *p = psepc; | 1710 *p = psepc; |
1716 #ifdef FEAT_MBYTE | 1711 mb_ptr_adv(p); |
1717 if (has_mbyte) | |
1718 p += (*mb_ptr2len_check)(p); | |
1719 else | |
1720 #endif | |
1721 ++p; | |
1722 } | 1712 } |
1723 } | 1713 } |
1724 | 1714 |
1725 /* | 1715 /* |
1726 * Return TRUE if "fname" does not depend on the current directory. | 1716 * Return TRUE if "fname" does not depend on the current directory. |
2032 * dos_expandpath(). | 2022 * dos_expandpath(). |
2033 */ | 2023 */ |
2034 int | 2024 int |
2035 mch_has_exp_wildcard(char_u *p) | 2025 mch_has_exp_wildcard(char_u *p) |
2036 { | 2026 { |
2037 for ( ; *p; ++p) | 2027 for ( ; *p; mb_ptr_adv(p)) |
2038 { | 2028 { |
2039 if (vim_strchr((char_u *)"?*[", *p) != NULL | 2029 if (vim_strchr((char_u *)"?*[", *p) != NULL |
2040 || (*p == '~' && p[1] != NUL)) | 2030 || (*p == '~' && p[1] != NUL)) |
2041 return TRUE; | 2031 return TRUE; |
2042 #ifdef FEAT_MBYTE | |
2043 if (has_mbyte) | |
2044 p += (*mb_ptr2len_check)(p) - 1; | |
2045 #endif | |
2046 } | 2032 } |
2047 return FALSE; | 2033 return FALSE; |
2048 } | 2034 } |
2049 | 2035 |
2050 /* | 2036 /* |
2052 * shortened file name). | 2038 * shortened file name). |
2053 */ | 2039 */ |
2054 int | 2040 int |
2055 mch_has_wildcard(char_u *p) | 2041 mch_has_wildcard(char_u *p) |
2056 { | 2042 { |
2057 for ( ; *p; ++p) | 2043 for ( ; *p; mb_ptr_adv(p)) |
2058 { | 2044 { |
2059 if (vim_strchr((char_u *) | 2045 if (vim_strchr((char_u *) |
2060 # ifdef VIM_BACKTICK | 2046 # ifdef VIM_BACKTICK |
2061 "?*$[`" | 2047 "?*$[`" |
2062 # else | 2048 # else |
2063 "?*$[" | 2049 "?*$[" |
2064 # endif | 2050 # endif |
2065 , *p) != NULL | 2051 , *p) != NULL |
2066 || (*p == '~' && p[1] != NUL)) | 2052 || (*p == '~' && p[1] != NUL)) |
2067 return TRUE; | 2053 return TRUE; |
2068 #ifdef FEAT_MBYTE | |
2069 if (has_mbyte) | |
2070 p += (*mb_ptr2len_check)(p) - 1; | |
2071 #endif | |
2072 } | 2054 } |
2073 return FALSE; | 2055 return FALSE; |
2074 } | 2056 } |
2075 | 2057 |
2076 /* | 2058 /* |
2136 * if we're renaming within the same directory. For example, | 2118 * if we're renaming within the same directory. For example, |
2137 * we're editing a file called filename.asc.txt by its SFN, | 2119 * we're editing a file called filename.asc.txt by its SFN, |
2138 * filena~1.txt. If we rename filena~1.txt to filena~1.txt~ | 2120 * filena~1.txt. If we rename filena~1.txt to filena~1.txt~ |
2139 * (i.e., we're making a backup while writing it), the SFN | 2121 * (i.e., we're making a backup while writing it), the SFN |
2140 * for filena~1.txt~ will be filena~1.txt, by default, which | 2122 * for filena~1.txt~ will be filena~1.txt, by default, which |
2141 * will cause all sorts of problems later in buf_write. So, we | 2123 * will cause all sorts of problems later in buf_write(). So, we |
2142 * create an empty file called filena~1.txt and the system will have | 2124 * create an empty file called filena~1.txt and the system will have |
2143 * to find some other SFN for filena~1.txt~, such as filena~2.txt | 2125 * to find some other SFN for filena~1.txt~, such as filena~2.txt |
2144 */ | 2126 */ |
2145 if ((fd = open(OldFile, O_RDWR|O_CREAT|O_EXCL, 0444)) < 0) | 2127 if ((fd = open(OldFile, O_RDWR|O_CREAT|O_EXCL, 0444)) < 0) |
2146 return -1; | 2128 return -1; |