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.
This commit is contained in:
Eli Zaretskii 2011-05-07 14:28:55 +03:00
commit 0966ef96e7
5 changed files with 71 additions and 26 deletions

View file

@ -1,3 +1,15 @@
2011-05-07 Eli Zaretskii <eliz@gnu.org>
* inttypes.h: Include stdint.h.
(uintmax_t): Don't define, it is defined in stdint.h.
* 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.
2011-04-30 Eli Zaretskii <eliz@gnu.org>
* inttypes.h: New file.

View file

@ -20,11 +20,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _REPL_INTTYPES_H
#define _REPL_INTTYPES_H
/* As of May 2011, DJGPP v2.04 does not include stdint.h in its
inttypes.h, although it should. Therefore, include stdint.h
unconditionally. */
#include <stdint.h>
#if __DJGPP__ > 2 || __DJGPP_MINOR__ >= 4
#include_next <inttypes.h>
#else /* __DJGPP__ < 2.04 */
#include <stdlib.h>
#define uintmax_t unsigned long long
#define strtoumax strtoull
#endif /* __DJGPP__ < 2.04 */

View file

@ -401,6 +401,7 @@ am__cd = cd
# MKDIR_P lines are edited further below
/^MKDIR_P *=/s/@MKDIR_P@//
/^NEXT_AS_FIRST_DIRECTIVE_GETOPT_H *=/s/@[^@\n]*@/<getopt.h>/
/^NEXT_AS_FIRST_DIRECTIVE_STDARG_H *=/s/@[^@\n]*@//
/^NEXT_AS_FIRST_DIRECTIVE_STDDEF_H *=/s/@[^@\n]*@//
/^NEXT_AS_FIRST_DIRECTIVE_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/
/^NEXT_AS_FIRST_DIRECTIVE_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/
@ -409,6 +410,7 @@ am__cd = cd
/^NEXT_AS_FIRST_DIRECTIVE_TIME_H *=/s/@[^@\n]*@/<time.h>/
/^NEXT_AS_FIRST_DIRECTIVE_UNISTD_H *=/s/@[^@\n]*@/<unistd.h>/
/^NEXT_GETOPT_H *=/s/@[^@\n]*@/<getopt.h>/
/^NEXT_STDARG_H *=/s/@[^@\n]*@//
/^NEXT_STDDEF_H *=/s/@[^@\n]*@//
/^NEXT_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/
/^NEXT_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/
@ -506,6 +508,7 @@ am__cd = cd
/^SIG_ATOMIC_T_SUFFIX *=/s/@SIG_ATOMIC_T_SUFFIX@//
/^SIZE_T_SUFFIX *=/s/@SIZE_T_SUFFIX@/u/
/^STDBOOL_H *=/s/@[^@\n]*@//
/^STDARG_H *=/s/@[^@\n]*@//
/^STDDEF_H *=/s/@[^@\n]*@//
/^STDINT_H *=/s/@[^@\n]*@/stdint.h/
/^SYS_TIME_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/
@ -514,6 +517,8 @@ am__cd = cd
/^UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS *=/s/@[^@\n]*@/0/
/^WCHAR_T_SUFFIX *=/s/@WCHAR_T_SUFFIX@/h/
/^WINT_T_SUFFIX *=/s/@WINT_T_SUFFIX@//
/am__append_1 *=.*gettext\.h/s/@[^@\n]*@/\#/
/am__append_2 *=.*verify\.h/s/@[^@\n]*@//
/^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o strftime.o time_r.o getloadavg.o md5.o filemode.o/
/^BUILT_SOURCES *=/s/ *inttypes\.h//
/^am_libgnu_a_OBJECTS *=/s/careadlinkat\.\$(OBJEXT)//
@ -554,8 +559,10 @@ s/@echo /@djecho/
# Fix the recipes for header files
s/^@GL_GENERATE_STDBOOL_H_TRUE@/\#/
s/^@GL_GENERATE_STDBOOL_H_FALSE@//
s/^@GL_GENERATE_STDARG_H_TRUE@/\#/
s/^@GL_GENERATE_STDARG_H_FALSE@/\#/
s/^@GL_GENERATE_STDDEF_H_TRUE@/\#/
s/^@GL_GENERATE_STDDEF_H_FALSE@//
s/^@GL_GENERATE_STDDEF_H_FALSE@/\#/
s/^@GL_GENERATE_STDINT_H_TRUE@//
s/^@GL_GENERATE_STDINT_H_FALSE@/\#/
/^arg-nonnull\.h:/,/^[ ][ ]*mv /c\

