File: io.patch

package info (click to toggle)
mixal 1.08-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 208 kB
  • ctags: 296
  • sloc: ansic: 1,597; makefile: 87; sh: 12; awk: 10
file content (53 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- io.c.orig	Thu May 27 20:23:43 1999
+++ io.c	Thu May 27 20:22:17 1999
@@ -1,4 +1,12 @@
 /* MIX simulator, copyright 1994 by Darius Bacon */ 
+
+/* GNU Libc 2.1 fix by Antti-Juhani Kaijanaho <ajk@debian.org> on
+   1999-05-27: since you can no longer initialize with stdin and
+   stdout, we don't; instead, we return them in assigned_file.
+   Apparently that's the only thing that accesses the file attribute
+   in the devices table, so this is ok.  Changes marked with "ajk".
+   -ajk */
+
 #include "mix.h"
 #include "charset.h"
 #include "io.h"
@@ -6,6 +14,7 @@
 
 #include <errno.h>
 #include <stdio.h>
+#include <string.h>
 
 /* --- Device tables --- */
 
@@ -21,9 +30,9 @@
 } devices[] = {
     {tape}, {tape}, {tape}, {tape}, {tape}, {tape}, {tape}, {tape}, 
     {disk}, {disk}, {disk}, {disk}, {disk}, {disk}, {disk}, {disk}, 
-    {card_in, stdin},
-    {card_out, stdout},
-    {printer, stdout},
+    {card_in/*, stdin -ajk*/},
+    {card_out/*, stdout -ajk*/},
+    {printer/*, stdout -ajk*/},
     {console}
 };
 
@@ -70,7 +79,15 @@
 
 static FILE *assigned_file(unsigned device)
 {
-    return devices[device].file;
+    /* glibc2.1 fix -ajk */
+    switch (devices[device].type) {
+    case card_in:
+        return stdin; break;
+    case card_out: case printer:
+        return stdout; break;
+    default:
+        return devices[device].file;
+    }
 }
 
 static char *device_filename(Byte device)