Update version to 2017.08.01 patcheso for clang
run examples as a test. ok bentley@
This commit is contained in:
parent
7e5ef5fc8d
commit
bfb126f0f4
@ -1,9 +1,8 @@
|
||||
# $OpenBSD: Makefile,v 1.5 2014/10/23 13:43:04 nigel Exp $
|
||||
# $OpenBSD: Makefile,v 1.6 2017/09/09 22:56:49 nigel Exp $
|
||||
|
||||
COMMENT = pic-like interpreter for producing line graphics
|
||||
|
||||
DISTNAME = dpic-2014.Jan.01
|
||||
PKGNAME = ${DISTNAME:S/Jan/01/}
|
||||
DISTNAME = dpic-2017.08.01
|
||||
|
||||
CATEGORIES = graphics
|
||||
|
||||
@ -13,18 +12,26 @@ HOMEPAGE = https://ece.uwaterloo.ca/~aplevich/dpic/
|
||||
PERMIT_PACKAGE_CDROM = Yes
|
||||
|
||||
WANTLIB += c m
|
||||
WRKDIST = ${WRKDIR}/dpic
|
||||
|
||||
ALL_TARGET = dpic
|
||||
|
||||
MASTER_SITES = ${HOMEPAGE}
|
||||
|
||||
|
||||
TEST_DEPENDS = print/texlive/base \
|
||||
print/texlive/texmf,-main
|
||||
|
||||
CONFIGURE_STYLE = gnu
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/dpic ${PREFIX}/bin
|
||||
${INSTALL_MAN} ${WRKSRC}/doc/dpic.1 ${PREFIX}/man/man1
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/dpic/
|
||||
cd ${WRKSRC}/examples/ && pax -rw * ${PREFIX}/share/examples/dpic/
|
||||
cd ${WRKSRC}/examples/ && \
|
||||
pax -rw sources Examples.txt Makefile README ${PREFIX}/share/examples/dpic/
|
||||
|
||||
NO_TEST = Yes
|
||||
do-test:
|
||||
cd ${WRKSRC}/examples/ && \
|
||||
make -e DPIC=${WRKSRC}/dpic all
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (dpic-2014.Jan.01.tar.gz) = Bb5z+hrYrkPonP4cDqkF0RtL5eezWcbn805Rpx6nv8U=
|
||||
SIZE (dpic-2014.Jan.01.tar.gz) = 584351
|
||||
SHA256 (dpic-2017.08.01.tar.gz) = 0GbWBx4BNqqJpYiiWAuMcFdKg29a7PbOFfRBbV923j0=
|
||||
SIZE (dpic-2017.08.01.tar.gz) = 1246842
|
||||
|
@ -1,15 +0,0 @@
|
||||
$OpenBSD: patch-Makefile,v 1.3 2014/10/23 13:43:05 nigel Exp $
|
||||
Honour CC and CFLAGS
|
||||
--- Makefile.orig Mon May 16 13:59:42 2011
|
||||
+++ Makefile Sun Mar 17 23:54:29 2013
|
||||
@@ -44,8 +44,8 @@ DEST = ${DESTDIR}/${PREFIX}/bin
|
||||
# CC=xlc
|
||||
|
||||
# other. cc usually works too.
|
||||
-CFLAGS += $(DEFINEA) $(DEFINEB) $(SAFEMODE) -O
|
||||
-CC=gcc
|
||||
+CFLAGS += $(DEFINEA) $(DEFINEB) $(SAFEMODE)
|
||||
+CC?=gcc
|
||||
# CC?=gcc
|
||||
|
||||
OBJECTS = dpic.o p2clib.o
|
27
graphics/dpic/patches/patch-Makefile_in
Normal file
27
graphics/dpic/patches/patch-Makefile_in
Normal file
@ -0,0 +1,27 @@
|
||||
$OpenBSD: patch-Makefile_in,v 1.1 2017/09/09 22:56:49 nigel Exp $
|
||||
Index: Makefile.in
|
||||
--- Makefile.in.orig
|
||||
+++ Makefile.in
|
||||
@@ -1,10 +1,9 @@
|
||||
# For Linux (expects "make DESTDIR=xxx PREFIX=yyy install"):
|
||||
DESTDIR = /usr
|
||||
-PREFIX = .
|
||||
-DEST = ${DESTDIR}/${PREFIX}/bin
|
||||
+DEST = ${PREFIX}/bin
|
||||
|
||||
-MANDIR = $(DESTDIR)/$(PREFIX)/share/man/man1
|
||||
-DOCDIR = $(DESTDIR)/$(PREFIX)/share/doc/dpic
|
||||
+MANDIR = $(PREFIX)/share/man/man1
|
||||
+DOCDIR = $(PREFIX)/share/doc/dpic
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
@@ -47,7 +46,7 @@ installdocs: doc/dpicdoc.pdf
|
||||
install -m 644 doc/dpicdoc.pdf $(DOCDIR)
|
||||
install -m 644 doc/dpictools.pic $(DOCDIR)
|
||||
# install -m 644 doc/dpic.1 $(SPECMANDIR)
|
||||
- cat doc/dpic.1 | gzip > $(MANDIR)/dpic.1.gz
|
||||
+ install -m 644 doc/dpic.1 $(MANDIR)
|
||||
#Ubuntu files:
|
||||
#/usr/bin/dpic
|
||||
#/usr/share/doc/dpic/CHANGES.gz
|
244
graphics/dpic/patches/patch-dpic_c
Normal file
244
graphics/dpic/patches/patch-dpic_c
Normal file
@ -0,0 +1,244 @@
|
||||
$OpenBSD: patch-dpic_c,v 1.1 2017/09/09 22:56:49 nigel Exp $
|
||||
Index: dpic.c
|
||||
--- dpic.c.orig
|
||||
+++ dpic.c
|
||||
@@ -1241,11 +1241,11 @@ void wfloat(FILE **iou, double y)
|
||||
{ char buf[25];
|
||||
int i;
|
||||
if (fabs(y)==distmax)
|
||||
- sprintf(buf,"%24.6e", y);
|
||||
+ snprintf(buf,sizeof(buf), "%24.6e", y);
|
||||
else if (y >= 0.0)
|
||||
- sprintf(buf,"%24.6f", floor( 1000000*y+0.5)/1000000.0 );
|
||||
+ snprintf(buf,sizeof(buf), "%24.6f", floor( 1000000*y+0.5)/1000000.0 );
|
||||
else
|
||||
- sprintf(buf,"%24.6f",-floor(-1000000*y+0.5)/1000000.0 );
|
||||
+ snprintf(buf,sizeof(buf), "%24.6f",-floor(-1000000*y+0.5)/1000000.0 );
|
||||
for (i=23; buf[i]=='0'; ) i-- ;
|
||||
if (buf[i]=='.') buf[i] = (char)0;
|
||||
else buf[i+1] = (char)0;
|
||||
@@ -1897,7 +1897,7 @@ boolean drawn(primitive *node, int linesp, double fill
|
||||
return true;
|
||||
}
|
||||
else if (linesp == XLdotted || linesp == XLdashed || linesp == XLsolid ||
|
||||
- fill >= 0.0 && fill <= 1.0) {
|
||||
+ (fill >= 0.0 && fill <= 1.0)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@@ -4793,7 +4793,7 @@ void mfpdraw(primitive *node)
|
||||
initnesw();
|
||||
nesw(node);
|
||||
if (node->ptype == XLbox) {
|
||||
- if (node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0 ||
|
||||
+ if ((node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0) ||
|
||||
node->shadedp != NULL) {
|
||||
mfpsetshade(node->Upr.Ubox.boxfill, node->shadedp);
|
||||
mfpbox(node->aat.xpos, node->aat.ypos, north, south, east, west,
|
||||
@@ -4812,7 +4812,7 @@ void mfpdraw(primitive *node)
|
||||
break;
|
||||
|
||||
case XLellipse:
|
||||
- if (node->Upr.Uellipse.efill >= 0.0 && node->Upr.Uellipse.efill <= 1.0 ||
|
||||
+ if ((node->Upr.Uellipse.efill >= 0.0 && node->Upr.Uellipse.efill <= 1.0) ||
|
||||
node->shadedp != NULL) {
|
||||
mfpsetshade(node->Upr.Uellipse.efill, node->shadedp);
|
||||
mfpellipse(node->aat, node->Upr.Uellipse.elwidth, node->Upr.Uellipse.elheight);
|
||||
@@ -4828,7 +4828,7 @@ void mfpdraw(primitive *node)
|
||||
break;
|
||||
|
||||
case XLcircle:
|
||||
- if (node->Upr.Ucircle.cfill >= 0.0 && node->Upr.Ucircle.cfill <= 1.0 ||
|
||||
+ if ((node->Upr.Ucircle.cfill >= 0.0 && node->Upr.Ucircle.cfill <= 1.0) ||
|
||||
node->shadedp != NULL) {
|
||||
mfpsetshade(node->Upr.Ucircle.cfill, node->shadedp);
|
||||
mfpcircle(node->aat, node->Upr.Ucircle.radius);
|
||||
@@ -5423,7 +5423,7 @@ void mpodraw(primitive *node)
|
||||
case XBLOCK:
|
||||
if (node->ptype == XLbox) {
|
||||
if (node->shadedp != NULL ||
|
||||
- node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0) {
|
||||
+ (node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0)) {
|
||||
mpobox("fill ", node->aat, node->Upr.Ubox.boxwidth / 2,
|
||||
node->Upr.Ubox.boxheight / 2, node->Upr.Ubox.boxradius);
|
||||
addcolor(node->shadedp, node->Upr.Ubox.boxfill);
|
||||
@@ -5442,7 +5442,7 @@ void mpodraw(primitive *node)
|
||||
|
||||
case XLellipse:
|
||||
if (node->shadedp != NULL ||
|
||||
- node->Upr.Uellipse.efill >= 0.0 && node->Upr.Uellipse.efill <= 1.0) {
|
||||
+ (node->Upr.Uellipse.efill >= 0.0 && node->Upr.Uellipse.efill <= 1.0)) {
|
||||
mpoellipse("fill ", node->aat, node->Upr.Uellipse.elwidth / 2,
|
||||
node->Upr.Uellipse.elheight / 2);
|
||||
addcolor(node->shadedp, node->Upr.Uellipse.efill);
|
||||
@@ -5460,7 +5460,7 @@ void mpodraw(primitive *node)
|
||||
|
||||
case XLcircle:
|
||||
if (node->shadedp != NULL ||
|
||||
- node->Upr.Ucircle.cfill >= 0.0 && node->Upr.Ucircle.cfill <= 1.0) {
|
||||
+ (node->Upr.Ucircle.cfill >= 0.0 && node->Upr.Ucircle.cfill <= 1.0)) {
|
||||
printf("fill fullcircle scaled ");
|
||||
wfloat(&output, node->Upr.Ucircle.radius * 2 / fsc);
|
||||
printf(" shifted ");
|
||||
@@ -6974,7 +6974,7 @@ void psdraw(primitive *node)
|
||||
switch (node->ptype) {
|
||||
|
||||
case XLbox:
|
||||
- if (node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0 ||
|
||||
+ if ((node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0) ||
|
||||
node->shadedp != NULL) {
|
||||
psbox(node->aat, node->Upr.Ubox.boxwidth / 2,
|
||||
node->Upr.Ubox.boxheight / 2, node->Upr.Ubox.boxradius);
|
||||
@@ -7027,7 +7027,7 @@ void psdraw(primitive *node)
|
||||
else {
|
||||
fill = node->Upr.Ucircle.cfill;
|
||||
}
|
||||
- if (fill >= 0.0 && fill <= 1.0 || node->shadedp != NULL) {
|
||||
+ if ((fill >= 0.0 && fill <= 1.0) || node->shadedp != NULL) {
|
||||
pssetthick(lth);
|
||||
printf(" gsave ");
|
||||
pswpos(node->aat);
|
||||
@@ -7416,7 +7416,7 @@ void pdfwfloat(double y)
|
||||
ix = ixd;
|
||||
} while (ix != 0 || j <= 6);
|
||||
for (j = 1; j <= ln; j++) {
|
||||
- sprintf(STR1, "%c", ts[ln - j]);
|
||||
+ snprintf(STR1, sizeof(STR1), "%c", ts[ln - j]);
|
||||
pdfstream(STR1, 1, &cx);
|
||||
}
|
||||
}
|
||||
@@ -7580,10 +7580,10 @@ void pdfwstring(nametype *p)
|
||||
iswhite = (c == etxch || c == nlch || c == tabch || c == ' ');
|
||||
if (!iswhite || !waswhite) {
|
||||
if (c == bslch || c == ')' || c == '(') {
|
||||
- sprintf(STR1, "%c", bslch);
|
||||
+ snprintf(STR1, sizeof(STR1), "%c", bslch);
|
||||
pdfstream(STR1, 1, &cx);
|
||||
}
|
||||
- sprintf(STR1, "%c", c);
|
||||
+ snprintf(STR1, sizeof(STR1), "%c", c);
|
||||
pdfstream(STR1, 1, &cx);
|
||||
}
|
||||
waswhite = iswhite;
|
||||
@@ -8020,7 +8020,7 @@ void pdfdraw(primitive *node)
|
||||
|
||||
case XLbox:
|
||||
if (drawn(node, lsp, node->Upr.Ubox.boxfill)) {
|
||||
- fll = (node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0 ||
|
||||
+ fll = ((node->Upr.Ubox.boxfill >= 0.0 && node->Upr.Ubox.boxfill <= 1.0) ||
|
||||
node->shadedp != NULL);
|
||||
pdflinearfill(node->Upr.Ubox.boxfill, node->shadedp);
|
||||
pdflineopts(lsp, node->lparam, lth, node->outlinep);
|
||||
@@ -8052,7 +8052,7 @@ void pdfdraw(primitive *node)
|
||||
fill = node->Upr.Ucircle.cfill;
|
||||
}
|
||||
if (drawn(node, lsp, fill)) {
|
||||
- fll = (fill >= 0.0 && fill <= 1.0 || node->shadedp != NULL);
|
||||
+ fll = ((fill >= 0.0 && fill <= 1.0) || node->shadedp != NULL);
|
||||
pdflinearfill(fill, node->shadedp);
|
||||
pdflineopts(lsp, node->lparam, lth, node->outlinep);
|
||||
pdfellipse(node->aat, x, y);
|
||||
@@ -8160,7 +8160,7 @@ void pdfdraw(primitive *node)
|
||||
pdfwpos(node->Upr.Uline.endpos);
|
||||
pdfstream(" l", 2, &cx);
|
||||
if (node->son != NULL) {
|
||||
- sprintf(STR1, "%c", nlch);
|
||||
+ snprintf(STR1, sizeof(STR1), "%c", nlch);
|
||||
pdfstream(STR1, 1, &cx);
|
||||
}
|
||||
else {
|
||||
@@ -8241,7 +8241,7 @@ void pdfdraw(primitive *node)
|
||||
case XLaTeX:
|
||||
if (node->textp != NULL) {
|
||||
pdfwstring(node->textp);
|
||||
- sprintf(STR1, "%c", nlch);
|
||||
+ snprintf(STR1, sizeof(STR1), "%c", nlch);
|
||||
pdfstream(STR1, 1, &cx);
|
||||
}
|
||||
break;
|
||||
@@ -8448,7 +8448,7 @@ void texdraw(primitive *node)
|
||||
lgth = linlen(node->Upr.Uline.endpos.xpos - node->aat.xpos,
|
||||
node->Upr.Uline.endpos.ypos - node->aat.ypos);
|
||||
if (drawmode == Pict2e ||
|
||||
- lsp == XLsolid && (lgth > 0.18 || drawmode == tTeX)) {
|
||||
+ (lsp == XLsolid && (lgth > 0.18 || drawmode == tTeX))) {
|
||||
if (lgth > 0) {
|
||||
printf("\\put");
|
||||
wpos(node->aat);
|
||||
@@ -8759,16 +8759,16 @@ void texdraw(primitive *node)
|
||||
node->direction = p->direction;
|
||||
}
|
||||
}
|
||||
- if (node->direction == XLleft && node->Upr.Uline.endpos.ypos < 0.0 ||
|
||||
- node->direction == XLdown && node->Upr.Uline.endpos.ypos > 0.0) {
|
||||
+ if ((node->direction == XLleft && node->Upr.Uline.endpos.ypos < 0.0) ||
|
||||
+ (node->direction == XLdown && node->Upr.Uline.endpos.ypos > 0.0)) {
|
||||
printf("[bl]}\n");
|
||||
}
|
||||
- else if (node->direction == XLleft && node->Upr.Uline.endpos.ypos > 0.0 ||
|
||||
- node->direction == XLup && node->Upr.Uline.endpos.ypos < 0.0) {
|
||||
+ else if ((node->direction == XLleft && node->Upr.Uline.endpos.ypos > 0.0) ||
|
||||
+ (node->direction == XLup && node->Upr.Uline.endpos.ypos < 0.0)) {
|
||||
printf("[tl]}\n");
|
||||
}
|
||||
- else if (node->direction == XLright && node->Upr.Uline.endpos.ypos < 0.0 ||
|
||||
- node->direction == XLup && node->Upr.Uline.endpos.ypos > 0.0) {
|
||||
+ else if ((node->direction == XLright && node->Upr.Uline.endpos.ypos < 0.0) ||
|
||||
+ (node->direction == XLup && node->Upr.Uline.endpos.ypos > 0.0)) {
|
||||
printf("[tr]}\n");
|
||||
}
|
||||
else {
|
||||
@@ -12552,8 +12552,8 @@ void produce(stackinx newp, int p)
|
||||
}
|
||||
else {
|
||||
With1->xval += With1->yval;
|
||||
- if (With1->yval > 0 && With1->xval > With1->endchop ||
|
||||
- With1->yval < 0 && With1->xval < With1->endchop) {
|
||||
+ if ((With1->yval > 0 && With1->xval > With1->endchop) ||
|
||||
+ (With1->yval < 0 && With1->xval < With1->endchop)) {
|
||||
bswitch = true;
|
||||
}
|
||||
}
|
||||
@@ -13464,16 +13464,16 @@ void produce(stackinx newp, int p)
|
||||
s = sin(With2->Upr.Uline.endpos.xpos);
|
||||
With2->aat.xpos += With2->Upr.Uline.aradius * r;
|
||||
With2->aat.ypos += With2->Upr.Uline.aradius * s;
|
||||
- if (With2->direction == XLup && i == XLleft ||
|
||||
- With2->direction == XLdown && i == XLright ||
|
||||
- With2->direction == XLright && i == XLup ||
|
||||
- With2->direction == XLleft && i == XLdown) {
|
||||
+ if ((With2->direction == XLup && i == XLleft) ||
|
||||
+ (With2->direction == XLdown && i == XLright) ||
|
||||
+ (With2->direction == XLright && i == XLup) ||
|
||||
+ (With2->direction == XLleft && i == XLdown)) {
|
||||
With2->Upr.Uline.endpos.ypos = pi * 0.5;
|
||||
}
|
||||
- else if (With2->direction == XLup && i == XLright ||
|
||||
- With2->direction == XLdown && i == XLleft ||
|
||||
- With2->direction == XLright && i == XLdown ||
|
||||
- With2->direction == XLleft && i == XLup) {
|
||||
+ else if ((With2->direction == XLup && i == XLright) ||
|
||||
+ (With2->direction == XLdown && i == XLleft) ||
|
||||
+ (With2->direction == XLright && i == XLdown) ||
|
||||
+ (With2->direction == XLleft && i == XLup)) {
|
||||
With2->Upr.Uline.endpos.ypos = -pi * 0.5;
|
||||
}
|
||||
if (attstack[newp+2].lexval != XEMPTY) {
|
||||
@@ -17640,7 +17640,7 @@ void defineargbody(int *parenlevel, fbuffer **p2)
|
||||
}
|
||||
}
|
||||
/*D if debuglevel=2 then write(log,' instring=',instring,' '); D*/
|
||||
- if (!instring && (*parenlevel < 0 || *parenlevel == 0 && ch == ',')) {
|
||||
+ if (!instring && (*parenlevel < 0 || (*parenlevel == 0 && ch == ','))) {
|
||||
j = With->savedlen;
|
||||
inarg = false;
|
||||
}
|
||||
@@ -18743,7 +18743,7 @@ void getoptions(void)
|
||||
} /* getoptions */
|
||||
|
||||
|
||||
-void main(int argc, Char *argv[])
|
||||
+int main(int argc, Char *argv[])
|
||||
{ P_argc = argc; P_argv = argv; __top_jb = NULL;
|
||||
redirect = NULL;
|
||||
copyin = NULL;
|
18
graphics/dpic/patches/patch-p2c_h
Normal file
18
graphics/dpic/patches/patch-p2c_h
Normal file
@ -0,0 +1,18 @@
|
||||
$OpenBSD: patch-p2c_h,v 1.1 2017/09/09 22:56:49 nigel Exp $
|
||||
Index: p2c.h
|
||||
--- p2c.h.orig
|
||||
+++ p2c.h
|
||||
@@ -435,12 +435,7 @@ typedef struct {
|
||||
} _TEXT;
|
||||
|
||||
/* Memory allocation */
|
||||
-#ifdef __GCC__
|
||||
-# define Malloc(n) (malloc(n) ?: (Anyptr)_OutMem())
|
||||
-#else
|
||||
-extern Anyptr __MallocTemp__;
|
||||
-# define Malloc(n) ((__MallocTemp__ = malloc(n)) ? __MallocTemp__ : (Anyptr)_OutMem())
|
||||
-#endif
|
||||
+extern void *Malloc(size_t);
|
||||
#define FreeR(p) (free((Anyptr)(p))) /* used if arg is an rvalue */
|
||||
#define Free(p) (free((Anyptr)(p)), (p)=NULL)
|
||||
|
208
graphics/dpic/patches/patch-p2clib_c
Normal file
208
graphics/dpic/patches/patch-p2clib_c
Normal file
@ -0,0 +1,208 @@
|
||||
$OpenBSD: patch-p2clib_c,v 1.1 2017/09/09 22:56:49 nigel Exp $
|
||||
Index: p2clib.c
|
||||
--- p2clib.c.orig
|
||||
+++ p2clib.c
|
||||
@@ -30,8 +30,6 @@ int P_ioresult;
|
||||
|
||||
long EXCP_LINE; /* Used by Pascal workstation system */
|
||||
|
||||
-Anyptr __MallocTemp__;
|
||||
-
|
||||
__p2c_jmp_buf *__top_jb;
|
||||
|
||||
|
||||
@@ -417,9 +415,10 @@ register int pos, len;
|
||||
|
||||
/* Insert string "src" at index "pos" of "dst". */
|
||||
|
||||
-void strinsert(src, dst, pos)
|
||||
+void strinsert(src, dst, pos, size)
|
||||
register char *src, *dst;
|
||||
register int pos;
|
||||
+size_t size;
|
||||
{
|
||||
register int slen, dlen;
|
||||
|
||||
@@ -429,7 +428,7 @@ register int pos;
|
||||
dst += dlen;
|
||||
dlen -= pos;
|
||||
if (dlen <= 0) {
|
||||
- strcpy(dst, src);
|
||||
+ strlcpy(dst, src, size);
|
||||
return;
|
||||
}
|
||||
slen = strlen(src);
|
||||
@@ -890,7 +889,7 @@ int *Day, *Month, *Year, *Hour, *Min, *Sec;
|
||||
{
|
||||
#ifndef NO_TIME
|
||||
struct tm *tm;
|
||||
- long clock;
|
||||
+ time_t clock;
|
||||
|
||||
time(&clock);
|
||||
tm = localtime(&clock);
|
||||
@@ -908,7 +907,7 @@ int *Day, *Month, *Year, *Hour, *Min, *Sec;
|
||||
Void VAXdate(s)
|
||||
char *s;
|
||||
{
|
||||
- long clock;
|
||||
+ time_t clock;
|
||||
char *c;
|
||||
int i;
|
||||
static int where[] = {8, 9, 0, 4, 5, 6, 0, 20, 21, 22, 23};
|
||||
@@ -924,7 +923,7 @@ char *s;
|
||||
Void VAXtime(s)
|
||||
char *s;
|
||||
{
|
||||
- long clock;
|
||||
+ time_t clock;
|
||||
char *c;
|
||||
int i;
|
||||
|
||||
@@ -959,7 +958,14 @@ register int len, n;
|
||||
}
|
||||
|
||||
|
||||
+void *Malloc(size_t size) {
|
||||
+ void *p;
|
||||
|
||||
+ if ( (p = malloc(size)) )
|
||||
+ return p;
|
||||
+ _OutMem();
|
||||
+ return p;
|
||||
+}
|
||||
|
||||
/* if defined(__GNUC__) || defined(HAVE_INTTYPES_H) */
|
||||
#ifndef NO_INTTYPES_H
|
||||
@@ -985,85 +991,87 @@ int _NilCheck()
|
||||
/* The following is suitable for the HP Pascal operating system.
|
||||
It might want to be revised when emulating another system. */
|
||||
|
||||
-char *_ShowEscape(buf, code, ior, prefix)
|
||||
+char *_ShowEscape(buf, code, ior, prefix, size)
|
||||
char *buf, *prefix;
|
||||
-int code, ior;
|
||||
+int code, ior, size;
|
||||
{
|
||||
char *bufp;
|
||||
+ int sizep;
|
||||
|
||||
if (prefix && *prefix) {
|
||||
- strcpy(buf, prefix);
|
||||
- strcat(buf, ": ");
|
||||
+ strlcpy(buf, prefix, size);
|
||||
+ strlcat(buf, ": ", size);
|
||||
bufp = buf + strlen(buf);
|
||||
} else {
|
||||
bufp = buf;
|
||||
}
|
||||
+ sizep = size - strlen(buf);
|
||||
if (code == -10) {
|
||||
- sprintf(bufp, "Pascal system I/O error %d", ior);
|
||||
+ snprintf(bufp, sizep, "Pascal system I/O error %d", ior);
|
||||
switch (ior) {
|
||||
case 3:
|
||||
- strcat(buf, " (illegal I/O request)");
|
||||
+ strlcat(buf, " (illegal I/O request)", size);
|
||||
break;
|
||||
case 7:
|
||||
- strcat(buf, " (bad file name)");
|
||||
+ strlcat(buf, " (bad file name)", size);
|
||||
break;
|
||||
case FileNotFound: /*10*/
|
||||
- strcat(buf, " (file not found)");
|
||||
+ strlcat(buf, " (file not found)", size);
|
||||
break;
|
||||
case FileNotOpen: /*13*/
|
||||
- strcat(buf, " (file not open)");
|
||||
+ strlcat(buf, " (file not open)", size);
|
||||
break;
|
||||
case BadInputFormat: /*14*/
|
||||
- strcat(buf, " (bad input format)");
|
||||
+ strlcat(buf, " (bad input format)", size);
|
||||
break;
|
||||
case 24:
|
||||
- strcat(buf, " (not open for reading)");
|
||||
+ strlcat(buf, " (not open for reading)", size);
|
||||
break;
|
||||
case 25:
|
||||
- strcat(buf, " (not open for writing)");
|
||||
+ strlcat(buf, " (not open for writing)", size);
|
||||
break;
|
||||
case 26:
|
||||
- strcat(buf, " (not open for direct access)");
|
||||
+ strlcat(buf, " (not open for direct access)", size);
|
||||
break;
|
||||
case 28:
|
||||
- strcat(buf, " (string subscript out of range)");
|
||||
+ strlcat(buf, " (string subscript out of range)", size);
|
||||
break;
|
||||
case EndOfFile: /*30*/
|
||||
- strcat(buf, " (end-of-file)");
|
||||
+ strlcat(buf, " (end-of-file)", size);
|
||||
break;
|
||||
case FileWriteError: /*38*/
|
||||
- strcat(buf, " (file write error)");
|
||||
+ strlcat(buf, " (file write error)", size);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
- sprintf(bufp, "Pascal system error %d", code);
|
||||
+ snprintf(bufp, sizep, "Pascal system error %d", code);
|
||||
switch (code) {
|
||||
case -2:
|
||||
- strcat(buf, " (out of memory)");
|
||||
+ strlcat(buf, " (out of memory)", size);
|
||||
break;
|
||||
case -3:
|
||||
- strcat(buf, " (reference to NIL pointer)");
|
||||
+ strlcat(buf, " (reference to NIL pointer)", size);
|
||||
break;
|
||||
case -4:
|
||||
- strcat(buf, " (integer overflow)");
|
||||
+ strlcat(buf, " (integer overflow)", size);
|
||||
break;
|
||||
case -5:
|
||||
- strcat(buf, " (divide by zero)");
|
||||
+ strlcat(buf, " (divide by zero)", size);
|
||||
break;
|
||||
case -6:
|
||||
- strcat(buf, " (real math overflow)");
|
||||
+ strlcat(buf, " (real math overflow)", size);
|
||||
break;
|
||||
case -8:
|
||||
- strcat(buf, " (value range error)");
|
||||
+ strlcat(buf, " (value range error)", size);
|
||||
break;
|
||||
case -9:
|
||||
- strcat(buf, " (CASE value range error)");
|
||||
+ strlcat(buf, " (CASE value range error)", size);
|
||||
break;
|
||||
case -12:
|
||||
- strcat(buf, " (bus error)");
|
||||
+ strlcat(buf, " (bus error)", size);
|
||||
break;
|
||||
case -20:
|
||||
- strcat(buf, " (stopped by user)");
|
||||
+ strlcat(buf, " (stopped by user)", size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1086,7 +1094,7 @@ int code;
|
||||
exit(EXIT_SUCCESS);
|
||||
if (code == -1)
|
||||
exit(EXIT_FAILURE);
|
||||
- fprintf(stderr, "%s\n", _ShowEscape(buf, P_escapecode, P_ioresult, ""));
|
||||
+ fprintf(stderr, "%s\n", _ShowEscape(buf, P_escapecode, P_ioresult, "", sizeof(buf)));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -1105,7 +1113,7 @@ char *name;
|
||||
if (!__top_jb && name && *name) {
|
||||
char buf[100];
|
||||
fprintf(stderr, "%s: %s\n",
|
||||
- name, _ShowEscape(buf, P_escapecode, P_ioresult, ""));
|
||||
+ name, _ShowEscape(buf, P_escapecode, P_ioresult, "", sizeof(buf)));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return _Escape(-10);
|
@ -1,4 +1,4 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/05/15 18:49:41 landry Exp $
|
||||
@comment $OpenBSD: PLIST,v 1.2 2017/09/09 22:56:49 nigel Exp $
|
||||
@bin bin/dpic
|
||||
@man man/man1/dpic.1
|
||||
share/examples/dpic/
|
||||
@ -6,6 +6,10 @@ share/examples/dpic/Examples.txt
|
||||
share/examples/dpic/Makefile
|
||||
share/examples/dpic/README
|
||||
share/examples/dpic/sources/
|
||||
share/examples/dpic/sources/arcs.pic
|
||||
share/examples/dpic/sources/arrowheads.pic
|
||||
share/examples/dpic/sources/arrows.pic
|
||||
share/examples/dpic/sources/basictests.pic
|
||||
share/examples/dpic/sources/diag1.pic
|
||||
share/examples/dpic/sources/diag2.pic
|
||||
share/examples/dpic/sources/diag3.pic
|
||||
@ -15,6 +19,46 @@ share/examples/dpic/sources/diag8.pic
|
||||
share/examples/dpic/sources/diag9.pic
|
||||
share/examples/dpic/sources/diagA.pic
|
||||
share/examples/dpic/sources/diagB.pic
|
||||
share/examples/dpic/sources/diagC.pic
|
||||
share/examples/dpic/sources/man.tex
|
||||
share/examples/dpic/sources/man01.pic
|
||||
share/examples/dpic/sources/man02.pic
|
||||
share/examples/dpic/sources/man03.pic
|
||||
share/examples/dpic/sources/man04.pic
|
||||
share/examples/dpic/sources/man05.pic
|
||||
share/examples/dpic/sources/man06.pic
|
||||
share/examples/dpic/sources/man07.pic
|
||||
share/examples/dpic/sources/man08.pic
|
||||
share/examples/dpic/sources/man09.pic
|
||||
share/examples/dpic/sources/man10.pic
|
||||
share/examples/dpic/sources/man11.pic
|
||||
share/examples/dpic/sources/man12.pic
|
||||
share/examples/dpic/sources/man13.pic
|
||||
share/examples/dpic/sources/man14.pic
|
||||
share/examples/dpic/sources/man15.pic
|
||||
share/examples/dpic/sources/man16.pic
|
||||
share/examples/dpic/sources/man17.pic
|
||||
share/examples/dpic/sources/man18.pic
|
||||
share/examples/dpic/sources/man19.pic
|
||||
share/examples/dpic/sources/man20.pic
|
||||
share/examples/dpic/sources/man21.pic
|
||||
share/examples/dpic/sources/man22.pic
|
||||
share/examples/dpic/sources/man24.pic
|
||||
share/examples/dpic/sources/man25.pic
|
||||
share/examples/dpic/sources/man26.pic
|
||||
share/examples/dpic/sources/man28.pic
|
||||
share/examples/dpic/sources/man29.pic
|
||||
share/examples/dpic/sources/man30.pic
|
||||
share/examples/dpic/sources/man31.pic
|
||||
share/examples/dpic/sources/man32.pic
|
||||
share/examples/dpic/sources/man33.pic
|
||||
share/examples/dpic/sources/man34.pic
|
||||
share/examples/dpic/sources/man35.pic
|
||||
share/examples/dpic/sources/man36.pic
|
||||
share/examples/dpic/sources/man45.pic
|
||||
share/examples/dpic/sources/man46.pic
|
||||
share/examples/dpic/sources/man47.pic
|
||||
share/examples/dpic/sources/mode.tex
|
||||
share/examples/dpic/sources/test1.tex
|
||||
share/examples/dpic/sources/test2.tex
|
||||
share/examples/dpic/sources/test3.tex
|
||||
|
Loading…
Reference in New Issue
Block a user