comparison src/fileio.c @ 11426:6502c07121b7

(Fexpand_file_name): Use IS_DIRECTORY_SEP instead of special code for WINDOWSNT.
author Karl Heuer <kwzh@gnu.org>
date Thu, 13 Apr 1995 17:45:06 +0000
parents 81c0a8b9ec55
children 51bc10be0dc7
comparison
equal deleted inserted replaced
11425:bcb88697b70b 11426:6502c07121b7
848 element starts with a "/". */ 848 element starts with a "/". */
849 849
850 /* "//" anywhere isn't necessarily hairy; we just start afresh 850 /* "//" anywhere isn't necessarily hairy; we just start afresh
851 with the second slash. */ 851 with the second slash. */
852 if (IS_DIRECTORY_SEP (p[0]) && IS_DIRECTORY_SEP (p[1]) 852 if (IS_DIRECTORY_SEP (p[0]) && IS_DIRECTORY_SEP (p[1])
853 #ifdef APOLLO 853 #if defined (APOLLO) || defined (WINDOWSNT)
854 /* // at start of filename is meaningful on Apollo system */ 854 /* // at start of filename is meaningful on Apollo
855 and WindowsNT systems */
855 && nm != p 856 && nm != p
856 #endif /* APOLLO */ 857 #endif /* APOLLO || WINDOWSNT */
857 #ifdef WINDOWSNT
858 /* \\ or // at the start of a pathname is meaningful on NT. */
859 && nm != p
860 #endif /* WINDOWSNT */
861 ) 858 )
862 nm = p + 1; 859 nm = p + 1;
863 860
864 /* "~" is hairy as the start of any path element. */ 861 /* "~" is hairy as the start of any path element. */
865 if (IS_DIRECTORY_SEP (p[0]) && p[1] == '~') 862 if (IS_DIRECTORY_SEP (p[0]) && p[1] == '~')
1137 #else /* not VMS */ 1134 #else /* not VMS */
1138 if (!IS_DIRECTORY_SEP (*p)) 1135 if (!IS_DIRECTORY_SEP (*p))
1139 { 1136 {
1140 *o++ = *p++; 1137 *o++ = *p++;
1141 } 1138 }
1142 else if ( 1139 else if (IS_DIRECTORY_SEP (p[0]) && IS_DIRECTORY_SEP (p[1])
1143 #ifdef WINDOWSNT 1140 #if defined (APOLLO) || defined (WINDOWSNT)
1144 (!strncmp (p, "\\\\", 2) || !strncmp (p, "//", 2)) 1141 /* // at start of filename is meaningful in Apollo
1145 #else /* not WINDOWSNT */ 1142 and WindowsNT systems */
1146 !strncmp (p, "//", 2)
1147 #endif /* not WINDOWSNT */
1148 #ifdef APOLLO
1149 /* // at start of filename is meaningful in Apollo system */
1150 && o != target 1143 && o != target
1151 #endif /* APOLLO */ 1144 #endif /* APOLLO */
1152 #ifdef WINDOWSNT
1153 /* \\ at start of filename is meaningful in Windows-NT */
1154 && o != target
1155 #endif /* WINDOWSNT */
1156 ) 1145 )
1157 { 1146 {
1158 o = target; 1147 o = target;
1159 p++; 1148 p++;
1160 } 1149 }
1167 just delete the whole "/.". */ 1156 just delete the whole "/.". */
1168 if (o == target && p[2] == '\0') 1157 if (o == target && p[2] == '\0')
1169 *o++ = *p; 1158 *o++ = *p;
1170 p += 2; 1159 p += 2;
1171 } 1160 }
1172 else if ( 1161 else if (IS_DIRECTORY_SEP (p[0]) && p[1] == '.' && p[2] == '.'
1173 #ifdef WINDOWSNT
1174 (!strncmp (p, "\\..", 3) || !strncmp (p, "/..", 3))
1175 #else /* not WINDOWSNT */
1176 !strncmp (p, "/..", 3)
1177 #endif /* not WINDOWSNT */
1178 /* `/../' is the "superroot" on certain file systems. */ 1162 /* `/../' is the "superroot" on certain file systems. */
1179 && o != target 1163 && o != target
1180 && (IS_DIRECTORY_SEP (p[3]) || p[3] == 0)) 1164 && (IS_DIRECTORY_SEP (p[3]) || p[3] == 0))
1181 { 1165 {
1182 while (o != target && (--o) && !IS_DIRECTORY_SEP (*o)) 1166 while (o != target && (--o) && !IS_DIRECTORY_SEP (*o))
1183 ; 1167 ;
1184 #ifdef APOLLO 1168 #if defined (APOLLO) || defined (WINDOWSNT)
1185 if (o == target + 1 && o[-1] == '/' && o[0] == '/') 1169 if (o == target + 1
1170 && IS_DIRECTORY_SEP (o[-1]) && IS_DIRECTORY_SEP (o[0]))
1186 ++o; 1171 ++o;
1187 else 1172 else
1188 #endif /* APOLLO */ 1173 #endif /* APOLLO || WINDOWSNT */
1189 #ifdef WINDOWSNT
1190 if (o == target + 1 && (o[-1] == '/' && o[0] == '/')
1191 || (o[-1] == '\\' && o[0] == '\\'))
1192 ++o;
1193 else
1194 #endif /* WINDOWSNT */
1195 if (o == target && IS_ANY_SEP (*o)) 1174 if (o == target && IS_ANY_SEP (*o))
1196 ++o; 1175 ++o;
1197 p += 3; 1176 p += 3;
1198 } 1177 }
1199 else 1178 else