diff -cr gas-2.3/gas/as.c d:gas-2.3/gas/as.c
*** gas-2.3/gas/as.c	Fri Apr 22 22:18:48 1994
--- d:gas-2.3/gas/as.c	Mon Nov 07 21:05:24 1994
***************
*** 1,3 ****
--- 1,5 ----
+ /* as.c -- changed for emx by Eberhard Mattes -- Nov 1994 */
+ 
  /* as.c - GAS main program.
     Copyright (C) 1987, 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
  
***************
*** 80,85 ****
--- 82,93 ----
  
  static int statistics_flag = 0;
  
+ #ifdef EMX
+ #include <process.h>
+ static char *omf_file_name;
+ static int omf;                 /* -O */
+ static int strip;               /* -s */
+ #endif /* EMX */
  
  void
  print_version_id ()
***************
*** 108,113 ****
--- 116,128 ----
    int keep_it;
    long start_time = get_run_time ();
  
+ #ifdef __EMX__
+   _emxload_env ("GCCLOAD");
+   _envargs (&argc, &argv, "GASOPT");
+   _response (&argc, &argv);
+   _wildcard (&argc, &argv);
+ #endif /* __EMX__ */
+ 
  #if 0 /* do we need any of this?? */
    {
      static const int sig[] = {SIGHUP, SIGINT, SIGPIPE, SIGTERM, 0};
***************
*** 182,187 ****
--- 197,217 ----
        /* This better be a switch. */
        arg++;			/*->letter. */
  
+ #ifdef EMX
+       if (strcmp (arg, "Zomf") == 0)
+         {
+           omf = 1;
+           *work_argv = NULL;
+           continue;
+         }
+       if (strcmp (arg, "Zstrip") == 0)
+         {
+           strip = 1;
+           *work_argv = NULL;
+           continue;
+         }
+ #endif /* EMX */
+ 
        while ((a = *arg) != '\0')
  	{			/* scan all the 1-char flags */
  	  arg++;		/* arg->after letter. */
***************
*** 363,368 ****
--- 393,408 ----
        *work_argv = NULL;	/* NULL means 'not a file-name' */
      }
  
+ #ifdef EMX
+   if (omf)
+     {
+       omf_file_name = out_file_name;
+       out_file_name = tempnam (NULL, "as");
+       if (out_file_name == NULL)
+         as_fatal ("tempnam() failed");
+     }
+ #endif /* EMX */
+ 
  #ifdef BFD_ASSEMBLER
    output_file_create (out_file_name);
    assert (stdoutput != 0);
***************
*** 401,406 ****
--- 441,469 ----
  
    if (!keep_it)
      unlink (out_file_name);
+ 
+ #ifdef EMX
+   if (keep_it && omf)
+     {
+       int rc, i;
+       char *args[6];
+ 
+       i = 0;
+       args[i++] = "emxomf";
+       if (strip)
+ 	args[i++] = "-s";
+       args[i++] = "-o";
+       args[i++] = omf_file_name;
+       args[i++] = out_file_name;
+       args[i] = NULL;
+       rc = spawnvp (P_WAIT, "emxomf.exe", args);
+       remove (out_file_name);
+       if (rc < 0)
+         as_fatal ("cannot run emxomf");
+       else if (rc > 0)
+         as_fatal ("emxomf failed");
+     }
+ #endif /* EMX */
  
    input_scrub_end ();
  #ifdef md_end
diff -cr gas-2.3/gas/listing.c d:gas-2.3/gas/listing.c
*** gas-2.3/gas/listing.c	Thu May 19 00:47:48 1994
--- d:gas-2.3/gas/listing.c	Mon Oct 03 21:39:56 1994
***************
*** 1,3 ****
--- 1,5 ----
+ /* listing.c -- changed for emx by Eberhard Mattes -- Oct 1994 */
+ 
  /* listing.c - mainting assembly listings
     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  
***************
*** 277,283 ****
--- 279,290 ----
    p->end_pending = 0;
  
    /* Do we really prefer binary mode for this??  */
+ #ifdef __EMX__
+   /* At least on emx, we don't. */
+   p->file = fopen (p->filename, FOPEN_RT);
+ #else /* not __EMX__ */
    p->file = fopen (p->filename, FOPEN_RB);
+ #endif /* not __EMX__ */
    if (p->file)
      fgetc (p->file);
  
