*** devps/generate/makefile.~0	Thu Jun 22 10:42:12 1995
--- devps/generate/makefile	Tue Mar  4 14:51:02 1997
***************
*** 181,187 ****
  
  ZD:
  	$(AFMTODIT) -s \
! 	`$(AFMNAME) $(afmdir)/ZapfDingbats.afm` $(srcdir)/dingbatsmap $@
  
  SS: $(srcdir)/symbolsl.afm
  	$(AFMTODIT) -s $(IFLAG) $(srcdir)/symbolsl.afm $(srcdir)/lgreekmap $@
--- 181,187 ----
  
  ZD:
  	$(AFMTODIT) -s \
! 	`$(AFMNAME) $(afmdir)/ZapfDingbats.afm` $(srcdir)/dingbats.map $@
  
  SS: $(srcdir)/symbolsl.afm
  	$(AFMTODIT) -s $(IFLAG) $(srcdir)/symbolsl.afm $(srcdir)/lgreekmap $@
***************
*** 190,196 ****
  	$(AFMTODIT) -s symbol.afm symbolmap $@
  
  ZDR: zapfdr.afm
! 	$(AFMTODIT) -s zapfdr.afm $(srcdir)/dingbatsrmap $@
  
  symbol.afm: $(srcdir)/symbol.sed
  	-rm -f $@
--- 190,196 ----
  	$(AFMTODIT) -s symbol.afm symbolmap $@
  
  ZDR: zapfdr.afm
! 	$(AFMTODIT) -s zapfdr.afm $(srcdir)/dingbats.rmap $@
  
  symbol.afm: $(srcdir)/symbol.sed
  	-rm -f $@
***************
*** 201,208 ****
  	sed -e '/^FontName /s/ZapfDingbats/ZapfDingbats-Reverse/' \
  	  `$(AFMNAME) $(afmdir)/ZapfDingbats.afm` >$@
  
! ZD: $(srcdir)/dingbatsmap
! ZDR: $(srcdir)/dingbatsrmap
  $(TEXTFONTS): $(TEXTMAP) $(TEXTENC)
  $(SPECIALFONTS): symbolmap
  $(GREEKFONTS): $(srcdir)/lgreekmap
--- 201,208 ----
  	sed -e '/^FontName /s/ZapfDingbats/ZapfDingbats-Reverse/' \
  	  `$(AFMNAME) $(afmdir)/ZapfDingbats.afm` >$@
  
! ZD: $(srcdir)/dingbats.map
! ZDR: $(srcdir)/dingbats.rmap
  $(TEXTFONTS): $(TEXTMAP) $(TEXTENC)
  $(SPECIALFONTS): symbolmap
  $(GREEKFONTS): $(srcdir)/lgreekmap
*** devps/makefile.s~0	Thu Jan  7 00:08:24 1993
--- devps/makefile.sub	Tue Mar  4 14:48:56 1997
***************
*** 4,11 ****
  	CB CBI CI CR HB HBI HI HR HNB HNBI HNI HNR \
  	NB NBI NI NR PB PBI PI PR TB TBI TI TR ZCMI
  PSFILES=prologue symbolsl.pfa zapfdr.pfa
! DEVGENFILES=generate/Makefile generate/afmname generate/dingbatsmap \
!   generate/dingbatsrmap generate/lgreekmap generate/symbol.sed \
    generate/symbolchars generate/symbolsl.afm generate/textmap
  DEVFILES=DESC $(PSFILES) $(DISTFILES) $(DEVGENFILES)
  
--- 4,11 ----
  	CB CBI CI CR HB HBI HI HR HNB HNBI HNI HNR \
  	NB NBI NI NR PB PBI PI PR TB TBI TI TR ZCMI
  PSFILES=prologue symbolsl.pfa zapfdr.pfa
! DEVGENFILES=generate/Makefile generate/afmname generate/dingbats.map \
!   generate/dingbats.rmap generate/lgreekmap generate/symbol.sed \
    generate/symbolchars generate/symbolsl.afm generate/textmap
  DEVFILES=DESC $(PSFILES) $(DISTFILES) $(DEVGENFILES)
  
*** eqn/lex.c~0	Thu Jun 22 10:41:56 1995
--- eqn/lex.cc	Sun Mar  2 13:53:02 1997
*************** with groff; see the file COPYING.  If no
*** 19,25 ****
--- 19,29 ----
  Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  
  #include "eqn.h"
+ #ifdef __MSDOS__
+ #include "eqn_tab.h"
+ #else
  #include "eqn.tab.h"
+ #endif
  #include "stringclass.h"
  #include "ptable.h"
  
