From b0b9b22bb57ccc33f80f121e47c47b0a64a3010a Mon Sep 17 00:00:00 2001 From: espie Date: Fri, 18 Jun 1999 15:32:16 +0000 Subject: [PATCH] Patch maple script to resolve DISPLAY manually. Work-around for a maple-linux/linux emulation bug that was diagnosed by Remi Card on FreeBSD. --- math/maple/Makefile | 13 +++++-- math/maple/files/resolv_display.c | 57 +++++++++++++++++++++++++++++++ math/maple/patches/patch-ab | 10 ++++++ math/maple/pkg/PLIST | 1 + 4 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 math/maple/files/resolv_display.c create mode 100644 math/maple/patches/patch-ab diff --git a/math/maple/Makefile b/math/maple/Makefile index cca43f57fb7..aeb56cd48c3 100644 --- a/math/maple/Makefile +++ b/math/maple/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1.1.1 1999/05/22 00:24:58 espie Exp $ +# $OpenBSD: Makefile,v 1.2 1999/06/18 15:32:16 espie Exp $ # Original from: Marc Espie # XXX This port installs in a somewhat unusual way. @@ -19,9 +19,9 @@ MIRROR_DISTFILE= no MAINTAINER= espie@cvs.openbsd.org +NO_WRKSUBDIR= yes NO_PATCH= yes NO_CONFIGURE= yes -NO_BUILD= yes NO_PACKAGE= yes # verify that it makes sense to install maple here @@ -38,6 +38,12 @@ install_bins/bin_ibm_intel_linux.tar # better than NO_EXTRACT, as this builds WRKDIR correctly for us. EXTRACT_ONLY= +post-extract: + ln -sf ${FILESDIR}/resolv_display.c ${WRKSRC} + echo "all: resolv_display" >${WRKSRC}/Makefile + +ALL_TARGET=resolv_display + do-fetch: @mkdir -p ${_DISTDIR} @cd ${CDROM}; \ @@ -66,7 +72,8 @@ do-install: @for file in ${MAPLE_DIR}/man/man1/*; do \ ln -s $$file ${PREFIX}/man/man1; \ done - @cd ${MAPLE_DIR} && patch -s <${PATCHDIR}/patch-aa && \ + @cd ${MAPLE_DIR} && cat ${PATCHDIR}/patch-*| patch -s && \ rm ${MAPLE_DIR}/bin/*.orig + @${INSTALL_PROGRAM} ${WRKBUILD}/resolv_display ${MAPLE_DIR}/bin .include diff --git a/math/maple/files/resolv_display.c b/math/maple/files/resolv_display.c new file mode 100644 index 00000000000..237d6df282a --- /dev/null +++ b/math/maple/files/resolv_display.c @@ -0,0 +1,57 @@ +/* $OpenBSD: resolv_display.c,v 1.1 1999/06/18 15:32:17 espie Exp $ */ + +#include +#include +#include +#include +#include +#include + +extern int h_errno; + +int main(int argc, char *argv[]) + { + struct hostent *ent; + char *end; + char *name; + + if (argc < 2) + exit(EXIT_FAILURE); + + name = strdup(argv[1]); + + end = strchr(name, ':'); + if (end == name) + { + puts(end); + exit(EXIT_SUCCESS); + } + if (end) + *end = 0; + + ent = gethostbyname(name); + if (!ent) + { + herror("maple"); + exit(EXIT_FAILURE); + } + + if (end) + *end = ':'; + else + end = ""; + switch(ent->h_addrtype) + { + case AF_INET: + if (ent->h_length == 4) + { + unsigned char *addr = ent->h_addr; + + printf("%u.%u.%u.%u%s\n", addr[0], addr[1], addr[2], addr[3], end); + exit(EXIT_SUCCESS); + } + default: + fprintf(stderr, "maple: unsupported address type %d\n", ent->h_addrtype); + exit(EXIT_FAILURE); + } + } diff --git a/math/maple/patches/patch-ab b/math/maple/patches/patch-ab new file mode 100644 index 00000000000..45bceadf4c7 --- /dev/null +++ b/math/maple/patches/patch-ab @@ -0,0 +1,10 @@ +--- bin/maple.orig Fri Jun 18 15:35:36 1999 ++++ bin/maple Fri Jun 18 15:36:35 1999 +@@ -93,6 +93,7 @@ + ;; + -x) + XMAPLE=1 ++ DISPLAY=`$MAPLE/bin/resolv_display $DISPLAY` + ;; + -single) + IPARAM="-km s" diff --git a/math/maple/pkg/PLIST b/math/maple/pkg/PLIST index 464629529ac..50658d88392 100644 --- a/math/maple/pkg/PLIST +++ b/math/maple/pkg/PLIST @@ -27,6 +27,7 @@ maple/bin/maple maple/bin/maple.system.type maple/bin/march maple/bin/mint +maple/bin/resolv_display maple/bin/updt3to4 maple/bin/updtsrc maple/bin/xmaple