Mercurial > emacs
comparison src/lread.c @ 5496:24f0d2908e61
[MSDOS]: Use text mode for all files but ".elc" files.
(complete_file_name) [MSDOS]: Drive letter support.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 08 Jan 1994 09:17:27 +0000 |
parents | 13cce14b5a0c |
children | 1af95f18f709 |
comparison
equal
deleted
inserted
replaced
5495:87f9165f5b14 | 5496:24f0d2908e61 |
---|---|
45 | 45 |
46 #ifdef LISP_FLOAT_TYPE | 46 #ifdef LISP_FLOAT_TYPE |
47 #ifdef STDC_HEADERS | 47 #ifdef STDC_HEADERS |
48 #include <stdlib.h> | 48 #include <stdlib.h> |
49 #endif | 49 #endif |
50 | |
51 #if 0 /* That is untrue--XINT is used below, and it uses INTBITS. | |
52 What in the world is values.h, anyway? */ | |
53 #ifdef MSDOS | |
54 /* These are redefined in <values.h> and not used here */ | |
55 #undef INTBITS | |
56 #undef LONGBITS | |
57 #undef SHORTBITS | |
58 #endif | |
59 #endif | |
60 | |
50 #include <math.h> | 61 #include <math.h> |
51 #endif /* LISP_FLOAT_TYPE */ | 62 #endif /* LISP_FLOAT_TYPE */ |
52 | 63 |
53 Lisp_Object Qread_char, Qget_file_char, Qstandard_input, Qcurrent_load_list; | 64 Lisp_Object Qread_char, Qget_file_char, Qstandard_input, Qcurrent_load_list; |
54 Lisp_Object Qvariable_documentation, Vvalues, Vstandard_input, Vafter_load_alist; | 65 Lisp_Object Qvariable_documentation, Vvalues, Vstandard_input, Vafter_load_alist; |
317 struct gcpro gcpro1; | 328 struct gcpro gcpro1; |
318 Lisp_Object found; | 329 Lisp_Object found; |
319 /* 1 means inhibit the message at the beginning. */ | 330 /* 1 means inhibit the message at the beginning. */ |
320 int nomessage1 = 0; | 331 int nomessage1 = 0; |
321 Lisp_Object handler; | 332 Lisp_Object handler; |
333 #ifdef MSDOS | |
334 char *dosmode = "rt"; | |
335 #endif | |
322 | 336 |
323 CHECK_STRING (str, 0); | 337 CHECK_STRING (str, 0); |
324 str = Fsubstitute_in_file_name (str); | 338 str = Fsubstitute_in_file_name (str); |
325 | 339 |
326 /* If file name is magic, call the handler. */ | 340 /* If file name is magic, call the handler. */ |
350 ".elc", 4)) | 364 ".elc", 4)) |
351 { | 365 { |
352 struct stat s1, s2; | 366 struct stat s1, s2; |
353 int result; | 367 int result; |
354 | 368 |
369 #ifdef MSDOS | |
370 dosmode = "rb"; | |
371 #endif | |
355 stat (XSTRING (found)->data, &s1); | 372 stat (XSTRING (found)->data, &s1); |
356 XSTRING (found)->data[XSTRING (found)->size - 1] = 0; | 373 XSTRING (found)->data[XSTRING (found)->size - 1] = 0; |
357 result = stat (XSTRING (found)->data, &s2); | 374 result = stat (XSTRING (found)->data, &s2); |
358 if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime) | 375 if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime) |
359 { | 376 { |
364 nomessage1 = 1; | 381 nomessage1 = 1; |
365 } | 382 } |
366 XSTRING (found)->data[XSTRING (found)->size - 1] = 'c'; | 383 XSTRING (found)->data[XSTRING (found)->size - 1] = 'c'; |
367 } | 384 } |
368 | 385 |
386 #ifdef MSDOS | |
387 close (fd); | |
388 stream = fopen ((char *) XSTRING (found)->data, dosmode); | |
389 #else | |
369 stream = fdopen (fd, "r"); | 390 stream = fdopen (fd, "r"); |
391 #endif | |
370 if (stream == 0) | 392 if (stream == 0) |
371 { | 393 { |
372 close (fd); | 394 close (fd); |
373 error ("Failure to create stdio stream for %s", XSTRING (str)->data); | 395 error ("Failure to create stdio stream for %s", XSTRING (str)->data); |
374 } | 396 } |
420 || *s == '@' | 442 || *s == '@' |
421 #endif | 443 #endif |
422 #ifdef VMS | 444 #ifdef VMS |
423 || index (s, ':') | 445 || index (s, ':') |
424 #endif /* VMS */ | 446 #endif /* VMS */ |
447 #ifdef MSDOS /* MW, May 1993 */ | |
448 || (s[0] != '\0' && s[1] == ':' && s[2] == '/') | |
449 #endif | |
425 ); | 450 ); |
426 } | 451 } |
427 | 452 |
428 /* Search for a file whose name is STR, looking in directories | 453 /* Search for a file whose name is STR, looking in directories |
429 in the Lisp list PATH, and trying suffixes from SUFFIX. | 454 in the Lisp list PATH, and trying suffixes from SUFFIX. |