File: clean-up.patch

package info (click to toggle)
a56 1.3%2Bdfsg-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 664 kB
  • sloc: yacc: 7,550; ansic: 5,851; makefile: 231; awk: 4; sh: 1
file content (181 lines) | stat: -rw-r--r-- 3,968 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
Origin: https://github.com/rkujawa/a56/commit/2dcf6ca8efabcf31c4c5464b49465ae89ab4dd15
From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= <radoslaw.kujawa@c0ff33.net>
Date: Thu, 16 May 2013 21:07:45 +0200
Subject: Clean up code some more...
Forwarded: not-needed as there is no upstream anymore
---
--- a/Makefile
+++ b/Makefile
@@ -56,8 +56,8 @@ POSTPROCESS = echo
 #DEBUG = -O -Olimit 3000
 DEBUG = -O
 
-SRCS = main.c a56.y lex.c subs.c getopt.c kparse.key
-OBJS = main.o gram.o lex.o toktab.o subs.o getopt.o kparse.o
+SRCS = main.c a56.y lex.c subs.c kparse.key
+OBJS = main.o gram.o lex.o toktab.o subs.o kparse.o
 
 DEFINES = $(CCDEFS)
 #DEFINES = -DYYDEBUG -DLDEBUG $(CCDEFS)
--- a/a56.h
+++ b/a56.h
@@ -5,7 +5,7 @@
  *  Written by Quinn C. Jensen
  *  July 1990
  *
- *******************************************************\
+ *******************************************************/
 
 /*
  * Copyright (C) 1990-1994 Quinn C. Jensen
--- a/keybld.c
+++ b/keybld.c
@@ -10,6 +10,25 @@
  * provided "as is" without express or implied warranty.
  *
  */
+#include <stdio.h>
+#include <string.h>
+
+#define MAX_CHAR 'z'
+
+#define TRANSITIONS (MAX_CHAR + 1)
+
+struct state {
+	int number;
+	char *seen;
+	struct trans {
+		char action;
+		void *arg;
+	} trans[TRANSITIONS];
+	struct state *next;
+} empty_state, *stop = NULL, *scur = NULL;
+
+int n_states = 0;
+
 static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
 
 /*
@@ -17,7 +40,6 @@ static char *Copyright = "Copyright (C)
  *
  */
 
-#include <stdio.h>
 #include "a56.h"
 
 char buf[1024];
@@ -49,20 +71,7 @@ int main(void)
 	return 0;
 }
 
-#define MAX_CHAR 'z'
-
-#define TRANSITIONS (MAX_CHAR + 1)
 
-struct state {
-	int number;
-	char *seen;
-	struct trans {
-		char action;
-		void *arg;
-	} trans[TRANSITIONS];
-	struct state *next;
-} empty_state, *stop = NULL, *scur = NULL;
-int n_states = 0;
 
 /* actions */
 #define NOMATCH 0	/* argument is nothing */
--- a/main.c
+++ b/main.c
@@ -5,7 +5,7 @@
  *  Written by Quinn C. Jensen
  *  July 1990
  *
- *******************************************************\
+ *******************************************************/
 
 /*
  * Copyright (C) 1990-1994 Quinn C. Jensen
@@ -19,6 +19,8 @@
  * provided "as is" without express or implied warranty.
  *
  */
+#include <unistd.h>
+
 static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
 
 /*
--- a/subs.c
+++ b/subs.c
@@ -5,7 +5,7 @@
  *  Written by Quinn C. Jensen
  *  July 1990
  *
- *******************************************************\
+ *******************************************************/
 
 /*
  * Copyright (C) 1990-1994 Quinn C. Jensen
@@ -27,6 +27,8 @@ static char *Copyright = "Copyright (C)
  */
 
 #include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "a56.h"
 
@@ -116,9 +118,8 @@ char *untabn(register char *s, register
 char *alloc(int size)
 {
 	char *p = (char *)malloc(size);
-	if(NOT p)
-		fatal("alloc:  insufficient virtual memory to allocate %d bytes\n", 
-			size);
+	if (!p)
+		fprintf(stderr, "alloc:  insufficient virtual memory to allocate %d bytes\n", size);
 	return p;
 }
 
@@ -129,6 +130,7 @@ char *alloc(int size)
 	(c) >= 'A' && (c) <= 'Z' || \
 	(c) >= 'a' && (c) <= 'z')
 
+/*
 strtol(s, p, base)
 register char *s, **p;
 register int base;
@@ -158,3 +160,4 @@ register int base;
 
 	return sign ? -result : result;
 }
+*/
--- a/toomf.c
+++ b/toomf.c
@@ -5,7 +5,7 @@
  *  Written by Quinn C. Jensen
  *  July 1990
  *
- *******************************************************\
+ *******************************************************/
 
 /*
  * Copyright (C) 1990-1994 Quinn C. Jensen
@@ -19,6 +19,10 @@
  * provided "as is" without express or implied warranty.
  *
  */
+
+#include <stdio.h>
+#include <stdlib.h>
+
 static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
 
 /*
@@ -57,4 +61,6 @@ int main(int argc, char **argv)
 		}
 	}
 	printf("\n_END %04X\n", startaddr);
+
+	return(EXIT_SUCCESS);
 }