*** src/builtin.c~0	Wed Aug 31 18:45:12 1994
--- src/builtin.c	Sun Feb 23 15:49:58 1997
***************
*** 21,26 ****
--- 21,28 ----
  
  #include "m4.h"
  
+ #include <sys/wait.h>
+ 
  extern FILE *popen ();
  
  #include "regex.h"
*************** m4_esyscmd (struct obstack *obs, int arg
*** 770,776 ****
--- 772,783 ----
      {
        M4ERROR ((warning_status, errno,
  		"Cannot open pipe to command \"%s\"", ARG (1)));
+ #if 0
+       /* See below, about WEXITSTATUS.  */
        sysval = 0xff << 8;
+ #else
+       sysval = -1;
+ #endif
      }
    else
      {
*************** m4_esyscmd (struct obstack *obs, int arg
*** 783,789 ****
--- 790,802 ----
  static void
  m4_sysval (struct obstack *obs, int argc, token_data **argv)
  {
+ #if 0
+   /* This is WRONG for little-endian architectures!  Should
+      use WEXITSTATUS instead.  */
    shipout_int (obs, (sysval >> 8) & 0xff);
+ #else
+   shipout_int (obs, sysval == -1 ? 127 : WEXITSTATUS (sysval));
+ #endif
  }
  
  /*-------------------------------------------------------------------------.
*** src/m4.c~0	Wed Nov  2 05:14:28 1994
--- src/m4.c	Thu Feb 20 18:54:56 1997
***************
*** 19,25 ****
--- 19,29 ----
  #include "m4.h"
  
  #include <getopt.h>
+ #ifdef HAVE_SYS_SIGNAL_H
  #include <sys/signal.h>
+ #else
+ #include <signal.h>
+ #endif
  
  static void usage _((int));
  
*** src/output.c~0	Fri Sep  2 08:27:40 1994
--- src/output.c	Thu Feb 20 19:42:02 1997
***************
*** 19,24 ****
--- 19,25 ----
  #include "m4.h"
  
  #include <sys/stat.h>
+ #include <fcntl.h>
  
  /* Size of initial in-memory buffer size for diversions.  Small diversions
     would usually fit in.  */
*************** output_init (void)
*** 107,114 ****
  /* This implementation of mkstemp(3) does not avoid any races, but its
     there.  */
  
- #include <fcntl.h>
- 
  static int
  mkstemp (const char *tmpl)
  {
--- 108,113 ----
*************** make_room_for (int length)
*** 192,198 ****
--- 191,210 ----
        /* Create a temporary file, write the in-memory buffer of the
  	 diversion to this file, then release the buffer.  */
  
+ #if defined(O_BINARY) && O_BINARY
+       /* We need to read and write the temporary file in binary mode.
+          Platforms which treat binary and text files differently
+ 	 define O_BINARY macro.  */
+       {
+ 	int save_fmode = _fmode;
+ 
+ 	_fmode = O_BINARY;
+ 	selected_diversion->file = tmpfile ();
+ 	_fmode = save_fmode;
+       }
+ #else
        selected_diversion->file = tmpfile ();
+ #endif
        if (selected_diversion->file == NULL)
  	M4ERROR ((EXIT_FAILURE, errno,
  		  "ERROR: Cannot create temporary file for diversion"));
*** src/path.c~0	Sun Aug 28 02:56:28 1994
--- src/path.c	Thu Feb 20 19:51:16 1997
*************** include_env_init (void)
*** 57,63 ****
--- 57,67 ----
  
    do
      {
+ #ifdef MSDOS
+       path_end = strchr (path, ';');
+ #else
        path_end = strchr (path, ':');
+ #endif
        if (path_end)
  	*path_end = '\0';
        add_include_directory (path);
*************** path_search (const char *dir)
*** 111,116 ****
--- 115,125 ----
    /* If file not found, and filename absolute, fail.  */
    if (*dir == '/' || no_gnu_extensions)
      return NULL;
+ 
+ #ifdef MSDOS
+   if (*dir == '\\' || (*dir && dir[1] == ':'))
+     return NULL;
+ #endif
  
    name = (char *) xmalloc (dir_max_length + 1 + strlen (dir) + 1);
  
*** djgpp/config.b~0	Sun Nov  6 05:44:16 1994
--- djgpp/config.bat	Sun Feb 23 14:03:52 1997
***************
*** 0 ****
--- 1,47 ----
+ @echo off
+ set XSRC=.
+ if not "%1" == "" set XSRC=%1
+ test -d %XSRC%
+ if not errorlevel 1 goto chkdir
+ echo %XSRC% is not a directory
+ goto end
+ :chkdir
+ test -f %XSRC%/configure
+ if not errorlevel 1 goto argsok
+ echo I cannot find the configure script in the directory %XSRC%
+ goto end
+ :argsok
+ rem set SYSROOT=c:
+ set PATH_SEPARATOR=:
+ set PATH_EXPAND=y
+ if not "%HOSTNAME%" == "" goto hostdone
+ if "%windir%" == "" goto msdos
+ set OS=MS-Windows
+ goto haveos
+ :msdos
+ set OS=MS-DOS
+ :haveos
+ if not "%USERNAME%" == "" goto haveuname
+ if not "%USER%" == "" goto haveuser
+ echo No USERNAME and no USER found in the environment, using default values
+ set HOSTNAME=Unknown PC
+ :haveuser
+ set HOSTNAME=%USER%'s PC
+ goto userdone
+ :haveuname
+ set HOSTNAME=%USERNAME%'s PC
+ :userdone
+ set HOSTNAME=%HOSTNAME%, %OS%
+ :hostdone
+ set OS=
+ set CONFIG_SHELL=bash.exe
+ set CONFIG_HEADERS=config.h:config.h-in
+ if not exist configure.orig cp -p %XSRC%/configure ./configure.orig
+ update %XSRC%/djgpp/configure ./configure
+ set CFLAGS=-O2 -g
+ set INSTALL=${DJDIR}/bin/ginstall
+ sh ./configure --prefix='${DJDIR}'
+ set CFLAGS=
+ set INSTALL=
+ set CONFIG_HEADERS=
+ set XSRC=
*** configure.orig	Sun Nov  6 05:44:16 1994
--- djgpp/configure	Sun Feb 23 17:56:22 1997
***************
*** 448,454 ****
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
!     if test -f $ac_dir/$ac_word; then
        ac_cv_prog_AWK="$ac_prog"
        break
      fi
--- 448,454 ----
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
!     if test -x $ac_dir/$ac_word; then
        ac_cv_prog_AWK="$ac_prog"
        break
      fi
***************
*** 478,484 ****
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
!     if test -f $ac_dir/$ac_word; then
        ac_cv_prog_CC="gcc"
        break
      fi
--- 478,484 ----
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
!     if test -x $ac_dir/$ac_word; then
        ac_cv_prog_CC="gcc"
        break
      fi
***************
*** 541,551 ****
  
  ac_aux_dir=
  for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
!   if test -f $ac_dir/install-sh; then
      ac_aux_dir=$ac_dir
      ac_install_sh="$ac_aux_dir/install-sh -c"
      break
!   elif test -f $ac_dir/install.sh; then
      ac_aux_dir=$ac_dir
      ac_install_sh="$ac_aux_dir/install.sh -c"
      break
--- 541,551 ----
  
  ac_aux_dir=
  for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
!   if test -x $ac_dir/install-sh; then
      ac_aux_dir=$ac_dir
      ac_install_sh="$ac_aux_dir/install-sh -c"
      break
!   elif test -x $ac_dir/install.sh; then
      ac_aux_dir=$ac_dir
      ac_install_sh="$ac_aux_dir/install.sh -c"
      break
***************
*** 580,586 ****
      *)
        # OSF1 and SCO ODT 3.0 have their own names for install.
        for ac_prog in ginstall installbsd scoinst install; do
!         if test -f $ac_dir/$ac_prog; then
  	  if test $ac_prog = install &&
              grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  	    # AIX install.  It has an incompatible calling convention.
--- 580,586 ----
      *)
        # OSF1 and SCO ODT 3.0 have their own names for install.
        for ac_prog in ginstall installbsd scoinst install; do
!         if test -x $ac_dir/$ac_prog; then
  	  if test $ac_prog = install &&
              grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  	    # AIX install.  It has an incompatible calling convention.
***************
*** 647,653 ****
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
!     if test -f $ac_dir/$ac_word; then
        ac_cv_prog_RANLIB="ranlib"
        break
      fi
--- 647,653 ----
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
!     if test -x $ac_dir/$ac_word; then
        ac_cv_prog_RANLIB="ranlib"
        break
      fi
***************
*** 1922,1928 ****
  done
  
  ac_given_srcdir=$srcdir
! ac_given_INSTALL="$INSTALL"
  
  trap 'rm -fr Makefile doc/Makefile lib/Makefile src/Makefile \
  checks/Makefile examples/Makefile config.h conftest*; exit 1' 1 2 15
--- 1922,1928 ----
  done
  
  ac_given_srcdir=$srcdir
! ac_given_INSTALL='$INSTALL'
  
  trap 'rm -fr Makefile doc/Makefile lib/Makefile src/Makefile \
  checks/Makefile examples/Makefile config.h conftest*; exit 1' 1 2 15
***************
*** 1955,1960 ****
--- 1955,1961 ----
  s%@ALLOCA@%$ALLOCA%g
  s%@LIBOBJS@%$LIBOBJS%g
  s%@STACKOVF@%$STACKOVF%g
+ s,\.h\.in,.h-in,g
  
  CEOF
  EOF
