diff -bc gnuplot.old/command.c gnuplot/command.c
*** gnuplot.old/command.c	Sun Dec  3 19:26:44 1995
--- gnuplot/command.c	Tue Jan  9 00:00:28 1996
***************
*** 181,186 ****
--- 181,187 ----
   /* emx has getcwd, chdir that can handle drive names */
  #define getcwd _getcwd2
  #define chdir  _chdir2
+ extern int OnOs2 ; /* flag for OS/2 specific features */
  #endif /* OS2 */
  
  #if (defined(unix) || defined(OSK))
***************
*** 521,527 ****
  	/* Hold until CR hit. */
  #endif /* MTOS */
  #endif /* ATARI */
! #endif /*OS2*/
  #endif
  #ifdef __ZTC__
  	if (stime > 0)
--- 522,528 ----
  	/* Hold until CR hit. */
  #endif /* MTOS */
  #endif /* ATARI */
! #endif /* OS2 */
  #endif
  #ifdef __ZTC__
  	if (stime > 0)
***************
*** 701,706 ****
--- 702,708 ----
  	return(1);
      } else if (!equals(c_token, ";")) { /* null statement */
  #ifdef OS2
+       if (OnOs2)  
  	{
  	if( token[c_token].is_token ) { 
  	    char cmd[80] ;
diff -bc gnuplot.old/makefile.os2 gnuplot/makefile.os2
*** gnuplot.old/makefile.os2	Thu May 11 11:21:12 1995
--- gnuplot/makefile.os2	Mon Jan  8 23:21:02 1996
***************
*** 6,11 ****
--- 6,14 ----
  # usage: nmake  OR dmake -r  -B
  # (file has blanks instead of real tabs, doesn't use dmake.ini)
  # 
+ # Modified by David J. Liu (liudj0@minerva.cis.yale.edu)
+ # to be used for compiling a version works for both OS/2 and DOS.
+ #
  
  # where to place gnuplot.gih helpfile
  HELPFILE = gnuplot.gih
***************
*** 19,25 ****
  OBJS = 	bitmap.o command.o contour.o eval.o graphics.o graph3d.o util3d.o \
  	help.o internal.o misc.o parse.o plot.o plot2d.o plot3d.o readline.o specfun.o \
  	scanner.o set.o show.o standard.o term.o util.o version.o \
!         binary.o interpol.o fit.o matrix.o datafile.o alloc.o hidden3d.o
  
  CSOURCE5 = term\aed.trm term\cgi.trm term/dumb.trm term/dxf.trm term\dxy.trm \
  	term\eepic.trm term\epson.trm term\fig.trm term\hp26.trm \
--- 22,28 ----
  OBJS = 	bitmap.o command.o contour.o eval.o graphics.o graph3d.o util3d.o \
  	help.o internal.o misc.o parse.o plot.o plot2d.o plot3d.o readline.o specfun.o \
  	scanner.o set.o show.o standard.o term.o util.o version.o \
!         binary.o interpol.o fit.o matrix.o datafile.o alloc.o hidden3d.o gstring.o
  
  CSOURCE5 = term\aed.trm term\cgi.trm term/dumb.trm term/dxf.trm term\dxy.trm \
  	term\eepic.trm term\epson.trm term\fig.trm term\hp26.trm \
***************
*** 36,43 ****
  	gcc $(CFLAGS) -o $*.o $*.c
  
  gnuplot.exe: $(OBJS)
!         gcc -o gnuplot.exe $(OBJS) -los2
! 
  
  bitmap.o: bitmap.c bitmap.h plot.h
  
--- 39,46 ----
  	gcc $(CFLAGS) -o $*.o $*.c
  
  gnuplot.exe: $(OBJS)
! 	gcc -o gnuplot.exe *.o -lgraph -lvesa -los2 -s
! 	emxbind -a gnuplot.exe -acim -p
  
  bitmap.o: bitmap.c bitmap.h plot.h
  
***************
*** 52,57 ****
--- 55,63 ----
  graphics.o: graphics.c plot.h setshow.h
  
  graph3d.o: graph3d.c plot.h setshow.h
+ 
+ gstring.o: emx\gstring.c
+ 	gcc -c -O2 -o gstring.o emx\\gstring.c
  
  fit.o: fit.c fit.h matrix.h plot.h
  
diff -bc gnuplot.old/plot.c gnuplot/plot.c
*** gnuplot.old/plot.c	Thu Dec  7 16:41:08 1995
--- gnuplot/plot.c	Tue Jan  9 22:12:34 1996
***************
*** 189,194 ****
--- 189,195 ----
  #define INCL_REXXSAA
  #include <os2.h>
  #include <process.h>
+ int OnOs2 ; /* flag to be used with OS/2 only features */
  ULONG RexxInterface( PRXSTRING, PUSHORT, PRXSTRING ) ;
  int   ExecuteMacro( char* ) ;
  #endif
***************
*** 290,296 ****
--- 291,302 ----
  #endif
  
  #ifdef OS2
+   OnOs2 = (strstr(getenv("COMSPEC"),"cmd.exe")!=NULL) ;
+   if (OnOs2)
+     {
+      fprintf (stderr,"OS/2 specific features enabled.\n") ;
       RexxRegisterSubcomExe( "GNUPLOT", (PFN) RexxInterface, NULL ) ;
+     }
  #endif
  
  	setbuf(stderr,(char *)NULL);
***************
*** 403,408 ****
--- 409,415 ----
  	vms_reset();
  #endif
  #ifdef OS2
+   if (OnOs2)
       RexxDeregisterSubcom( "GNUPLOT", NULL ) ;
  #endif
  #if defined(ATARI) || defined(MTOS)
diff -bc gnuplot.old/term.c gnuplot/term.c
*** gnuplot.old/term.c	Sat Dec  2 17:04:40 1995
--- gnuplot/term.c	Tue Jan  9 00:00:12 1996
***************
*** 120,125 ****
--- 120,129 ----
  /* #undef TGIF */
  #endif
  
+ #ifdef OS2
+ extern int OnOs2 ;
+ #endif /* OS2 */
+ 
  #if defined(MSDOS)||defined(ATARI)||defined(MTOS)||defined(OS2)||defined(_Windows)||defined(DOS386)
  void reopen_binary();
  #define REOPEN_BINARY
***************
*** 530,536 ****
  
  #ifdef POSTSCRIPT	/* POSTSCRIPT type */
  #include "term/post.trm"
- #include "term/enhpost.trm"
  #endif
  
  #ifdef GRASS              /* GRASS (geographic info system) monitor */
--- 534,539 ----
***************
*** 1856,1869 ****
  	     term_name = "cgi";
  #endif /*CGI */
  
- #if defined(MSDOS) && defined(__EMX__)
- #ifdef EMXVESA
- 	   term_name = "vesa";
- #else
- 	   term_name = "vgal";
- #endif
- #endif
- 
  #ifdef DJGPP
  		term_name = "svga";
  #endif
--- 1859,1864 ----
***************
*** 1873,1881 ****
  #endif
  
  #ifdef OS2
!            term_name = "pm" ;
!             /* EMX compiler has getcwd that can return drive */
!            PM_init() ;
  #endif /*OS2 */           
  
  /* set linux terminal only if LINUX_setup was successfull, if we are on X11
--- 1868,1874 ----
  #endif
  
  #ifdef OS2
! 	   if (OnOs2) PM_init() ;
  #endif /*OS2 */
  
  /* set linux terminal only if LINUX_setup was successfull, if we are on X11
diff -bc gnuplot.old/term.h gnuplot/term.h
*** gnuplot.old/term.h	Sun Dec  3 19:26:48 1995
--- gnuplot/term.h	Mon Jan  8 23:19:14 1996
***************
*** 72,82 ****
  #endif
  
  #include "dumb.trm"    /* dumb terminal */
- #include "x11.trm"     /* x windows */
  #include "regis.trm"  /* regis graphics */
! #include "tek.trm"
  #include "post.trm"    /* postscript */
! 
  #include "pbm.trm"     /* portable bit map */
  /* #include "png.trm"  /* png - requires 3rd party library - see driver file */
  
--- 72,81 ----
  #endif
  
  #include "dumb.trm"    /* dumb terminal */
  #include "regis.trm"  /* regis graphics */
! #include "tek.trm" /* */
  #include "post.trm"    /* postscript */
! #include "hpgl.trm"  /* HP-GL */
  #include "pbm.trm"     /* portable bit map */
  /* #include "png.trm"  /* png - requires 3rd party library - see driver file */
  
***************
*** 84,99 ****
  #include "latex.trm"   /* latex and emtex */
  #include "pslatex.trm" /* latex with picture in postscript */
  
  #ifdef LINUX
  #include "linux.trm"   /* linux vga */
  #endif
  
! /* #include "metafont.trm" /* METAFONT */
! /* #include "fig.trm"    /* fig graphics */
  /* #include "grass.trm"  /* geographical info system */
  /* #include "tgif.trm"   /* GIF, via an external library */
  
  #ifdef OS2
  #include "pm.trm"  /* presentation manager */
  #endif
  
--- 83,104 ----
  #include "latex.trm"   /* latex and emtex */
  #include "pslatex.trm" /* latex with picture in postscript */
  
+ #ifdef X11
+ #include "x11.trm"     /* x windows */
+ #endif
+ 
  #ifdef LINUX
  #include "linux.trm"   /* linux vga */
  #endif
  
! #include "metafont.trm" /* METAFONT */
! #include "fig.trm"    /* fig graphics */
  /* #include "grass.trm"  /* geographical info system */
  /* #include "tgif.trm"   /* GIF, via an external library */
  
  #ifdef OS2
+ #define DEFAULTTERM "emxvga" /* "pm" */
+ #include "emxvga.trm" /* works with DOS and OS/2 (windowed/full screen) */
  #include "pm.trm"  /* presentation manager */
  #endif
  
***************
*** 200,205 ****
--- 205,212 ----
  #endif /* MSDOS */
  
  #ifdef OS2
+ #define DEFAULTTERM "emxvga" /* "pm" */
+ /* #define EMXVGA		/* works with DOS and OS/2 (windowed/full screen) */
  #define OS2PM
  #endif /*OS2 */
  
