shithub: pc

Download patch

ref: 33ccdc7f42803457a2bbb11eeb633f9dbafd6e9f
parent: 7574756e466fd373beac9fa5cc96936b395eb83f
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Feb 19 17:05:46 EST 2022

update Makefile and fix a few warnings

--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
-TARGET = pc
-PREFIX ?= /usr/local
-CFLAGS ?= -O2 -Iinclude -Wno-incompatible-pointer-types -Wno-microsoft-anon-tag -fms-extensions
+TARGET=pc
+DESTDIR?=
+PREFIX?=/usr/local
+CFLAGS?=-g -O2
+CFLAGS+=-Iinclude -Wall -Wno-missing-braces -Wno-parentheses -Wno-incompatible-pointer-types -fms-extensions
 
 OFILES=\
 	libc/dofmt.o\
@@ -70,7 +72,7 @@
 	libmp/mpvecsub.o\
 	libmp/mpvectscmp.o\
 	libmp/strtomp.o\
-	pc.o\
+	$(TARGET).o\
 
 .PHONY: all default install uninstall clean
 
@@ -82,16 +84,14 @@
 	install -d $(DESTDIR)$(PREFIX)/bin
 	install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
 	install -d $(DESTDIR)$(PREFIX)/share/man/man1
-	install -m 644 pc.1 $(DESTDIR)$(PREFIX)/share/man/man1
+	install -m 644 $(TARGET).1 $(DESTDIR)$(PREFIX)/share/man/man1
 
 uninstall:
-	rm -f $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET) $(DESTDIR)$(PREFIX)/share/man/man1/pc.1
+	rm -f $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET) $(DESTDIR)$(PREFIX)/share/man/man1/$(TARGET).1
 
 clean:
-	rm -f $(TARG) $(OFILES) pc.c
+	rm -f $(TARG) $(OFILES) $(TARGET).c
 
 $(TARGET): $(OFILES)
 
-pc.o: pc.c
-
-pc.c: pc.y
+$(TARGET).c: $(TARGET).y
--- a/pc.y
+++ b/pc.y
@@ -1036,8 +1036,8 @@
 	fmtinstall('B', mpfmt);
 	
 	for(kw = ops; kw->name[0] != 0; kw++)
-		if(optab[kw->name[0]] == nil)
-			optab[kw->name[0]] = kw;
+		if(optab[(int)kw->name[0]] == nil)
+			optab[(int)kw->name[0]] = kw;
 	
 	regfunc("hex", fnhex, 1);
 	regfunc("dec", fndec, 1);