Patch maple script to resolve DISPLAY manually.

Work-around for a maple-linux/linux emulation bug that was diagnosed
by Remi Card on FreeBSD.
This commit is contained in:
espie 1999-06-18 15:32:16 +00:00
parent 8502fb5c30
commit b0b9b22bb5
4 changed files with 78 additions and 3 deletions

View File

@ -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 <bsd.port.mk>

View File

@ -0,0 +1,57 @@
/* $OpenBSD: resolv_display.c,v 1.1 1999/06/18 15:32:17 espie Exp $ */
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
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);
}
}

View File

@ -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"

View File

@ -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