comparison src/lread.c @ 118:7d55a9ba150c r20-1b11

Import from CVS: tag r20-1b11
author cvs
date Mon, 13 Aug 2007 09:24:17 +0200
parents fe104dbd9147
children 585fb297b004
comparison
equal deleted inserted replaced
117:578fd4947a72 118:7d55a9ba150c
558 int pure_usage = 0; 558 int pure_usage = 0;
559 #endif 559 #endif
560 #ifdef DOS_NT 560 #ifdef DOS_NT
561 int dosmode = O_TEXT; 561 int dosmode = O_TEXT;
562 #endif /* DOS_NT */ 562 #endif /* DOS_NT */
563 struct stat s1, s2;
563 GCPRO3 (file, newer, found); 564 GCPRO3 (file, newer, found);
564 565
565 CHECK_STRING (file); 566 CHECK_STRING (file);
566 567
567 #ifdef DEBUG_XEMACS 568 #ifdef DEBUG_XEMACS
626 newer = Ffile_name_nondirectory (found); 627 newer = Ffile_name_nondirectory (found);
627 } 628 }
628 else if (load_warn_when_source_newer && 629 else if (load_warn_when_source_newer &&
629 !memcmp (".elc", foundstr + foundlen - 4, 4)) 630 !memcmp (".elc", foundstr + foundlen - 4, 4))
630 { 631 {
631 struct stat s1, s2; 632 /* struct stat s1, s2;*/
632 if (! fstat (fd, &s1)) /* can't fail, right? */ 633 if (! fstat (fd, &s1)) /* can't fail, right? */
633 { 634 {
634 int result; 635 int result;
635 /* temporarily hack the 'c' off the end of the filename */ 636 /* temporarily hack the 'c' off the end of the filename */
636 foundstr[foundlen - 1] = '\0'; 637 foundstr[foundlen - 1] = '\0';
660 source_only = 1; 661 source_only = 1;
661 } 662 }
662 663
663 if (!memcmp (".elc", foundstr + foundlen - 4, 4)) 664 if (!memcmp (".elc", foundstr + foundlen - 4, 4))
664 reading_elc = 1; 665 reading_elc = 1;
665 }
666 666
667 #ifdef DOS_NT 667 #ifdef DOS_NT
668 /* The file was opened as binary, because that's what we'll 668 /* The file was opened as binary, because that's what we'll
669 encounter most of the time. If we're loading a .el, we need 669 encounter most of the time. If we're loading a .el, we need
670 to reopen it in text mode. */ 670 to reopen it in text mode. */
671 if (!reading_elc) 671 if (!reading_elc)
672 fd = open (foundstr, O_RDONLY | O_TEXT); 672 fd = open (foundstr, O_RDONLY | O_TEXT);
673 #endif /* DOS_NT */ 673 #endif /* DOS_NT */
674 }
674 675
675 #define PRINT_LOADING_MESSAGE(done) do { \ 676 #define PRINT_LOADING_MESSAGE(done) do { \
676 if (load_ignore_elc_files) \ 677 if (load_ignore_elc_files) \
677 { \ 678 { \
678 if (message_p) \ 679 if (message_p) \
952 /* We succeeded; return this descriptor and filename. */ 953 /* We succeeded; return this descriptor and filename. */
953 if (storeptr) 954 if (storeptr)
954 *storeptr = build_string (fn); 955 *storeptr = build_string (fn);
955 UNGCPRO; 956 UNGCPRO;
956 957
958 /* XXX FIX ME
959 Not sure about this on NT yet. Do nothing for now.
960 --marcpa */
961 #ifndef DOS_NT
957 /* If we actually opened the file, set close-on-exec flag 962 /* If we actually opened the file, set close-on-exec flag
958 on the new descriptor so that subprocesses can't whack 963 on the new descriptor so that subprocesses can't whack
959 at it. */ 964 at it. */
960 if (mode < 0) 965 if (mode < 0)
961 (void) fcntl (fd, F_SETFD, FD_CLOEXEC); 966 (void) fcntl (fd, F_SETFD, FD_CLOEXEC);
967 #endif
962 968
963 return fd; 969 return fd;
964 } 970 }
965 } 971 }
966 972