opnsense-ports/math/physcalc/files/patch-physconv.c
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

29 lines
774 B
C

--- physconv.c.orig 1998-08-30 15:58:16.000000000 -0500
+++ physconv.c 2009-06-25 22:22:21.000000000 -0500
@@ -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 = calloc( strlen( SHAREDIR ) + strlen( s ) + 1, 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);