Index: trunk/src/emx/src/emxomf/emxomf.c
===================================================================
--- trunk/src/emx/src/emxomf/emxomf.c	(revision 296)
+++ trunk/src/emx/src/emxomf/emxomf.c	(revision 297)
@@ -2758,52 +2758,24 @@
     len += 1 + strlen (file_list[i]);
 
-  /* Write the line number table. */
+/*
+ * This is the VAC way, but link386 doesn't like this.
+ * too bad :/
+ */
+#if 0
+
+  /* Filename table first  -  a first entry like visual age does it and does hints on */
 
   init_rec (LINNUM|REC32);
   started = TRUE;
   put_idx (0);                  /* Base Group */
-  put_idx (text_index);         /* Base Segment */
+  put_idx (0);                  /* Base Segment */
 
   put_16 (0);                   /* Line number = 0 (special entry) */
-  put_8 (0);                    /* Entry type: source and offset */
+  put_8 (3);                    /* Entry type: some visual age stuff I believe */
   put_8 (0);                    /* Reserved */
-  put_16 (valid_lines);         /* Count of line number entries */
+  put_16 (1);                   /* Count of line number entries */
   put_16 (0);                   /* Segment number */
   put_32 (len);                 /* Size of file names table */
-
-  for (i = 0; i < line_grow.count; ++i)
-    if (line_list[i].line >= 0)
-      {
-        if (started && !fits (8))
-          {
-            write_rec ();
-            started = FALSE;
-          }
-        if (!started)
-          {
-            init_rec (LINNUM|REC32);
-            put_idx (0);          /* Base Group */
-            put_idx (text_index); /* Base Segment */
-            started = TRUE;
-          }
-        put_16 (line_list[i].line);
-        put_16(line_list[i].file_index + 1);
-        put_32 (line_list[i].addr);
-      }
-
-  /* Now write the file names table. */
-
-  if (started && !fits (12))
-    {
-      write_rec ();
-      started = FALSE;
-    }
-  if (!started)
-    {
-      init_rec (LINNUM|REC32);
-      put_idx (0);          /* Base Group */
-      put_idx (text_index); /* Base Segment */
-      started = TRUE;
-    }
+  /* no linenumber */
   put_32 (0);                   /* First column */
   put_32 (0);                   /* Number of columns */
@@ -2836,4 +2808,124 @@
   if (started)
     write_rec ();
+
+
+  /* Write the line number table. */
+
+  init_rec (LINNUM|REC32);
+  started = TRUE;
+  put_idx (0);                  /* Base Group */
+  put_idx (text_index);         /* Base Segment */
+
+  put_16 (0);                   /* Line number = 0 (special entry) */
+  put_8 (0);                    /* Entry type: source and offset */
+  put_8 (0);                    /* Reserved */
+  put_16 (valid_lines);         /* Count of line number entries */
+  put_16 (0);                   /* Segment number */
+  put_32 (0);                   /* Size of file names table */
+
+  for (i = 0; i < line_grow.count; ++i)
+    if (line_list[i].line >= 0)
+      {
+        if (started && !fits (8))
+          {
+            write_rec ();
+            started = FALSE;
+          }
+        if (!started)
+          {
+            init_rec (LINNUM|REC32);
+            put_idx (0);          /* Base Group */
+            put_idx (text_index); /* Base Segment */
+            started = TRUE;
+          }
+        put_16 (line_list[i].line);
+        put_16(line_list[i].file_index + 1);
+        put_32 (line_list[i].addr);
+      }
+
+  if (started)
+    write_rec ();
+
+
+#else
+  /* Write the line number table. */
+
+  init_rec (LINNUM|REC32);
+  started = TRUE;
+  put_idx (0);                  /* Base Group */
+  put_idx (text_index);         /* Base Segment */
+
+  put_16 (0);                   /* Line number = 0 (special entry) */
+  put_8 (0);                    /* Entry type: source and offset */
+  put_8 (0);                    /* Reserved */
+  put_16 (valid_lines);         /* Count of line number entries */
+  put_16 (0);                   /* Segment number */
+  put_32 (len);                 /* Size of file names table */
+
+  for (i = 0; i < line_grow.count; ++i)
+    if (line_list[i].line >= 0)
+      {
+        if (started && !fits (8))
+          {
+            write_rec ();
+            started = FALSE;
+          }
+        if (!started)
+          {
+            init_rec (LINNUM|REC32);
+            put_idx (0);          /* Base Group */
+            put_idx (text_index); /* Base Segment */
+            started = TRUE;
+          }
+        put_16 (line_list[i].line);
+        put_16(line_list[i].file_index + 1);
+        put_32 (line_list[i].addr);
+      }
+
+  /* Now write the file names table. */
+
+  if (started && !fits (12))
+    {
+      write_rec ();
+      started = FALSE;
+    }
+  if (!started)
+    {
+      init_rec (LINNUM|REC32);
+      put_idx (0);          /* Base Group */
+      put_idx (text_index); /* Base Segment */
+      started = TRUE;
+    }
+  put_32 (0);                   /* First column */
+  put_32 (0);                   /* Number of columns */
+  put_32 (file_grow.count);     /* Number of source and listing files */
+
+  for (i = 0; i < file_grow.count; ++i)
+    {
+      len = strlen (file_list[i]);
+      if (len > sizeof (buf) - 1)
+        len = sizeof (buf) - 1;
+      memcpy (buf, file_list[i], len);
+      buf[len] = 0;
+      convert_filename (buf);
+      if (started && !fits (1 + len))
+        {
+          write_rec ();
+          started = FALSE;
+        }
+      if (!started)
+        {
+          init_rec (LINNUM|REC32);
+          put_idx (0);          /* Base Group */
+          put_idx (text_index); /* Base Segment */
+          started = TRUE;
+        }
+      put_8 (len);
+      put_mem (buf, len);
+    }
+
+  if (started)
+    write_rec ();
+#endif
 
   grow_free (&line_grow);
