commit 521514d

Emilia Smólska  ·  2026-11-05 20:51:11 +0000 UTC
parent 988287b
restructure to prepare for adding gaqp(6)
5 files changed,  +51, -30
M aq.c
+1, -0
1@@ -1,2 +1,3 @@
2 aq
3+*.bak
4 *.o
+15, -7
 1@@ -8,21 +8,29 @@ CFLAGS = -g
 2 PREFIX = /usr/local
 3 GAMESDIR = ${PREFIX}/games
 4 
 5-PROG = aq
 6-OBJS = aq.o
 7+AQPROG = aq
 8+AQOBJS = aq.o libaq.o
 9 
10-all: ${PROG}
11+all: ${AQPROG}
12 
13-${PROG}: ${OBJS}
14-	${CC} ${LDFLAGS} -o $@ ${OBJS}
15+${AQPROG}: ${AQOBJS}
16+	${CC} ${LDFLAGS} -o $@ ${AQOBJS}
17 
18 .SUFFIXES: .c .o
19 .c.o:
20 	${CC} ${CFLAGS} ${STDCFLAGS} -c -o $@ $<
21 
22 clean:
23-	rm -f ${PROG} *.core *.o
24+	rm -f ${AQPROG} *.core *.o
25+
26+depend:
27+	makedepend -Y *.c 2>/dev/null
28 
29 install:
30 	mkdir -p ${DESTDIR}${GAMESDIR}/
31-	cp ${PROG} ${DESTDIR}${GAMESDIR}/
32+	cp ${AQPROG} ${DESTDIR}${GAMESDIR}/
33+
34+# DO NOT DELETE
35+
36+aq.o: libaq.h
37+libaq.o: libaq.h
M aq.c
+2, -23
 1@@ -8,30 +8,9 @@
 2 #include <string.h>
 3 #include <unistd.h>
 4 
 5-static char *progname;
 6-
 7-/* octal because i can */
 8-static const char _aq_table[128] = {
 9-	000, 000, 000, 000, 000, 000, 000, 000,
10-	000, 000, 000, 000, 000, 000, 000, 000,
11-	000, 000, 000, 000, 000, 000, 000, 000,
12-	000, 000, 000, 000, 000, 000, 000, 000,
13-	000, 000, 000, 000, 000, 000, 000, 000,
14-	000, 000, 000, 000, 000, 000, 000, 000,
15-	001, 002, 003, 004, 005, 006, 007, 010,
16-	010, 011, 000, 000, 000, 000, 000, 000,
17-	000, 012, 013, 014, 015, 016, 017, 020,
18-	021, 022, 023, 024, 025, 026, 027, 030,
19-	031, 032, 033, 034, 035, 036, 037, 040,
20-	041, 042, 043, 000, 000, 000, 000, 000,
21-	000, 012, 013, 014, 015, 016, 017, 020,
22-	021, 022, 023, 024, 025, 026, 027, 030,
23-	031, 032, 033, 034, 035, 036, 037, 040,
24-	041, 042, 043, 000, 000, 000, 000, 000,
25-};
26+#include "libaq.h"
27 
28-/* clangoy cries about char subscripts */
29-#define aq_value(x) (_aq_table[(int)(x)])
30+static char *progname;
31 
32 static int
33 aq_sum(const char *s)
+27, -0
 1@@ -0,0 +1,27 @@
 2+#include "libaq.h"
 3+
 4+/* octal because i can */
 5+static const char _aq_table[128] = {
 6+	000, 000, 000, 000, 000, 000, 000, 000,
 7+	000, 000, 000, 000, 000, 000, 000, 000,
 8+	000, 000, 000, 000, 000, 000, 000, 000,
 9+	000, 000, 000, 000, 000, 000, 000, 000,
10+	000, 000, 000, 000, 000, 000, 000, 000,
11+	000, 000, 000, 000, 000, 000, 000, 000,
12+	001, 002, 003, 004, 005, 006, 007, 010,
13+	010, 011, 000, 000, 000, 000, 000, 000,
14+	000, 012, 013, 014, 015, 016, 017, 020,
15+	021, 022, 023, 024, 025, 026, 027, 030,
16+	031, 032, 033, 034, 035, 036, 037, 040,
17+	041, 042, 043, 000, 000, 000, 000, 000,
18+	000, 012, 013, 014, 015, 016, 017, 020,
19+	021, 022, 023, 024, 025, 026, 027, 030,
20+	031, 032, 033, 034, 035, 036, 037, 040,
21+	041, 042, 043, 000, 000, 000, 000, 000,
22+};
23+
24+int
25+aq_value(char x)
26+{
27+	return _aq_table[(int)x];
28+}
+6, -0
1@@ -0,0 +1,6 @@
2+#ifndef LIBAQ_H
3+#define LIBAQ_H
4+
5+extern int aq_value(char x);
6+
7+#endif /* LIBAQ_H */