*** eqn/list.c~0	Thu Jun 22 10:41:56 1995
--- eqn/list.cc	Tue Mar  4 14:44:58 1997
*************** int list_box::compute_metrics(int style)
*** 159,165 ****
      have_simple = list.p[i]->is_simple();
    if (have_simple) {
      printf(".nr " WIDTH_FORMAT " +\\w" DELIMITER_CHAR, uid);
!     for (int i = 0; i < list.len; i++)
        if (list.p[i]->is_simple())
  	list.p[i]->output();
      printf(DELIMITER_CHAR "\n");
--- 159,165 ----
      have_simple = list.p[i]->is_simple();
    if (have_simple) {
      printf(".nr " WIDTH_FORMAT " +\\w" DELIMITER_CHAR, uid);
!     for (i = 0; i < list.len; i++)
        if (list.p[i]->is_simple())
  	list.p[i]->output();
      printf(DELIMITER_CHAR "\n");
*************** void list_box::compute_sublist_width(int
*** 187,193 ****
      have_simple = list.p[i]->is_simple();
    if (have_simple) {
      printf("+\\w" DELIMITER_CHAR);
!     for (int i = 0; i < n; i++)
        if (list.p[i]->is_simple())
  	list.p[i]->output();
      printf(DELIMITER_CHAR);
--- 187,193 ----
      have_simple = list.p[i]->is_simple();
    if (have_simple) {
      printf("+\\w" DELIMITER_CHAR);
!     for (i = 0; i < n; i++)
        if (list.p[i]->is_simple())
  	list.p[i]->output();
      printf(DELIMITER_CHAR);
*** grodvi/dvi.c~0	Thu Jun 22 10:42:00 1995
--- grodvi/dvi.cc	Tue Mar  4 16:37:34 1997
*************** You should have received a copy of the G
*** 18,23 ****
--- 18,28 ----
  with groff; see the file COPYING.  If not, write to the Free Software
  Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  
+ #ifdef __MSDOS__
+ #include <fcntl.h>
+ #include <io.h>
+ #endif
+ 
  #include "driver.h"
  
  #define DEFAULT_LINEWIDTH 40
*************** int main(int argc, char **argv)
*** 878,883 ****
--- 883,894 ----
      default:
        assert(0);
      }
+ #ifdef __MSDOS__
+   // It is safer to output in binary, since arbitrary codes
+   // might be sent to the output file.
+   if (!isatty(fileno(stdout)))
+     setmode(fileno(stdout), O_BINARY);
+ #endif
    if (optind >= argc)
      do_file("-");
    else {
*** groff/groff.c~0	Thu Jun 22 11:08:00 1995
--- groff/groff.cc	Wed Mar  5 17:13:38 1997
*************** Foundation, 59 Temple Place - Suite 330,
*** 37,45 ****
--- 37,58 ----
  #include "pipeline.h"
  #include "defs.h"
  
+ #ifdef __MSDOS__
+ /* MSDOS doesn't have standard directory where `sh' is kept, let it
+    be found along the $PATH.  */
+ #define BSHELL "sh"
+ #else
  #define BSHELL "/bin/sh"
+ #endif
  #define GXDITVIEW "gxditview"
  
+ /* Don't assume directories in $PATH are always separated by `:'.  */
+ #ifdef __MSDOS__
+ #define PATH_SEP ';'
+ #else
+ #define PATH_SEP ':'
+ #endif
+ 
  // troff will be passed an argument of -rXREG=1 if the -X option is
  // specified
  #define XREG ".X"
*************** int main(int argc, char **argv)
*** 185,191 ****
      case 'F':
        font::command_line_font_dir(optarg);
        if (Fargs.length() > 0) {
! 	Fargs += ':';
  	Fargs += optarg;
        }
        else
--- 198,204 ----
      case 'F':
        font::command_line_font_dir(optarg);
        if (Fargs.length() > 0) {
! 	Fargs += PATH_SEP;
  	Fargs += optarg;
        }
        else
*************** int main(int argc, char **argv)
*** 302,308 ****
      e += Fargs;
      char *fontpath = getenv("GROFF_FONT_PATH");
      if (fontpath && *fontpath) {
!       e += ':';
        e += fontpath;
      }
      e += '\0';
--- 315,321 ----
      e += Fargs;
      char *fontpath = getenv("GROFF_FONT_PATH");
      if (fontpath && *fontpath) {
!       e += PATH_SEP;
        e += fontpath;
      }
      e += '\0';
*************** const char *xbasename(const char *s)
*** 321,326 ****
--- 334,345 ----
    if (!s)
      return 0;
    const char *p = strrchr(s, '/');
+ #ifdef __MSDOS__
+   if (!p)
+     p = strrchr(s, '\\');
+   if (!p && s[0] && s[1] == ':')
+     p = s + 1;
+ #endif
    return p ? p + 1 : s;
  }
  
*** groff/pipeline.c~0	Thu Jun 22 11:09:48 1995
--- groff/pipeline.c	Wed Mar  5 17:18:34 1997
*************** static void sys_fatal P((const char *));
*** 97,102 ****
--- 97,104 ----
  static const char *xstrsignal P((int));
  static char *itoa P((int));
  
+ #ifndef __MSDOS__
+ 
  int run_pipeline(ncommands, commands)
       int ncommands;
       char ***commands;
*************** int run_pipeline(ncommands, commands)
*** 209,214 ****
--- 211,318 ----
    }
    return ret;
  }
+ 
+ #else  /* __MSDOS__ */
+ 
+ #include <process.h>
+ #include <fcntl.h>
+ 
+ /* A signal handler that just records a signal has happened.  */
+ static int child_interrupted;
+ 
+ static RETSIGTYPE signal_catcher (int signo)
+ {
+   child_interrupted++;
+ }
+ 
+ /* MSDOS doesn't have `fork', so we need to simulate the pipe by
+    running the programs in sequence with redirected standard streams.  */
+ 
+ int run_pipeline (ncommands, commands)
+      int ncommands;
+      char ***commands;
+ {
+   int save_stdin = dup(0);
+   int save_stdout = dup(1);
+   char *tmpfiles[2];
+   char tem1[L_tmpnam], tem2[L_tmpnam];
+   int infile  = 0;
+   int outfile = 1;
+   int i, f, ret = 0;
+ 
+   tmpfiles[0] = tmpnam(tem1);
+   tmpfiles[1] = tmpnam(tem2);
+ 
+   for (i = 0; i < ncommands; i++)
+     {
+       int exit_status;
+       RETSIGTYPE (*prev_handler)(int);
+ 
+       if (i)
+ 	{
+ 	  /* redirect stdin from temp file */
+ 	  f = open(tmpfiles[infile], O_RDONLY|O_BINARY, 0666);
+ 	  if (f < 0)
+ 	    sys_fatal("open stdin");
+ 	  if (dup2(f, 0) < 0)
+ 	    sys_fatal("dup2 stdin"); 
+ 	  if (close(f) < 0)
+ 	    sys_fatal("close stdin");
+ 	}
+       if (i < ncommands - 1)
+ 	{
+ 	  /* redirect stdout to temp file */
+ 	  f = open(tmpfiles[outfile], O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
+ 	  if (f < 0)
+ 	    sys_fatal("open stdout");
+ 	  if (dup2(f, 1) < 0)
+ 	    sys_fatal("dup2 stdout");
+ 	  if (close(f) < 0)
+ 	    sys_fatal("close stdout");
+ 	}
+       else if (dup2(save_stdout, 1) < 0)
+ 	sys_fatal("restore stdout");
+ 
+       /* run the program */
+       child_interrupted = 0;
+       prev_handler = signal(SIGINT, signal_catcher);
+       exit_status = spawnvp(P_WAIT, commands[i][0], commands[i]);
+       signal(SIGINT, prev_handler);
+       if (child_interrupted)
+ 	{
+ 	  error("%1: Interrupted", commands[i][0], (char *)0, (char *)0);
+ 	  ret |= 2;
+ 	}
+       else if (exit_status < 0)
+ 	{
+ 	  error("couldn't exec %1: %2", commands[i][0],
+ 		strerror(errno), (char *)0);
+ 	  fflush(stderr);		/* just in case error() doesn't */
+ 	  ret |= 4;
+ 	}
+       if (exit_status != 0)
+ 	ret |= 1;
+ 
+       /* There's no sense to continue with the pipe if one of the
+ 	 programs has ended abnormally, is there?  */
+       if (ret != 0)
+ 	break;
+ 
+       /* swap temp files: make output of this program be input for the next */
+       infile = 1 - infile;
+       outfile = 1 - outfile;
+     }
+ 
+   if (dup2(save_stdin, 0) < 0)
+     sys_fatal("restore stdin");
+ 
+   unlink(tmpfiles[0]);
+   unlink(tmpfiles[1]);
+ 
+   return ret;
+ }
+ 
+ #endif /* __MSDOS__ */
  
  static void sys_fatal(s)
       const char *s;
*** grog/makefile.s~0	Mon Apr 19 11:47:10 1993
--- grog/makefile.sub	Wed Mar  5 15:29:12 1997
*************** grog: grog.pl grog.sh
*** 9,15 ****
  	  sed -e 's;/usr/bin/perl;$(PERLPATH);' $(srcdir)/grog.pl >$@; \
  	else \
  	  rm -f $@; \
! 	  sed "$(SH_SCRIPT_SED_CMD)" $(srcdir)/grog.sh >$@; \
  	fi
  	chmod +x $@
  
--- 9,15 ----
  	  sed -e 's;/usr/bin/perl;$(PERLPATH);' $(srcdir)/grog.pl >$@; \
  	else \
  	  rm -f $@; \
! 	  sed -e "$(SH_SCRIPT_SED_CMD)" -e 's/@g@/${g}/g' $(srcdir)/grog.sh >$@; \
  	fi
  	chmod +x $@
  
*** grog/grog.s~0	Sun Oct  1 09:45:30 1995
--- grog/grog.sh	Wed Mar  5 15:24:10 1997
***************
*** 2,8 ****
  # grog -- guess options for groff command
  # Like doctype in Kernighan & Pike, Unix Programming Environment, pp 306-8.
  
! soelim=gsoelim
  
  opts=
  
--- 2,8 ----
  # grog -- guess options for groff command
  # Like doctype in Kernighan & Pike, Unix Programming Environment, pp 306-8.
  
! soelim=@g@soelim
  
  opts=
  
*** grolj4/lj4.c~0	Thu Jun 22 10:42:02 1995
--- grolj4/lj4.cc	Tue Mar  4 16:32:52 1997
*************** X command to include bitmap graphics
*** 36,41 ****
--- 36,46 ----
  
  #include "driver.h"
  
+ #ifdef __MSDOS__
+ #include <fcntl.h>
+ #include <io.h>
+ #endif
+ 
  static struct {
    const char *name;
    int code;
*************** int main(int argc, char **argv)
*** 656,661 ****
--- 661,672 ----
      default:
        assert(0);
      }
+ #ifdef __MSDOS__
+   // It is safer to output in binary, since arbitrary codes
+   // might be sent in PCL mode.
+   if (!isatty(fileno(stdout)))
+     setmode(fileno(stdout), O_BINARY);
+ #endif
    if (optind >= argc)
      do_file("-");
    else {
*** grops/ps.c~0	Tue Jun 27 18:04:56 1995
--- grops/ps.cc	Tue Mar  4 16:37:48 1997
*************** Foundation, 59 Temple Place - Suite 330,
*** 25,30 ****
--- 25,35 ----
  #include "ps.h"
  #include <time.h>
  
+ #ifdef __MSDOS__
+ #include <fcntl.h>
+ #include <io.h>
+ #endif
+ 
  static int landscape_flag = 0;
  static int manual_feed_flag = 0;
  static int ncopies = 1;
*************** int main(int argc, char **argv)
*** 1514,1519 ****
--- 1519,1530 ----
        assert(0);
      }
    font::set_unknown_desc_command_handler(handle_unknown_desc_command);
+ #ifdef __MSDOS__
+   // It is safer to output in binary, since arbitrary codes
+   // might be sent in PS mode.
+   if (!isatty(fileno(stdout)))
+     setmode(fileno(stdout), O_BINARY);
+ #endif
    if (optind >= argc)
      do_file("-");
    else {
*** grops/psrm.c~0	Thu Jun 22 10:42:00 1995
--- grops/psrm.cc	Tue Mar  4 14:21:10 1997
*************** void resource_manager::process_file(int 
*** 962,969 ****
  	      had_language_level_comment = 1;
  	    }
  	    else {
! 	      for (int i = 0; i < NHEADER_COMMENTS; i++)
! 		if (matches_comment(buf, header_comment_table[i])) {
  		  interesting = 1;
  		  break;
  		}
--- 962,969 ----
  	      had_language_level_comment = 1;
  	    }
  	    else {
! 	      for (int j = 0; j < NHEADER_COMMENTS; j++)
! 		if (matches_comment(buf, header_comment_table[j])) {
  		  interesting = 1;
  		  break;
  		}
*** hpftodit/hpftodit.c~0	Tue Jun 27 15:59:38 1995
--- hpftodit/hpftodit.cc	Wed Mar  5 17:24:56 1997
*************** void usage()
*** 273,279 ****
  
  File::File(const char *s)
  {
!   int fd = open(s, O_RDONLY);
    if (fd < 0)
      fatal("cannot open `%1': %2", s, strerror(errno));
    current_filename = s;
--- 273,279 ----
  
  File::File(const char *s)
  {
!   int fd = open(s, O_RDONLY | O_BINARY);
    if (fd < 0)
      fatal("cannot open `%1': %2", s, strerror(errno));
    current_filename = s;
*************** File::File(const char *s)
*** 290,295 ****
--- 290,312 ----
      fatal("read unexpected number of bytes");
    ptr_ = buf_;
    end_ = buf_ + sb.st_size;
+ #ifdef __MSDOS__
+   // These are actually text files, so we must get rid of
+   // the `\r' characters and stop at the first ^Z.
+   unsigned char *p = buf_, *q = buf_;
+   while (q < end_)
+     {
+       if (*q == '\r')
+ 	{
+ 	  if (*++q != '\n')
+ 	    *p++ = '\r';
+ 	}
+       if (*q == '\032')	// ^Z means ``software EOF''
+ 	break;
+       *p++ = *q++;
+     }
+   end_ = p;
+ #endif
  }
  
  void File::skip(int n)
*************** static
*** 775,779 ****
--- 792,802 ----
  const char *xbasename(const char *s)
  {
    const char *b = strrchr(s, '/');
+ #ifdef __MSDOS__
+   if (!b)
+     b = strrchr(s, '\\');
+   if (!b && s[0] && s[1] == ':')
+     b = s + 1;
+ #endif
    return b ? b + 1 : s;
  }
*** include/lib.h~0	Thu Jun 22 10:41:28 1995
--- include/lib.h	Sun Mar  2 15:35:00 1997
***************
*** 18,23 ****
--- 18,29 ----
  with groff; see the file COPYING.  If not, write to the Free Software
  Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  
+ #ifdef __GO32__
+ /* DJGPP has itoa, but it takes 3 parameters rather than 1,
+    so its prototype in stdlib.h conflicts with the one below.  */
+ #define itoa(x) groffs_itoa(x)
+ #endif
+ 
  extern "C" {
  #ifndef strerror
    char *strerror(int);
*** include/posix.h~0	Thu Jun 22 10:41:30 1995
--- include/posix.h	Sun Mar  2 18:15:12 1997
***************
*** 28,33 ****
--- 28,37 ----
  #include <unistd.h>
  #endif
  
+ #ifdef __DJGPP__
+ #include <fcntl.h>
+ #endif
+ 
  #ifndef S_IRUSR
  #define S_IRUSR 0400
  #endif
***************
*** 46,49 ****
--- 50,57 ----
  
  #ifndef O_RDONLY
  #define O_RDONLY 0
+ #endif
+ 
+ #ifndef O_BINARY
+ #define O_BINARY 0
  #endif
*** indxbib/dirnamemax.c~0	Sat Sep  5 20:11:46 1992
--- indxbib/dirnamemax.c	Tue Mar  4 14:14:44 1997
***************
*** 6,11 ****
--- 6,28 ----
  #include <unistd.h>
  #endif /* HAVE_UNISTD_H */
  
+ #ifdef __DJGPP__
+ #include <stdio.h>
+ #include <fcntl.h>
+ 
+ /* Need to test at run time whether arbitrary long filenames
+    are supported.  We don't want to limit users of Windows 9x
+    to the DOS restricted 8+3 namespace!  */
+ long dir_name_max(dir)
+      char *dir;
+ {
+   if (_use_lfn (dir))
+     return FILENAME_MAX;
+   return pathconf(dir, _PC_NAME_MAX);
+ }
+ 
+ #else /* not __DJGPP__ */
+ 
  #ifdef _POSIX_VERSION
  
  long dir_name_max(dir)
*************** long dir_name_max(dir)
*** 47,49 ****
--- 64,68 ----
  }
  
  #endif /* not _POSIX_VERSION */
+ 
+ #endif /* not __DJGPP__ */
*** indxbib/indxbib.c~0	Thu Jun 22 10:42:08 1995
--- indxbib/indxbib.cc	Thu Mar 13 18:11:46 1997
*************** extern "C" {
*** 41,47 ****
--- 41,52 ----
  }
  
  #define DEFAULT_HASH_TABLE_SIZE 997
+ #ifdef __MSDOS__
+ /* The darn 8+3 limits...  */
+ #define TEMP_INDEX_TEMPLATE "ibXXXXXX"
+ #else
  #define TEMP_INDEX_TEMPLATE "indxbibXXXXXX"
+ #endif
  
  // (2^n - MALLOC_OVERHEAD) should be a good argument for malloc().
  
*************** int main(int argc, char **argv)
*** 126,131 ****
--- 131,143 ----
    parser_t parser = do_file;
    const char *directory = 0;
    const char *foption = 0;
+ #ifdef __MSDOS__
+   // MSDOS systems don't have their own common words file, but they
+   // should be given leeway as to where the Groff-supplied file is kept.
+   const char *eignfn = getenv ("GROFF_EIGN");
+   if (eignfn)
+     common_words_file = strsave (eignfn);
+ #endif
    int opt;
    while ((opt = getopt(argc, argv, "c:o:h:i:k:l:t:n:c:d:f:vw")) != EOF)
      switch (opt) {
*************** int main(int argc, char **argv)
*** 198,203 ****
--- 210,224 ----
    if (!basename)
      basename = optind < argc ? argv[optind] : DEFAULT_INDEX_NAME;
    const char *p = strrchr(basename, '/');
+ #ifdef __MSDOS__
+   /* On MSDOS we can have backslashes instead of slashes, or even a
+      mixed case, plus a drive letter.  Find the rightmost of all these.  */
+   const char *bslash = strrchr(basename, '\\');
+   if (!p || (bslash && p < bslash))
+     p = bslash;
+   if (!p && basename[0] && basename[1] == ':')
+     p = basename + 1;
+ #endif
    long name_max;
    if (p) {
      char *dir = strsave(basename);
*************** int main(int argc, char **argv)
*** 225,231 ****
    int fd = creat(temp_index_file, S_IRUSR|S_IRGRP|S_IROTH);
    if (fd < 0)
      fatal("can't create temporary index file: %1", strerror(errno));
!   indxfp = fdopen(fd, "w");
    if (indxfp == 0)
      fatal("fdopen failed");
    if (fseek(indxfp, sizeof(index_header), 0) < 0)
--- 246,252 ----
    int fd = creat(temp_index_file, S_IRUSR|S_IRGRP|S_IROTH);
    if (fd < 0)
      fatal("can't create temporary index file: %1", strerror(errno));
!   indxfp = fdopen(fd, "wb");	// need binary output for MSDOS
    if (indxfp == 0)
      fatal("fdopen failed");
    if (fseek(indxfp, sizeof(index_header), 0) < 0)
*************** int main(int argc, char **argv)
*** 274,280 ****
--- 295,318 ----
    strcat(index_file, INDEX_SUFFIX);
  #ifdef HAVE_RENAME
    if (rename(temp_index_file, index_file) < 0)
+ #ifdef __MSDOS__
+     /* RENAME could fail because INDEX_FILE is an illegal
+        filename, e.g. it has multiple dots on plain MSDOS.  */
+     {
+       char *fname = p ? index_file + (p - basename) : 0;
+       char *dot = 0;
+ 
+       /* Replace `.' with a `_' and try again.  */
+       if (fname
+ 	  && (dot = strchr(fname, '.')) != 0
+ 	  && strcmp(dot, INDEX_SUFFIX) != 0)
+ 	*dot = '_';
+       if (rename(temp_index_file, index_file) < 0)
+ 	fatal("can't rename temporary index file: %1", strerror(errno));
+     }
+ #else /* not __MSDOS__ */
      fatal("can't rename temporary index file: %1", strerror(errno));
+ #endif /* not __MSDOS__ */
  #else /* not HAVE_RENAME */
    ignore_fatal_signals();
    if (unlink(index_file) < 0) {
*************** static int do_whole_file(const char *fil
*** 422,428 ****
  static int do_file(const char *filename)
  {
    errno = 0;
!   FILE *fp = fopen(filename, "r");
    if (fp == 0) {
      error("can't open `%1': %2", filename, strerror(errno));
      return 0;
--- 460,468 ----
  static int do_file(const char *filename)
  {
    errno = 0;
!   // Need binary I/O for MS-DOS, because indxbib relies on
!   // byte counts to be consistent with fseek.
!   FILE *fp = fopen(filename, "rb");
    if (fp == 0) {
      error("can't open `%1': %2", filename, strerror(errno));
      return 0;
*************** static int do_file(const char *filename)
*** 452,457 ****
--- 492,512 ----
      int c = getc(fp);
      if (c == EOF)
        break;
+ #ifdef __MSDOS__
+     // We opened the file in binary mode, so we need to skip
+     // every CR character before a Newline.
+     if (c == '\r') {
+       int peek = getc(fp);
+       if (peek = '\n') {
+ 	byte_count++;
+ 	c = peek;
+       }
+       else
+ 	ungetc(peek, fp);
+     }
+     else if (c == 0x1a)		// ^Z means EOF
+       break;
+ #endif
      byte_count++;
      switch (state) {
      case START:
*** libbib/index.c~0	Thu Jun 22 10:41:40 1995
--- libbib/index.cc	Thu Mar 13 14:38:00 1997
*************** search_item *make_index_search_item(cons
*** 274,280 ****
    char *index_filename = new char[strlen(filename) + sizeof(INDEX_SUFFIX)];
    strcpy(index_filename, filename);
    strcat(index_filename, INDEX_SUFFIX);
!   int fd = open(index_filename, O_RDONLY);
    if (fd < 0)
      return 0;
    index_search_item *item = new index_search_item(index_filename, fid);
--- 274,280 ----
    char *index_filename = new char[strlen(filename) + sizeof(INDEX_SUFFIX)];
    strcpy(index_filename, filename);
    strcat(index_filename, INDEX_SUFFIX);
!   int fd = open(index_filename, O_RDONLY | O_BINARY);
    if (fd < 0)
      return 0;
    index_search_item *item = new index_search_item(index_filename, fid);
*************** const char *index_search_item::munge_fil
*** 425,432 ****
--- 425,441 ----
  {
    if (filename[0] == '/')
      return filename;
+ #ifdef __MSDOS__
+   if (filename[0] == '\\' || (filename[0] && filename[1] == ':'))
+     return filename;
+ #endif
    const char *cwd = pool;
    int need_slash = (cwd[0] != 0 && strchr(cwd, '\0')[-1] != '/');
+ #ifdef __MSDOS__
+   if (need_slash
+       && cwd[0] != 0 && strchr(cwd, '\0')[-1] == '\\')
+     need_slash = 0;
+ #endif
    int len = strlen(cwd) + strlen(filename) + need_slash + 1;
    if (len > filename_buflen) {
      a_delete filename_buffer;
*** libgroff/errarg.c~0	Thu Jun 22 10:41:32 1995
--- libgroff/errarg.cc	Thu Mar  6 14:22:24 1997
*************** Foundation, 59 Temple Place - Suite 330,
*** 21,26 ****
--- 21,27 ----
  #include <stdio.h>
  #include "assert.h"
  #include "errarg.h"
+ #include "lib.h"
  
  errarg::errarg(const char *p) : type(STRING)
  {
*** libgroff/font.c~0	Thu Jun 22 10:41:34 1995
--- libgroff/font.cc	Tue Mar  4 11:51:26 1997
*************** int font::load_desc()
*** 767,773 ****
  	return 0;
        }
        font_name_table = (const char **)new char *[nfonts+1]; 
!       for (int i = 0; i < nfonts; i++) {
  	p = strtok(0, WS);
  	while (p == 0) {
  	  if (!t.next()) {
--- 767,773 ----
  	return 0;
        }
        font_name_table = (const char **)new char *[nfonts+1]; 
!       for (int j = 0; j < nfonts; j++) {
  	p = strtok(0, WS);
  	while (p == 0) {
  	  if (!t.next()) {
*************** int font::load_desc()
*** 778,784 ****
  	}
  	char *temp = new char[strlen(p)+1];
  	strcpy(temp, p);
! 	font_name_table[i] = temp;
        }
        p = strtok(0, WS);
        if (p != 0) {
--- 778,784 ----
  	}
  	char *temp = new char[strlen(p)+1];
  	strcpy(temp, p);
! 	font_name_table[j] = temp;
        }
        p = strtok(0, WS);
        if (p != 0) {
*** libgroff/itoa.c~0	Thu Jun 22 10:41:36 1995
--- libgroff/itoa.c	Sun Mar  2 15:38:32 1997
*************** Foundation, 59 Temple Place - Suite 330,
*** 19,24 ****
--- 19,29 ----
  
  #define INT_DIGITS 19		/* enough for 64 bit integer */
  
+ #ifdef __GO32__
+ /* DJGPP's `itoa' has a different parameter list.  */
+ #define itoa groffs_itoa
+ #endif
+ 
  char *itoa(i)
       int i;
  {
*** libgroff/searchpath.c~0	Thu Jun 22 10:41:38 1995
--- libgroff/searchpath.cc	Tue Mar  4 11:35:42 1997
*************** Foundation, 59 Temple Place - Suite 330,
*** 26,38 ****
  #include "lib.h"
  #include "searchpath.h"
  
  search_path::search_path(const char *envvar, const char *standard)
  {
    char *e = envvar ? getenv(envvar) : 0;
    if (e && standard) {
      dirs = new char[strlen(e) + strlen(standard) + 2];
      strcpy(dirs, e);
!     strcat(dirs, ":");
      strcat(dirs, standard);
    }
    else
--- 26,47 ----
  #include "lib.h"
  #include "searchpath.h"
  
+ #ifdef __MSDOS__
+ /* Directories in $PATH are separated by `;' on MSDOS.  */
+ #define PATH_SEP_S ";"
+ #define PATH_SEP_C ';'
+ #else
+ #define PATH_SEP_S ":"
+ #define PATH_SEP_C ':'
+ #endif
+ 
  search_path::search_path(const char *envvar, const char *standard)
  {
    char *e = envvar ? getenv(envvar) : 0;
    if (e && standard) {
      dirs = new char[strlen(e) + strlen(standard) + 2];
      strcpy(dirs, e);
!     strcat(dirs, PATH_SEP_S);
      strcat(dirs, standard);
    }
    else
*************** void search_path::command_line_dir(const
*** 59,69 ****
      char *p = dirs;
      p += old_len - init_len;
      if (init_len == 0)
!       *p++ = ':';
      memcpy(p, s, slen);
      p += slen;
      if (init_len > 0) {
!       *p++ = ':';
        memcpy(p, old + old_len - init_len, init_len);
        p += init_len;
      }
--- 68,78 ----
      char *p = dirs;
      p += old_len - init_len;
      if (init_len == 0)
!       *p++ = PATH_SEP_C;
      memcpy(p, s, slen);
      p += slen;
      if (init_len > 0) {
!       *p++ = PATH_SEP_C;
        memcpy(p, old + old_len - init_len, init_len);
        p += init_len;
      }
*************** void search_path::command_line_dir(const
*** 75,81 ****
  FILE *search_path::open_file(const char *name, char **pathp)
  {
    assert(name != 0);
!   if (*name == '/' || dirs == 0 || *dirs == '\0') {
      FILE *fp = fopen(name, "r");
      if (fp) {
        if (pathp)
--- 84,95 ----
  FILE *search_path::open_file(const char *name, char **pathp)
  {
    assert(name != 0);
!   if (*name == '/'
! #ifdef __MSDOS__
!       /* MSDOS pathnames can include a drive letter, like in "d:file".  */
!       || *name == '\\' || (*name && name[1] == ':')
! #endif
!       || dirs == 0 || *dirs == '\0') {
      FILE *fp = fopen(name, "r");
      if (fp) {
        if (pathp)
*************** FILE *search_path::open_file(const char 
*** 88,97 ****
    unsigned namelen = strlen(name);
    char *p = dirs;
    for (;;) {
!     char *end = strchr(p, ':');
      if (!end)
        end = strchr(p, '\0');
      int need_slash = end > p && end[-1] != '/';
      char *path = new char[(end - p) + need_slash + namelen + 1];
      memcpy(path, p, end - p);
      if (need_slash)
--- 102,115 ----
    unsigned namelen = strlen(name);
    char *p = dirs;
    for (;;) {
!     char *end = strchr(p, PATH_SEP_C);
      if (!end)
        end = strchr(p, '\0');
+ #ifdef __MSDOS__
+     int need_slash = end > p && end[-1] != '/' && end[-1] != '\\';
+ #else
      int need_slash = end > p && end[-1] != '/';
+ #endif
      char *path = new char[(end - p) + need_slash + namelen + 1];
      memcpy(path, p, end - p);
      if (need_slash)
*** libgroff/tmpfile.c~0	Thu Jun 22 10:41:38 1995
--- libgroff/tmpfile.cc	Mon Mar  3 17:03:42 1997
*************** extern "C" {
*** 38,47 ****
--- 38,55 ----
  #define GROFF_TMPDIR_ENVVAR "GROFF_TMPDIR"
  // otherwise if this is set, create temporary files there
  #define TMPDIR_ENVVAR "TMPDIR"
+ #ifdef __MSDOS__
+ // otherwise create temporary files here.
+ // (cannot assume there is "/tmp" on every drive on MSDOS)
+ #define DEFAULT_TMPDIR "c:"
+ // Use this as the prefix for temporary filenames.
+ #define TMPFILE_PREFIX  "gf"
+ #else
  // otherwise create temporary files here.
  #define DEFAULT_TMPDIR "/tmp"
  // Use this as the prefix for temporary filenames.
  #define TMPFILE_PREFIX  "groff"
+ #endif
  
  // Open a temporary file with fatal error on failure.
  
*************** FILE *xtmpfile()
*** 56,61 ****
--- 64,79 ----
    
    const char *p = strrchr(dir, '/');
    int needs_slash = (!p || p[1]);
+ #ifdef __MSDOS__
+   if (needs_slash)
+     {
+       const char *bslash = strrchr(dir, '\\');
+       if (!p || bslash > p)
+ 	p = bslash;
+       if (p && !p[1])
+ 	needs_slash = 0;
+     }
+ #endif
    char *templ = new char[strlen(dir) + needs_slash
  			    + sizeof(TMPFILE_PREFIX) - 1 + 6 + 1];
    strcpy(templ, dir);
*************** FILE *xtmpfile()
*** 70,83 ****
    if (fd < 0)
      fatal("cannot create temporary file: %1", strerror(errno));
    errno = 0;
!   FILE *fp = fdopen(fd, "w+");
    if (!fp)
      fatal("fdopen: %1", strerror(errno));
  #else /* not HAVE_MKSTEMP */
    if (!mktemp(templ) || !templ[0])
      fatal("cannot create file name for temporary file");
    errno = 0;
!   FILE *fp = fopen(templ, "w+");
    if (!fp)
      fatal("cannot open `%1': %2", templ, strerror(errno));
  #endif /* not HAVE_MKSTEMP */
--- 88,101 ----
    if (fd < 0)
      fatal("cannot create temporary file: %1", strerror(errno));
    errno = 0;
!   FILE *fp = fdopen(fd, "wb+");	// users of `xtmpfile' seem to need binary I/O
    if (!fp)
      fatal("fdopen: %1", strerror(errno));
  #else /* not HAVE_MKSTEMP */
    if (!mktemp(templ) || !templ[0])
      fatal("cannot create file name for temporary file");
    errno = 0;
!   FILE *fp = fopen(templ, "wb+");
    if (!fp)
      fatal("cannot open `%1': %2", templ, strerror(errno));
  #endif /* not HAVE_MKSTEMP */
*** makefile.c~0	Tue Jun 27 14:08:26 1995
--- makefile.com	Tue Mar  4 13:58:40 1997
*************** extraclean:
*** 107,132 ****
  .man.n:
  	@echo Making $@ from $<
  	@-rm -f $@
! 	@sed -e "s;@FONTDIR@;$(fontdir);g" \
! 	-e "s;@FONTPATH@;$(fontpath);g" \
! 	-e "s;@MACRODIR@;$(tmacdir);g" \
! 	-e "s;@MACROPATH@;$(tmacpath);g" \
! 	-e "s;@DEVICE@;$(DEVICE);g" \
! 	-e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
! 	-e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
! 	-e "s;@INDEX_SUFFIX@;$(indexext);g" \
! 	-e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
! 	-e "s;@MAN1EXT@;$(man1ext);g" \
! 	-e "s;@MAN5EXT@;$(man5ext);g" \
! 	-e "s;@MAN7EXT@;$(man7ext);g" \
! 	-e "s;@TMAC_S_PREFIX@;$(tmac_s_prefix);g" \
! 	-e "s;@TMAC_M_PREFIX@;$(tmac_m_prefix);g" \
! 	-e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \
! 	-e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
! 	-e "s;@VERSION@;`cat $(srcdir)/../VERSION`;g" \
! 	-e "s;@MDATE@;`$(SHELL) $(srcdir)/../mdate.sh $<`;g" \
! 	-e "s;@g@;$(g);g" \
! 	-e "s;@G@;`echo $(g) | tr [a-z] [A-Z]`;g" \
  	$< >$@
  
  .PHONY: install_man
--- 107,132 ----
  .man.n:
  	@echo Making $@ from $<
  	@-rm -f $@
! 	@sed -e "s!@FONTDIR@!$(fontdir)!g" \
! 	-e "s!@FONTPATH@!$(fontpath)!g" \
! 	-e "s!@MACRODIR@!$(tmacdir)!g" \
! 	-e "s!@MACROPATH@!$(tmacpath)!g" \
! 	-e "s!@DEVICE@!$(DEVICE)!g" \
! 	-e "s!@DEFAULT_INDEX@!$(indexdir)/$(indexname)!g" \
! 	-e "s!@DEFAULT_INDEX_NAME@!$(indexname)!g" \
! 	-e "s!@INDEX_SUFFIX@!$(indexext)!g" \
! 	-e "s!@COMMON_WORDS_FILE@!$(common_words_file)!g" \
! 	-e "s!@MAN1EXT@!$(man1ext)!g" \
! 	-e "s!@MAN5EXT@!$(man5ext)!g" \
! 	-e "s!@MAN7EXT@!$(man7ext)!g" \
! 	-e "s!@TMAC_S_PREFIX@!$(tmac_s_prefix)!g" \
! 	-e "s!@TMAC_M_PREFIX@!$(tmac_m_prefix)!g" \
! 	-e "s!@TMAC_MDIR@!$(tmacdir)/mm!g" \
! 	-e "s!@BROKEN_SPOOLER_FLAGS@!$(BROKEN_SPOOLER_FLAGS)!g" \
! 	-e "s!@VERSION@!`cat $(srcdir)/../VERSION`!g" \
! 	-e "s!@MDATE@!`$(SHELL) $(srcdir)/../mdate.sh $<`!g" \
! 	-e "s!@g@!$(g)!g" \
! 	-e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
  	$< >$@
  
  .PHONY: install_man
*** mm/makefile.s~0	Tue Jun 27 14:11:18 1995
--- mm/makefile.sub	Wed Mar  5 15:58:42 1997
***************
*** 1,7 ****
  #
  # $Id: Makefile.sub,v 1.27 1995/04/24 05:37:46 jh Exp $
  #
! MAN7=groff_mm.n groff_mmse.n
  FILES=0.MT 5.MT 4.MT ms.cov se_ms.cov 
  # Local configuration files with default values.
  LOCALE = locale se_locale
--- 1,7 ----
  #
  # $Id: Makefile.sub,v 1.27 1995/04/24 05:37:46 jh Exp $
  #
! MAN7=groff_mm.n groff_se.n
  FILES=0.MT 5.MT 4.MT ms.cov se_ms.cov 
  # Local configuration files with default values.
  LOCALE = locale se_locale
*** pfbtops/pfbtops.c~0	Mon Apr 19 21:28:36 1993
--- pfbtops/pfbtops.c	Sun Mar  2 18:51:30 1997
***************
*** 2,7 ****
--- 2,11 ----
  
  #include <stdio.h>
  
+ #ifdef __MSDOS__
+ #include <fcntl.h>
+ #endif
+ 
  /* Binary bytes per output line. */
  #define BYTES_PER_LINE (64/2)
  #define HEX_DIGITS "0123456789abcdef"
*************** int main(argc, argv)
*** 51,56 ****
--- 55,66 ----
        perror(argv[optind]);
        exit(1);
      }
+ #ifdef __MSDOS__
+   /* Need to switch stdin to binary mode, unless it's a
+      console device, since .pfb files are binary.  */
+   if (!isatty(fileno(stdin)))
+     setmode(fileno(stdin), O_BINARY);
+ #endif
    for (;;)
      {
        int type, c, i;
*** pic/lex.c~0	Thu Jun 22 10:41:50 1995
--- pic/lex.cc	Sun Mar  2 15:52:10 1997
*************** Foundation, 59 Temple Place - Suite 330,
*** 21,27 ****
--- 21,31 ----
  #include "pic.h"
  #include "ptable.h"
  #include "object.h"
+ #ifdef __MSDOS__
+ #include "pic_tab.h"
+ #else
  #include "pic.tab.h"
+ #endif
  
  declare_ptable(char)
  implement_ptable(char)
*** tbl/table.c~0	Thu Jun 22 10:41:48 1995
--- tbl/table.cc	Tue Mar  4 14:18:48 1997
*************** void block_entry::do_divert(int alphabet
*** 669,681 ****
        break;
    if (i > end_col) {
      // Every column spanned by this entry has a minimum width.
!     for (int i = start_col; i <= end_col; i++) {
!       if (i > start_col) {
  	if (sep)
! 	  printfs("+%1n", as_string(sep[i - 1]));
  	prints('+');
        }
!       printfs("(n;%1)", mw[i]);
      }
      printfs(">?\\n[%1]u", span_width_reg(start_col, end_col));
    }
--- 669,681 ----
        break;
    if (i > end_col) {
      // Every column spanned by this entry has a minimum width.
!     for (int j = start_col; j <= end_col; j++) {
!       if (j > start_col) {
  	if (sep)
! 	  printfs("+%1n", as_string(sep[j - 1]));
  	prints('+');
        }
!       printfs("(n;%1)", mw[j]);
      }
      printfs(">?\\n[%1]u", span_width_reg(start_col, end_col));
    }
*************** void table::do_row(int r)
*** 2651,2663 ****
  	     " 0\n");
      }
      int printed_one = 0;
!     for (vertical_rule *p = vrule_list; p; p = p->next)
!       if (p->end_row == r) {
  	if (!printed_one) {
  	  prints("." REPEATED_VPT_MACRO " 0\n");
  	  printed_one = 1;
  	}
! 	p->print();
        }
      if (printed_one)
        prints("." REPEATED_VPT_MACRO " 1\n");
--- 2651,2663 ----
  	     " 0\n");
      }
      int printed_one = 0;
!     for (vertical_rule *pp = vrule_list; pp; pp = pp->next)
!       if (pp->end_row == r) {
  	if (!printed_one) {
  	  prints("." REPEATED_VPT_MACRO " 0\n");
  	  printed_one = 1;
  	}
! 	pp->print();
        }
      if (printed_one)
        prints("." REPEATED_VPT_MACRO " 1\n");
*** tfmtodit/tfmtodit.c~0	Thu Jun 22 10:42:02 1995
--- tfmtodit/tfmtodit.cc	Tue Mar  4 14:47:16 1997
*************** int read4(unsigned char *&s)
*** 273,279 ****
  int tfm::load(const char *file)
  {
    errno = 0;
!   FILE *fp = fopen(file, "r");
    if (!fp) {
      error("can't open `%1': %2", file, strerror(errno));
      return 0;
--- 273,279 ----
  int tfm::load(const char *file)
  {
    errno = 0;
!   FILE *fp = fopen(file, "rb");	// .tfm is a binary file
    if (!fp) {
      error("can't open `%1': %2", file, strerror(errno));
      return 0;
*************** int gf::load(const char *file)
*** 413,419 ****
    int left_adj, right_adj;
    const int gf_id_byte = 131;
    errno = 0;
!   FILE *fp = fopen(file, "r");
    if (!fp) {
      error("can't open `%1': %2", file, strerror(errno));
      return 0;
--- 413,419 ----
    int left_adj, right_adj;
    const int gf_id_byte = 131;
    errno = 0;
!   FILE *fp = fopen(file, "rb");	// .gf are binary files
    if (!fp) {
      error("can't open `%1': %2", file, strerror(errno));
      return 0;
*************** int main(int argc, char **argv)
*** 751,756 ****
--- 751,764 ----
    if (len > 4 && strcmp(internal_name + len - 4, ".tfm") == 0)
      internal_name[len - 4] = '\0';
    char *s = strrchr(internal_name, '/');
+ #ifdef __MSDOS__
+   // Handle backslashed filename, and the "d:file" case.
+   char *bs = strrchr(internal_name, '\\');
+   if (!s || (bs && bs > s))
+     s = bs;
+   if (!s && internal_name[0] && internal_name[1] == ':')
+     s = internal_name + 1;
+ #endif
    printf("internalname %s\n", s ? s + 1 : internal_name);
    int n;
    if (t.get_param(2, &n)) {
*************** int main(int argc, char **argv)
*** 829,835 ****
        for (j = int(sizeof(m)/sizeof(m[0])) - 1; j > 0; j--)
  	if (m[j] != 0)
  	  break;
!       for (int k = 1; k <= j; k++)
  	printf(",%d", m[k]*MULTIPLIER);
        int type = 0;
        if (m[2] > 0)
--- 837,843 ----
        for (j = int(sizeof(m)/sizeof(m[0])) - 1; j > 0; j--)
  	if (m[j] != 0)
  	  break;
!       for (k = 1; k <= j; k++)
  	printf(",%d", m[k]*MULTIPLIER);
        int type = 0;
        if (m[2] > 0)
*** tmac/makefile.s~0	Tue Jun 27 14:36:36 1995
--- tmac/makefile.sub	Wed Mar  5 16:00:20 1997
***************
*** 1,14 ****
  MAN7=groff_ms.n me.n msafer.n
  
  NORMALFILES=tmac.andoc tmac.pic tmac.ps tmac.psnew tmac.psold tmac.pspic \
!       tmac.psatk tmac.dvi tmac.tty tmac.tty-char tmac.X tmac.Xps tmac.latin1 \
        tmac.lj4 eqnrc troffrc tmac.safer
  SPECIALFILES=tmac.an tmac.s
! STRIPFILES=tmac.e tmac.doc tmac.doc.old
  MDOCFILES=doc-common doc-ditroff doc-nroff doc-syms
  mdocdir=$(tmacdir)/mdoc
! CLEANADD=stamp-strip stamp-wrap tmac.e-s tmac.doc-s tmac.doc.old-s \
!  doc-common-s doc-ditroff-s doc-nroff-s doc-syms-s *-wrap
  tmac_s_prefix=
  tmac_an_prefix=
  tmac_wrap=
--- 1,14 ----
  MAN7=groff_ms.n me.n msafer.n
  
  NORMALFILES=tmac.andoc tmac.pic tmac.ps tmac.psnew tmac.psold tmac.pspic \
!       tmac.psatk tmac.dvi tmac.tty tmac.ttc tmac.X tmac.Xps tmac.latin1 \
        tmac.lj4 eqnrc troffrc tmac.safer
  SPECIALFILES=tmac.an tmac.s
! STRIPFILES=tmac.e tmac.doc tmac-old.doc
  MDOCFILES=doc-common doc-ditroff doc-nroff doc-syms
  mdocdir=$(tmacdir)/mdoc
! CLEANADD=stamp-strip stamp-wrap s-tmac.e s-tmac.doc s-tmac-old.doc \
!  s-doc-common s-doc-ditroff s-doc-nroff s-doc-syms *-wrap
  tmac_s_prefix=
  tmac_an_prefix=
  tmac_wrap=
*************** install_data: $(NORMALFILES) $(SPECIALFI
*** 33,44 ****
  	$(INSTALL_DATA) $(srcdir)/tmac.an $(tmacdir)/tmac.$(tmac_an_prefix)an
  	for f in $(STRIPFILES); do \
  	  rm -f $(tmacdir)/$$f; \
! 	  $(INSTALL_DATA) $$f-s $(tmacdir)/$$f; \
  	done
  	-test -d $(mdocdir) || mkdir $(mdocdir)
  	for f in $(MDOCFILES); do \
  	  rm -f $(mdocdir)/$$f; \
! 	  $(INSTALL_DATA) $$f-s $(mdocdir)/$$f; \
  	done
  	-test -f $(tmacdir)/man.local || \
  	  $(INSTALL_DATA) $(srcdir)/man.local $(tmacdir)/man.local
--- 33,44 ----
  	$(INSTALL_DATA) $(srcdir)/tmac.an $(tmacdir)/tmac.$(tmac_an_prefix)an
  	for f in $(STRIPFILES); do \
  	  rm -f $(tmacdir)/$$f; \
! 	  $(INSTALL_DATA) s-$$f $(tmacdir)/$$f; \
  	done
  	-test -d $(mdocdir) || mkdir $(mdocdir)
  	for f in $(MDOCFILES); do \
  	  rm -f $(mdocdir)/$$f; \
! 	  $(INSTALL_DATA) s-$$f $(mdocdir)/$$f; \
  	done
  	-test -f $(tmacdir)/man.local || \
  	  $(INSTALL_DATA) $(srcdir)/man.local $(tmacdir)/man.local
*************** install_data: $(NORMALFILES) $(SPECIALFI
*** 46,53 ****
  
  stamp-strip: $(STRIPFILES) $(MDOCFILES)
  	for f in $(STRIPFILES) $(MDOCFILES); do \
! 	  rm -f $$f-s; \
! 	  sed -f $(srcdir)/strip.sed $(srcdir)/$$f >$$f-s; \
  	done
  	touch $@
  
--- 46,53 ----
  
  stamp-strip: $(STRIPFILES) $(MDOCFILES)
  	for f in $(STRIPFILES) $(MDOCFILES); do \
! 	  rm -f s-$$f; \
! 	  sed -f $(srcdir)/strip.sed $(srcdir)/$$f >s-$$f; \
  	done
  	touch $@
  
*** tmac/tmac.t~0	Tue Jun 27 14:57:46 1995
--- tmac/tmac.tty	Wed Mar  5 13:46:20 1997
***************
*** 44,47 ****
  .cp \n(_C
  .\" If you want the character definitions in tmac.tty-char to be loaded
  .\" automatically, remove the `\"' from the next line.
! .\"do mso tmac.tty-char
--- 44,47 ----
  .cp \n(_C
  .\" If you want the character definitions in tmac.tty-char to be loaded
  .\" automatically, remove the `\"' from the next line.
! .\"do mso tmac.ttc
*** configure.orig	Mon Nov 20 13:36:04 1995
--- djgpp/configure	Wed Mar  5 15:10:20 1997
***************
*** 114,120 ****
    --cache-file=FILE       cache test results in FILE
    --help                  print this message
    --no-create             do not create output files
!   --quiet, --silent       do not print \`checking...' messages
    --version               print the version of autoconf that created configure
  Directory and file names:
    --prefix=PREFIX         install architecture-independent files in PREFIX
--- 114,120 ----
    --cache-file=FILE       cache test results in FILE
    --help                  print this message
    --no-create             do not create output files
!   --quiet, --silent       do not print \`checking...\' messages
    --version               print the version of autoconf that created configure
  Directory and file names:
    --prefix=PREFIX         install architecture-independent files in PREFIX
***************
*** 414,420 ****
    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_path_GROPS="$ac_dir/$ac_word"
        break
      fi
--- 414,420 ----
    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_path_GROPS="$ac_dir/$ac_word"
        break
      fi
***************
*** 447,453 ****
    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
--- 447,453 ----
    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
***************
*** 522,528 ****
    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_CXX="$ac_prog"
        break
      fi
--- 522,528 ----
    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_CXX="$ac_prog"
        break
      fi
***************
*** 721,727 ****
    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_LPR="$ac_prog"
        break
      fi
--- 721,727 ----
    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_LPR="$ac_prog"
        break
      fi
***************
*** 753,759 ****
    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_LP="$ac_prog"
        break
      fi
--- 753,759 ----
    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_LP="$ac_prog"
        break
      fi
***************
*** 790,796 ****
    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_LPQ="$ac_prog"
        break
      fi
--- 790,796 ----
    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_LPQ="$ac_prog"
        break
      fi
***************
*** 841,860 ****
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    case "$PERLPATH" in
!   /*)
    ac_cv_path_PERLPATH="$PERLPATH" # Let the user override the test with a path.
    ;;
    *)
    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_path_PERLPATH="$ac_dir/$ac_word"
        break
      fi
    done
    IFS="$ac_save_ifs"
!   test -z "$ac_cv_path_PERLPATH" && ac_cv_path_PERLPATH="/usr/bin/perl"
    ;;
  esac
  fi
--- 841,860 ----
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    case "$PERLPATH" in
!   */*)
    ac_cv_path_PERLPATH="$PERLPATH" # Let the user override the test with a path.
    ;;
    *)
    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_path_PERLPATH="$ac_dir/$ac_word"
        break
      fi
    done
    IFS="$ac_save_ifs"
!   test -z "$ac_cv_path_PERLPATH" && ac_cv_path_PERLPATH="perl"
    ;;
  esac
  fi
***************
*** 879,885 ****
    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_YACC="$ac_prog"
        break
      fi
--- 879,885 ----
    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_YACC="$ac_prog"
        break
      fi
***************
*** 910,916 ****
    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
--- 910,916 ----
    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
***************
*** 928,938 ****
  
  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
--- 928,938 ----
  
  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
***************
*** 971,977 ****
      *)
        # 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.
--- 971,977 ----
      *)
        # 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.
***************
*** 1008,1014 ****
  if ln -s X conftestdata 2>/dev/null
  then
    rm -f conftestdata
!   ac_cv_prog_LN_S="ln -s"
  else
    ac_cv_prog_LN_S=ln
  fi
--- 1008,1014 ----
  if ln -s X conftestdata 2>/dev/null
  then
    rm -f conftestdata
!   ac_cv_prog_LN_S=ln
  else
    ac_cv_prog_LN_S=ln
  fi
***************
*** 1021,1026 ****
--- 1021,1028 ----
  fi
  
  echo $ac_n "checking for csh hash hack""... $ac_c" 1>&6
+ if eval csh </dev/null >/dev/null 2>&1
+ then
  cat <<EOF >conftest.sh
  #!/bin/sh
  true || exit 0
***************
*** 1034,1039 ****
--- 1036,1044 ----
  else
  	echo "$ac_t""no" 1>&6; SH_SCRIPT_SED_CMD=''
  fi
+ else
+ 	echo "$ac_t""no" 1>&6; SH_SCRIPT_SED_CMD=''
+ fi
  rm -f conftest.sh
  
  
***************
*** 2035,2041 ****
  s%\]%\\&%g
  s%\$%$$%g
  EOF
! DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
  rm -f conftest.defs
  
  
--- 2040,2046 ----
  s%\]%\\&%g
  s%\$%$$%g
  EOF
! DEFS=`sed -f conftest.defs confdefs.h | tr '\012\015' '[ *]'`
  rm -f conftest.defs
  
  
***************
*** 2073,2079 ****
  done
  
  ac_given_srcdir=$srcdir
! ac_given_INSTALL="$INSTALL"
  
  trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
  
--- 2078,2084 ----
  done
  
  ac_given_srcdir=$srcdir
! ac_given_INSTALL='$INSTALL'
  
  trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
  
***************
*** 2113,2118 ****
--- 2118,2125 ----
  s%@g@%$g%g
  s%@sys_tmac_prefix@%$sys_tmac_prefix%g
  s%@tmac_wrap@%$tmac_wrap%g
+ s,\.tab\.h,_tab.h,g
+ /path=/s,:,;,g
  
  CEOF
  EOF
*** djgpp/config.b~0	Wed Mar  5 17:49:40 1997
--- djgpp/config.bat	Wed Mar  5 15:10:30 1997
***************
*** 0 ****
--- 1,52 ----
+ @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=
+ echo updating configure script and Makefiles for DJGPP...
+ if not exist configure.orig cp -p %XSRC%/configure configure.orig
+ update %XSRC%/djgpp/configure configure
+ echo configuring...
+ set CONFIG_SHELL=bash.exe
+ set INSTALL=${DJDIR}/bin/ginstall
+ set LPR=lpr
+ set LPQ=lpq
+ set PAGE=A4
+ sh %XSRC%/configure --prefix='${DJDIR}' --disable-nls --without-x
+ set XSRC=
+ set INSTALL=
+ set LPR=
+ set LPQ=
+ set PAGE=
+ :end
*** djgpp/t-groff.b~0	Wed Mar  5 17:53:00 1997
--- djgpp/t-groff.bat	Wed Mar  5 12:10:44 1997
***************
*** 0 ****
--- 1,26 ----
+ @echo off
+ Rem This script runs groff without requiring that it be installed.
+ Rem The current directory must be the build directory.
+ 
+ test -d groff
+ if not errorlevel 1 goto dirOk
+ echo this batch file must be run with the build directory as the current directory
+ goto end
+ :dirOk
+ test -x groff/groff
+ if not errorlevel 1 goto groffOk
+ echo this batch file must be run with the build directory as the current directory
+ goto end
+ :groffOk
+ set PATH1=%PATH%
+ set PATH=troff;soelim;grops;%PATH%
+ set GROFF_COMMAND_PREFIX=
+ set GROFF_FONT_PATH=.
+ set GROFF_TMAC_PATH=./tmac;./troff
+ rem groff\groff -man -Tps %1 > prn
+ groff\groff -me -Tps %1 > prn
+ set PATH=%PATH1%
+ set GROFF_COMMAND_PREFIX=
+ set GROFF_FONT_PATH=
+ set GROFF_TMAC_PATH=
+ :exit
