1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-30 21:49:25 +00:00
freebsd-ports/math/physcalc/files/patch-ab
Will Andrews 76a432dd93 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>
2000-08-27 23:32:03 +00:00

30 lines
748 B
Plaintext

--- 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);