aboutsummaryrefslogtreecommitdiffstats
path: root/math/physcalc
diff options
context:
space:
mode:
authorwill <will@FreeBSD.org>2000-08-28 07:32:03 +0800
committerwill <will@FreeBSD.org>2000-08-28 07:32:03 +0800
commit9775812d2c8610b54bb22e263ced08feb647561e (patch)
tree039e4fb00060e1c3425a9b87b35d80ae975254f9 /math/physcalc
parentf0de45a0f4d418b622f96ca1400d983e24cf7bde (diff)
downloadfreebsd-ports-gnome-9775812d2c8610b54bb22e263ced08feb647561e.tar.gz
freebsd-ports-gnome-9775812d2c8610b54bb22e263ced08feb647561e.tar.zst
freebsd-ports-gnome-9775812d2c8610b54bb22e263ced08feb647561e.zip
Add physcalc (unversioned), an extremely old (apparently first written
in 1990), but still quite useful and flexible calculator. Basically it's units(1) on steroids. Also added patches to make physcalc secure (who knows, someone might make a cgi interface to it); also allowed it to actually read its *.phy files in another directory. Submitted/Requested by: gsutter gets() -> fgets() code: eivind SHAREDIR code: Marius Bendiksen <mbendiks@eunet.no>
Diffstat (limited to 'math/physcalc')
-rw-r--r--math/physcalc/Makefile40
-rw-r--r--math/physcalc/distinfo1
-rw-r--r--math/physcalc/files/patch-aa13
-rw-r--r--math/physcalc/files/patch-ab29
-rw-r--r--math/physcalc/files/patch-ac20
-rw-r--r--math/physcalc/pkg-comment1
-rw-r--r--math/physcalc/pkg-descr8
-rw-r--r--math/physcalc/pkg-plist11
8 files changed, 123 insertions, 0 deletions
diff --git a/math/physcalc/Makefile b/math/physcalc/Makefile
new file mode 100644
index 000000000000..d2cab5eaf119
--- /dev/null
+++ b/math/physcalc/Makefile
@@ -0,0 +1,40 @@
+# New ports collection makefile for: physcalc
+# Date created: Sun 27 Aug 2000
+# Whom: Will Andrews <andrews@technologist.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= physcalc
+PORTVERSION= 1.0
+CATEGORIES= math
+MASTER_SITES= ftp://ftp.lightlink.com/pub/vulcan/
+DISTNAME= ${PORTNAME}
+EXTRACT_SUFX= .zip
+
+MAINTAINER= ports@FreeBSD.org
+
+USE_ZIP= yes
+NO_WRKSUBDIR= yes
+
+pre-patch:
+.for FILE in compiler.h physcalc.h physconv.c physdecl.h physmain.c physmlib.c \
+ physnode.c physoper.c physsolv.c
+ @${MV} ${WRKSRC}/${FILE} ${WRKSRC}/${FILE}.sed
+ ${SED} -e 's, ,,g' ${WRKSRC}/${FILE}.sed > ${WRKSRC}/${FILE} ; ${RM} ${WRKSRC}/${FILE}.sed
+.endfor
+
+pre-build:
+ ${PERL} -pi -e "s@void main@int main@g" ${WRKSRC}/physmain.c
+ ${RM} -f ${WRKSRC}/physcalc
+
+do-build:
+ (cd ${WRKSRC} && ${CC} ${CFLAGS} -DSHAREDIR="\"${PREFIX}/share/physcalc/\"" -lm \
+ physmain.c physconv.c physmlib.c physnode.c physoper.c physsolv.c -o physcalc)
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/physcalc ${PREFIX}/bin
+ ${MKDIR} ${PREFIX}/share/physcalc
+ ${INSTALL_DATA} ${WRKSRC}/*.phy ${PREFIX}/share/physcalc
+
+.include <bsd.port.mk>
diff --git a/math/physcalc/distinfo b/math/physcalc/distinfo
new file mode 100644
index 000000000000..fb868e810aaa
--- /dev/null
+++ b/math/physcalc/distinfo
@@ -0,0 +1 @@
+MD5 (physcalc.zip) = 59b9e453259753d2e7aca43a27b715e5
diff --git a/math/physcalc/files/patch-aa b/math/physcalc/files/patch-aa
new file mode 100644
index 000000000000..96b25217a20d
--- /dev/null
+++ b/math/physcalc/files/patch-aa
@@ -0,0 +1,13 @@
+--- physcalc.h Sun Aug 27 17:46:31 2000
++++ physcalc.h.new Sun Aug 27 17:46:57 2000
+@@ -22,6 +22,10 @@
+ #error This program requires more memory than the tiny model allows!
+ #endif
+
++#ifndef SHAREDIR
++#define SHAREDIR "/usr/share/physcalc/"
++#endif
++
+ #define VERSION "2.4" /* Version number */
+ #define TRACE
+
diff --git a/math/physcalc/files/patch-ab b/math/physcalc/files/patch-ab
new file mode 100644
index 000000000000..ed9696eae996
--- /dev/null
+++ b/math/physcalc/files/patch-ab
@@ -0,0 +1,29 @@
+--- physconv.c Sun Aug 27 17:57:24 2000
++++ physconv.c.new Sun Aug 27 18:03:58 2000
+@@ -260,12 +260,16 @@
+ { /* read in lines from fp and do each as if typed from console */
+ FILE *fp;
+ char buf[SMALLBUF];
++ char *fullpath;
+ int oldecho;
+ #ifdef TRACE
+ int oldtrace;
+ #endif
+
+- if ((fp = fopen(s,"r"))==NULL) {
++ fullpath = malloc( strlen( SHAREDIR ) + strlen( s ) + 1 );
++ bcopy(SHAREDIR, fullpath, strlen(SHAREDIR));
++ (void) strcat(fullpath, s);
++ if ((fp = fopen(fullpath,"r"))==NULL) {
+ printf("Can't open %s\n",s);
+ return;
+ }
+@@ -797,7 +801,7 @@
+ } else {
+ showdims(&d);
+ printf("Convert to: ");
+- gets(buf);
++ fgets(buf, sizeof(buf), stdin);
+ trimspc(buf);
+ if (buf[0]=='?') {
+ showdims(&d);
diff --git a/math/physcalc/files/patch-ac b/math/physcalc/files/patch-ac
new file mode 100644
index 000000000000..46131c9eff22
--- /dev/null
+++ b/math/physcalc/files/patch-ac
@@ -0,0 +1,20 @@
+--- physmain.c Sun Aug 27 17:55:04 2000
++++ physmain.c.new Sun Aug 27 17:55:53 2000
+@@ -227,7 +227,7 @@
+ printf("Replace %s = ",v->name);
+ printexpr(v->value);
+ printf(" ?");
+- gets(answer);
++ fgets(answer, sizeof(answer), stdin);
+ printf("\n");
+ } else
+ answer[0] = 'Y';
+@@ -711,7 +711,7 @@
+ } else
+ while (TRUE) {
+ printf(">");
+- gets(buf);
++ fgets(buf, sizeof(buf), stdin);
+ do_cmd(buf);
+ }
+ }
diff --git a/math/physcalc/pkg-comment b/math/physcalc/pkg-comment
new file mode 100644
index 000000000000..cc720ae53b61
--- /dev/null
+++ b/math/physcalc/pkg-comment
@@ -0,0 +1 @@
+Extremely flexible calculator that behaves much like units(1)
diff --git a/math/physcalc/pkg-descr b/math/physcalc/pkg-descr
new file mode 100644
index 000000000000..9d7e7a054805
--- /dev/null
+++ b/math/physcalc/pkg-descr
@@ -0,0 +1,8 @@
+Physcalc is a neat mathematical calculator that does conversions
+from many different units in many forms, and is extremely flexible
+as far as specifying math problems go. You can also add your own
+types of conversions.
+
+WWW: http://www.lightlink.com/vulcan/physcalc.htm
+
+- Will <andrews@technologist.com>
diff --git a/math/physcalc/pkg-plist b/math/physcalc/pkg-plist
new file mode 100644
index 000000000000..f8740c42d526
--- /dev/null
+++ b/math/physcalc/pkg-plist
@@ -0,0 +1,11 @@
+bin/physcalc
+share/physcalc/astro.phy
+share/physcalc/bits.phy
+share/physcalc/british.phy
+share/physcalc/light.phy
+share/physcalc/math.phy
+share/physcalc/money.phy
+share/physcalc/nuclear.phy
+share/physcalc/paper.phy
+share/physcalc/physcalc.phy
+@dirrm share/physcalc