hoc(1) moves to github; patches incorporated; new homepage;

multiple cluebats from, and ok, sthen@
This commit is contained in:
ian 2017-10-13 18:10:46 +00:00
parent 3237752444
commit 07ed04087a
5 changed files with 10 additions and 108 deletions

View File

@ -1,31 +1,25 @@
# Ports collection makefile for "hoc", the High Order Calculator
# $OpenBSD: Makefile,v 1.28 2015/01/22 18:41:16 naddy Exp $
# $OpenBSD: Makefile,v 1.29 2017/10/13 18:10:46 ian Exp $
COMMENT= from Kernighan & Pike: High Order Calculator
DISTNAME= hoc
PKGNAME= hoc-1.1
REVISION= 0
CATEGORIES= math
GH_ACCOUNT = IanDarwin
GH_PROJECT = hoc
GH_TAGNAME = v1.1
REVISION= 1
MASTER_SITES= http://cm.bell-labs.com/cm/cs/who/bwk/
EXTRACT_SUFX= .sh
EXTRACT_CASES= *.sh) /bin/sh ${FULLDISTDIR}/$$archive;;
CATEGORIES= math
MAINTAINER= Ian Darwin <ian@openbsd.org>
HOMEPAGE= http://cm.bell-labs.com/cm/cs/who/bwk/
HOMEPAGE= https://www.cs.princeton.edu/~bwk/btl.mirror/new/
# License is included in the distfile: "Permission to use, copy,
# BSD-like License from original distfile: "Permission to use, copy,
# modify, and distribute this software... for any purpose and without
# fee.. provided that the copyright notice appear in all copies..."
PERMIT_PACKAGE_CDROM= Yes
WANTLIB= c m
ALL_TARGET= hoc
MAKE_FILE= makefile
WRKDIST= ${WRKDIR}
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/hoc ${PREFIX}/bin

View File

@ -1,2 +1,2 @@
SHA256 (hoc.sh) = SpbBIoRIKz5FT5swfNGt29kfcam6q22Qw8+b3XZN6lc=
SIZE (hoc.sh) = 34854
SHA256 (hoc-1.1.tar.gz) = 1+MeEtcTNcv+oeX1vRIlKi6xyKWOLuaFYrcGFlxYtQ0=
SIZE (hoc-1.1.tar.gz) = 11422

View File

@ -1,30 +0,0 @@
--- hoc.y.orig Sun Oct 29 16:58:33 2006
+++ hoc.y Sun Oct 29 16:58:52 2006
@@ -223,8 +223,9 @@ yylex(void) /* hoc6 */
*p = backslash(c);
}
*p = 0;
- yylval.sym = (Symbol *)emalloc(strlen(sbuf)+1);
- strcpy((char*)yylval.sym, sbuf);
+ size_t buflen = strlen(sbuf) + 1;
+ yylval.sym = (Symbol *)emalloc(buflen);
+ strlcpy((char*)yylval.sym, sbuf, buflen);
return STRING;
}
switch (c) {
@@ -284,13 +285,13 @@ execerror(char* s, char* t) /* recover f
}
void
-fpecatch(void) /* catch floating point exceptions */
+fpecatch(int signum) /* catch floating point exceptions */
{
execerror("floating point exception", (char *) 0);
}
void
-intcatch(void) /* catch interrupts */
+intcatch(int signum) /* catch interrupts */
{
execerror("interrupt", (char *) 0);
}

View File

@ -1,47 +0,0 @@
--- makefile.orig Sun Oct 29 17:03:34 2006
+++ makefile Sun Oct 29 17:11:52 2006
@@ -1,29 +1,38 @@
YFLAGS = -d
-CFLAGS = -g
+#CFLAGS = -g
SRC = hoc.y hoc.h code.c init.c math.c symbol.c
OBJS = hoc.o code.o init.o math.o symbol.o
hoc: $(OBJS)
- $(CC) $(CFLAGS) $(OBJS) -lstdio -lm -o hoc
+ $(CC) $(CFLAGS) $(OBJS) -lm -o hoc
hoc.o code.o init.o symbol.o: hoc.h
code.o init.o symbol.o: x.tab.h
+.if ${MACHINE_ARCH} == "i386"
+code.o: code.c
+ $(CC) $(CFLAGS) -O0 -c code.c
+.endif
+
x.tab.h: y.tab.h
-cmp -s x.tab.h y.tab.h || cp y.tab.h x.tab.h
-pr: $(SRC)
- @prcan $?
- @touch pr
-
install: hoc
cp hoc /usr/bin
strip /usr/bin/hoc
+y.tab.h y.tab.c: hoc.y
+ yacc ${YFLAGS} hoc.y
+
clean:
rm -f $(OBJS) [xy].tab.[ch] hoc
bundle:
@bundle $(SRC) makefile README
+
+# a few basic tests
+regress:
+ echo 2/3 | hoc | grep '^0.66666666*7$$' >/dev/null
+ echo 'x=22/7\nprint x' | hoc | grep '^3.142857' >/dev/null

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-symbol_c,v 1.1 2006/10/29 23:14:43 ian Exp $
--- symbol.c.orig Sun Oct 29 17:00:59 2006
+++ symbol.c Sun Oct 29 17:01:25 2006
@@ -21,8 +21,9 @@ install(char* s, int t, double d) /* in
Symbol *sp;
sp = emalloc(sizeof(Symbol));
- sp->name = emalloc(strlen(s)+1); /* +1 for '\0' */
- strcpy(sp->name, s);
+ size_t len = strlen(s) + 1;
+ sp->name = emalloc(len); /* +1 for '\0' */
+ strlcpy(sp->name, s, len);
sp->type = t;
sp->u.val = d;
sp->next = symlist; /* put at front of list */