View file

@ -1,3 +1,13 @@
2011-05-07 Eli Zaretskii <eliz@gnu.org>
* 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.
2011-05-07 Ben Key <bkey76@gmail.com>
* makefile.w32-in: The bootstrap-temacs rule now makes use of

View file

@ -114,6 +114,7 @@ call_process_cleanup (Lisp_Object arg)
Lisp_Object fdpid = Fcdr (arg);
#if defined (MSDOS)
Lisp_Object file;
int fd;
#else
int pid;
#endif
@ -122,9 +123,13 @@ call_process_cleanup (Lisp_Object arg)
#if defined (MSDOS)
/* for MSDOS fdpid is really (fd . tempfile) */
fd = XFASTINT (Fcar (fdpid));
file = Fcdr (fdpid);
emacs_close (XFASTINT (Fcar (fdpid)));
if (strcmp (SDATA (file), NULL_DEVICE) != 0)
/* FD is -1 and FILE is "" when we didn't actually create a
temporary file in call-process. */
if (fd >= 0)
emacs_close (fd);
if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0'))
unlink (SDATA (file));
#else /* not MSDOS */
pid = XFASTINT (Fcdr (fdpid));
@ -199,7 +204,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
Lisp_Object error_file;
Lisp_Object output_file = Qnil;
#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
char *outf, *tempfile;
char *outf, *tempfile = NULL;
int outfilefd;
#endif
int fd_output = -1;
@ -439,22 +444,23 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
new_argv[0] = SDATA (path);
#ifdef MSDOS /* MW, July 1993 */
if ((outf = egetenv ("TMPDIR")))
strcpy (tempfile = alloca (strlen (outf) + 20), outf);
else
{
tempfile = alloca (20);
*tempfile = '\0';
}
dostounix_filename (tempfile);
if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')
strcat (tempfile, "/");
strcat (tempfile, "detmp.XXX");
mktemp (tempfile);
/* If we're redirecting STDOUT to a file, this is already opened. */
/* If we're redirecting STDOUT to a file, that file is already open
on fd_output. */
if (fd_output < 0)
{
if ((outf = egetenv ("TMPDIR")))
strcpy (tempfile = alloca (strlen (outf) + 20), outf);
else
{
tempfile = alloca (20);
*tempfile = '\0';
}
dostounix_filename (tempfile);
if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')
strcat (tempfile, "/");
strcat (tempfile, "detmp.XXX");
mktemp (tempfile);
outfilefd = creat (tempfile, S_IREAD | S_IWRITE);
if (outfilefd < 0) {
emacs_close (filefd);
@ -561,15 +567,21 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
if (fd_error != outfilefd)
emacs_close (fd_error);
fd1 = -1; /* No harm in closing that one! */
/* Since CRLF is converted to LF within `decode_coding', we can
always open a file with binary mode. */
fd[0] = emacs_open (tempfile, O_RDONLY | O_BINARY, 0);
if (fd[0] < 0)
if (tempfile)
{
unlink (tempfile);
emacs_close (filefd);
report_file_error ("Cannot re-open temporary file", Qnil);
/* Since CRLF is converted to LF within `decode_coding', we
can always open a file with binary mode. */
fd[0] = emacs_open (tempfile, O_RDONLY | O_BINARY, 0);
if (fd[0] < 0)
{
unlink (tempfile);
emacs_close (filefd);
report_file_error ("Cannot re-open temporary file",
Fcons (tempfile, Qnil));
}
}
else
fd[0] = -1; /* We are not going to read from tempfile. */
#else /* not MSDOS */
#ifdef WINDOWSNT
pid = child_setup (filefd, fd1, fd_error, (char **) new_argv,
@ -676,7 +688,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
record_unwind_protect (call_process_cleanup,
Fcons (Fcurrent_buffer (),
Fcons (make_number (fd[0]),
build_string (tempfile))));
build_string (tempfile ? tempfile : ""))));
#else
record_unwind_protect (call_process_cleanup,
Fcons (Fcurrent_buffer (),