aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2011-05-07 14:28:55 +0300
committerEli Zaretskii2011-05-07 14:28:55 +0300
commit0966ef96e7b63f3f85244f28b8c36c846c420e3b (patch)
tree6c1813798603eec60283fd9ed209f82f448ebc5a
parent7ef1d634067b0edbc126fa25afdf600d5482e403 (diff)
parent888c9e865f8c9faea62621519da7e42ba1b7adbf (diff)
downloademacs-0966ef96e7b63f3f85244f28b8c36c846c420e3b.tar.gz
emacs-0966ef96e7b63f3f85244f28b8c36c846c420e3b.zip
Adapt the MS-DOS build to latest changes.
src/callproc.c (call_process_cleanup): Don't close and unlink the temporary file if Fcall_process didn't create it in the first place. (Fcall_process): Don't create tempfile if stdout of the child process will be redirected to a file specified with `:file'. Don't try to re-open tempfile in that case, and set fd[0] to -1 as cue to call_process_cleanup not to close that handle. msdos/inttypes.h: Include stdint.h. (uintmax_t): Don't define, it is defined in stdint.h. msdos/sedlibmk.inp (am__append_1): Edit to comment out. (am__append_2): Edit to expose. (NEXT_AS_FIRST_DIRECTIVE_STDARG_H, NEXT_STDARG_H, STDARG_H): Edit to empty. (@GL_GENERATE_STDARG_H_TRUE@, @GL_GENERATE_STDARG_H_FALSE@): Edit to comment out corresponding lines.
-rw-r--r--msdos/ChangeLog12
-rw-r--r--msdos/inttypes.h6
-rw-r--r--msdos/sedlibmk.inp9
-rw-r--r--src/ChangeLog10
-rw-r--r--src/callproc.c60
5 files changed, 71 insertions, 26 deletions
diff --git a/msdos/ChangeLog b/msdos/ChangeLog
index 5e793544545..12fd7675d67 100644
--- a/msdos/ChangeLog
+++ b/msdos/ChangeLog
@@ -1,3 +1,15 @@
12011-05-07 Eli Zaretskii <eliz@gnu.org>
2
3 * inttypes.h: Include stdint.h.
4 (uintmax_t): Don't define, it is defined in stdint.h.
5
6 * sedlibmk.inp (am__append_1): Edit to comment out.
7 (am__append_2): Edit to expose.
8 (NEXT_AS_FIRST_DIRECTIVE_STDARG_H, NEXT_STDARG_H, STDARG_H): Edit
9 to empty.
10 (@GL_GENERATE_STDARG_H_TRUE@, @GL_GENERATE_STDARG_H_FALSE@): Edit
11 to comment out corresponding lines.
12
12011-04-30 Eli Zaretskii <eliz@gnu.org> 132011-04-30 Eli Zaretskii <eliz@gnu.org>
2 14
3 * inttypes.h: New file. 15 * inttypes.h: New file.
diff --git a/msdos/inttypes.h b/msdos/inttypes.h
index 650fea1d0a8..e21f1b1055c 100644
--- a/msdos/inttypes.h
+++ b/msdos/inttypes.h
@@ -20,11 +20,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#ifndef _REPL_INTTYPES_H 20#ifndef _REPL_INTTYPES_H
21#define _REPL_INTTYPES_H 21#define _REPL_INTTYPES_H
22 22
23/* As of May 2011, DJGPP v2.04 does not include stdint.h in its
24 inttypes.h, although it should. Therefore, include stdint.h
25 unconditionally. */
26#include <stdint.h>
27
23#if __DJGPP__ > 2 || __DJGPP_MINOR__ >= 4 28#if __DJGPP__ > 2 || __DJGPP_MINOR__ >= 4
24#include_next <inttypes.h> 29#include_next <inttypes.h>
25#else /* __DJGPP__ < 2.04 */ 30#else /* __DJGPP__ < 2.04 */
26#include <stdlib.h> 31#include <stdlib.h>
27#define uintmax_t unsigned long long
28#define strtoumax strtoull 32#define strtoumax strtoull
29#endif /* __DJGPP__ < 2.04 */ 33#endif /* __DJGPP__ < 2.04 */
30 34
diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp
index a99d0229df8..0c501421821 100644
--- a/msdos/sedlibmk.inp
+++ b/msdos/sedlibmk.inp
@@ -401,6 +401,7 @@ am__cd = cd
401# MKDIR_P lines are edited further below 401# MKDIR_P lines are edited further below
402/^MKDIR_P *=/s/@MKDIR_P@// 402/^MKDIR_P *=/s/@MKDIR_P@//
403/^NEXT_AS_FIRST_DIRECTIVE_GETOPT_H *=/s/@[^@\n]*@/<getopt.h>/ 403/^NEXT_AS_FIRST_DIRECTIVE_GETOPT_H *=/s/@[^@\n]*@/<getopt.h>/
404/^NEXT_AS_FIRST_DIRECTIVE_STDARG_H *=/s/@[^@\n]*@//
404/^NEXT_AS_FIRST_DIRECTIVE_STDDEF_H *=/s/@[^@\n]*@// 405/^NEXT_AS_FIRST_DIRECTIVE_STDDEF_H *=/s/@[^@\n]*@//
405/^NEXT_AS_FIRST_DIRECTIVE_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/ 406/^NEXT_AS_FIRST_DIRECTIVE_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/
406/^NEXT_AS_FIRST_DIRECTIVE_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/ 407/^NEXT_AS_FIRST_DIRECTIVE_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/
@@ -409,6 +410,7 @@ am__cd = cd
409/^NEXT_AS_FIRST_DIRECTIVE_TIME_H *=/s/@[^@\n]*@/<time.h>/ 410/^NEXT_AS_FIRST_DIRECTIVE_TIME_H *=/s/@[^@\n]*@/<time.h>/
410/^NEXT_AS_FIRST_DIRECTIVE_UNISTD_H *=/s/@[^@\n]*@/<unistd.h>/ 411/^NEXT_AS_FIRST_DIRECTIVE_UNISTD_H *=/s/@[^@\n]*@/<unistd.h>/
411/^NEXT_GETOPT_H *=/s/@[^@\n]*@/<getopt.h>/ 412/^NEXT_GETOPT_H *=/s/@[^@\n]*@/<getopt.h>/
413/^NEXT_STDARG_H *=/s/@[^@\n]*@//
412/^NEXT_STDDEF_H *=/s/@[^@\n]*@// 414/^NEXT_STDDEF_H *=/s/@[^@\n]*@//
413/^NEXT_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/ 415/^NEXT_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/
414/^NEXT_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/ 416/^NEXT_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/
@@ -506,6 +508,7 @@ am__cd = cd
506/^SIG_ATOMIC_T_SUFFIX *=/s/@SIG_ATOMIC_T_SUFFIX@// 508/^SIG_ATOMIC_T_SUFFIX *=/s/@SIG_ATOMIC_T_SUFFIX@//
507/^SIZE_T_SUFFIX *=/s/@SIZE_T_SUFFIX@/u/ 509/^SIZE_T_SUFFIX *=/s/@SIZE_T_SUFFIX@/u/
508/^STDBOOL_H *=/s/@[^@\n]*@// 510/^STDBOOL_H *=/s/@[^@\n]*@//
511/^STDARG_H *=/s/@[^@\n]*@//
509/^STDDEF_H *=/s/@[^@\n]*@// 512/^STDDEF_H *=/s/@[^@\n]*@//
510/^STDINT_H *=/s/@[^@\n]*@/stdint.h/ 513/^STDINT_H *=/s/@[^@\n]*@/stdint.h/
511/^SYS_TIME_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/ 514/^SYS_TIME_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/
@@ -514,6 +517,8 @@ am__cd = cd
514/^UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS *=/s/@[^@\n]*@/0/ 517/^UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS *=/s/@[^@\n]*@/0/
515/^WCHAR_T_SUFFIX *=/s/@WCHAR_T_SUFFIX@/h/ 518/^WCHAR_T_SUFFIX *=/s/@WCHAR_T_SUFFIX@/h/
516/^WINT_T_SUFFIX *=/s/@WINT_T_SUFFIX@// 519/^WINT_T_SUFFIX *=/s/@WINT_T_SUFFIX@//
520/am__append_1 *=.*gettext\.h/s/@[^@\n]*@/\#/
521/am__append_2 *=.*verify\.h/s/@[^@\n]*@//
517/^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o strftime.o time_r.o getloadavg.o md5.o filemode.o/ 522/^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o strftime.o time_r.o getloadavg.o md5.o filemode.o/
518/^BUILT_SOURCES *=/s/ *inttypes\.h// 523/^BUILT_SOURCES *=/s/ *inttypes\.h//
519/^am_libgnu_a_OBJECTS *=/s/careadlinkat\.\$(OBJEXT)// 524/^am_libgnu_a_OBJECTS *=/s/careadlinkat\.\$(OBJEXT)//
@@ -554,8 +559,10 @@ s/@echo /@djecho/
554# Fix the recipes for header files 559# Fix the recipes for header files
555s/^@GL_GENERATE_STDBOOL_H_TRUE@/\#/ 560s/^@GL_GENERATE_STDBOOL_H_TRUE@/\#/
556s/^@GL_GENERATE_STDBOOL_H_FALSE@// 561s/^@GL_GENERATE_STDBOOL_H_FALSE@//
562s/^@GL_GENERATE_STDARG_H_TRUE@/\#/
563s/^@GL_GENERATE_STDARG_H_FALSE@/\#/
557s/^@GL_GENERATE_STDDEF_H_TRUE@/\#/ 564s/^@GL_GENERATE_STDDEF_H_TRUE@/\#/
558s/^@GL_GENERATE_STDDEF_H_FALSE@// 565s/^@GL_GENERATE_STDDEF_H_FALSE@/\#/
559s/^@GL_GENERATE_STDINT_H_TRUE@// 566s/^@GL_GENERATE_STDINT_H_TRUE@//
560s/^@GL_GENERATE_STDINT_H_FALSE@/\#/ 567s/^@GL_GENERATE_STDINT_H_FALSE@/\#/
561/^arg-nonnull\.h:/,/^[ ][ ]*mv /c\ 568/^arg-nonnull\.h:/,/^[ ][ ]*mv /c\
diff --git a/src/ChangeLog b/src/ChangeLog
index 199c270a018..394b7a172f5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12011-05-07 Eli Zaretskii <eliz@gnu.org>
2
3 * callproc.c (call_process_cleanup): Don't close and unlink the
4 temporary file if Fcall_process didn't create it in the first
5 place.
6 (Fcall_process): Don't create tempfile if stdout of the child
7 process will be redirected to a file specified with `:file'.
8 Don't try to re-open tempfile in that case, and set fd[0] to -1 as
9 cue to call_process_cleanup not to close that handle.
10
12011-05-07 Ben Key <bkey76@gmail.com> 112011-05-07 Ben Key <bkey76@gmail.com>
2 12
3 * makefile.w32-in: The bootstrap-temacs rule now makes use of 13 * makefile.w32-in: The bootstrap-temacs rule now makes use of
diff --git a/src/callproc.c b/src/callproc.c
index 946670320ca..a966a26b938 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -114,6 +114,7 @@ call_process_cleanup (Lisp_Object arg)
114 Lisp_Object fdpid = Fcdr (arg); 114 Lisp_Object fdpid = Fcdr (arg);
115#if defined (MSDOS) 115#if defined (MSDOS)
116 Lisp_Object file; 116 Lisp_Object file;
117 int fd;
117#else 118#else
118 int pid; 119 int pid;
119#endif 120#endif
@@ -122,9 +123,13 @@ call_process_cleanup (Lisp_Object arg)
122 123
123#if defined (MSDOS) 124#if defined (MSDOS)
124 /* for MSDOS fdpid is really (fd . tempfile) */ 125 /* for MSDOS fdpid is really (fd . tempfile) */
126 fd = XFASTINT (Fcar (fdpid));
125 file = Fcdr (fdpid); 127 file = Fcdr (fdpid);
126 emacs_close (XFASTINT (Fcar (fdpid))); 128 /* FD is -1 and FILE is "" when we didn't actually create a
127 if (strcmp (SDATA (file), NULL_DEVICE) != 0) 129 temporary file in call-process. */
130 if (fd >= 0)
131 emacs_close (fd);
132 if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0'))
128 unlink (SDATA (file)); 133 unlink (SDATA (file));
129#else /* not MSDOS */ 134#else /* not MSDOS */
130 pid = XFASTINT (Fcdr (fdpid)); 135 pid = XFASTINT (Fcdr (fdpid));
@@ -199,7 +204,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
199 Lisp_Object error_file; 204 Lisp_Object error_file;
200 Lisp_Object output_file = Qnil; 205 Lisp_Object output_file = Qnil;
201#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ 206#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
202 char *outf, *tempfile; 207 char *outf, *tempfile = NULL;
203 int outfilefd; 208 int outfilefd;
204#endif 209#endif
205 int fd_output = -1; 210 int fd_output = -1;
@@ -439,22 +444,23 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
439 new_argv[0] = SDATA (path); 444 new_argv[0] = SDATA (path);
440 445
441#ifdef MSDOS /* MW, July 1993 */ 446#ifdef MSDOS /* MW, July 1993 */
442 if ((outf = egetenv ("TMPDIR")))
443 strcpy (tempfile = alloca (strlen (outf) + 20), outf);
444 else
445 {
446 tempfile = alloca (20);
447 *tempfile = '\0';
448 }
449 dostounix_filename (tempfile);
450 if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')
451 strcat (tempfile, "/");
452 strcat (tempfile, "detmp.XXX");
453 mktemp (tempfile);
454 447
455 /* If we're redirecting STDOUT to a file, this is already opened. */ 448 /* If we're redirecting STDOUT to a file, that file is already open
449 on fd_output. */
456 if (fd_output < 0) 450 if (fd_output < 0)
457 { 451 {
452 if ((outf = egetenv ("TMPDIR")))
453 strcpy (tempfile = alloca (strlen (outf) + 20), outf);
454 else
455 {
456 tempfile = alloca (20);
457 *tempfile = '\0';
458 }
459 dostounix_filename (tempfile);
460 if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')
461 strcat (tempfile, "/");
462 strcat (tempfile, "detmp.XXX");
463 mktemp (tempfile);
458 outfilefd = creat (tempfile, S_IREAD | S_IWRITE); 464 outfilefd = creat (tempfile, S_IREAD | S_IWRITE);
459 if (outfilefd < 0) { 465 if (outfilefd < 0) {
460 emacs_close (filefd); 466 emacs_close (filefd);
@@ -561,15 +567,21 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
561 if (fd_error != outfilefd) 567 if (fd_error != outfilefd)
562 emacs_close (fd_error); 568 emacs_close (fd_error);
563 fd1 = -1; /* No harm in closing that one! */ 569 fd1 = -1; /* No harm in closing that one! */
564 /* Since CRLF is converted to LF within `decode_coding', we can 570 if (tempfile)
565 always open a file with binary mode. */
566 fd[0] = emacs_open (tempfile, O_RDONLY | O_BINARY, 0);
567 if (fd[0] < 0)
568 { 571 {
569 unlink (tempfile); 572 /* Since CRLF is converted to LF within `decode_coding', we
570 emacs_close (filefd); 573 can always open a file with binary mode. */
571 report_file_error ("Cannot re-open temporary file", Qnil); 574 fd[0] = emacs_open (tempfile, O_RDONLY | O_BINARY, 0);
575 if (fd[0] < 0)
576 {
577 unlink (tempfile);
578 emacs_close (filefd);
579 report_file_error ("Cannot re-open temporary file",
580 Fcons (tempfile, Qnil));
581 }
572 } 582 }
583 else
584 fd[0] = -1; /* We are not going to read from tempfile. */
573#else /* not MSDOS */ 585#else /* not MSDOS */
574#ifdef WINDOWSNT 586#ifdef WINDOWSNT
575 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, 587 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv,
@@ -676,7 +688,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
676 record_unwind_protect (call_process_cleanup, 688 record_unwind_protect (call_process_cleanup,
677 Fcons (Fcurrent_buffer (), 689 Fcons (Fcurrent_buffer (),
678 Fcons (make_number (fd[0]), 690 Fcons (make_number (fd[0]),
679 build_string (tempfile)))); 691 build_string (tempfile ? tempfile : ""))));
680#else 692#else
681 record_unwind_protect (call_process_cleanup, 693 record_unwind_protect (call_process_cleanup,
682 Fcons (Fcurrent_buffer (), 694 Fcons (Fcurrent_buffer (),