From be7dc685fb16b850cb86f7ecbeca1675f5611ddc Mon Sep 17 00:00:00 2001 From: bouyer Date: Sat, 12 Jan 2002 18:34:56 +0000 Subject: Initial import of Xtel, a Minitel emulator. Probably not of much use outside France :) --- comms/xtel/DESCR | 4 + comms/xtel/MESSAGE | 8 ++ comms/xtel/Makefile | 17 +++ comms/xtel/PLIST | 37 +++++++ comms/xtel/distinfo | 11 ++ comms/xtel/patches/patch-aa | 15 +++ comms/xtel/patches/patch-ab | 31 ++++++ comms/xtel/patches/patch-ac | 15 +++ comms/xtel/patches/patch-ad | 15 +++ comms/xtel/patches/patch-ae | 41 +++++++ comms/xtel/patches/patch-af | 255 ++++++++++++++++++++++++++++++++++++++++++++ comms/xtel/patches/patch-ag | 62 +++++++++++ 12 files changed, 511 insertions(+) create mode 100644 comms/xtel/DESCR create mode 100644 comms/xtel/MESSAGE create mode 100644 comms/xtel/Makefile create mode 100644 comms/xtel/PLIST create mode 100644 comms/xtel/distinfo create mode 100644 comms/xtel/patches/patch-aa create mode 100644 comms/xtel/patches/patch-ab create mode 100644 comms/xtel/patches/patch-ac create mode 100644 comms/xtel/patches/patch-ad create mode 100644 comms/xtel/patches/patch-ae create mode 100644 comms/xtel/patches/patch-af create mode 100644 comms/xtel/patches/patch-ag diff --git a/comms/xtel/DESCR b/comms/xtel/DESCR new file mode 100644 index 00000000000..890d888c39f --- /dev/null +++ b/comms/xtel/DESCR @@ -0,0 +1,4 @@ +XTEL can emulate a Minitel 1B, 2, TVR and Iminitel on a X display. It is +networked, that is, a server drives the MODEM connected to Teletel services, +and clients talk with the server via TCP/IP. Local usage is also possible, +client and server runs on the same machine. diff --git a/comms/xtel/MESSAGE b/comms/xtel/MESSAGE new file mode 100644 index 00000000000..b03e21b62f1 --- /dev/null +++ b/comms/xtel/MESSAGE @@ -0,0 +1,8 @@ +Make sure there is a symbolic link from your modem device to /dev/modem. +You may also have to adjust $X11BASE}/lib/X11/xtel/xtel.lignes for your +modem. +You also have to add: +xtel 1313/tcp +to /etc/services and +xtel stream tcp nowait root $X11BASE}/bin/xteld xteld +to /etc/inetd.conf diff --git a/comms/xtel/Makefile b/comms/xtel/Makefile new file mode 100644 index 00000000000..d9b5c3a7998 --- /dev/null +++ b/comms/xtel/Makefile @@ -0,0 +1,17 @@ +# $NetBSD: Makefile,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ +# + +DISTNAME= xtel-3.3.0 +CATEGORIES= comms x11 +MASTER_SITES= http://pficheux.free.fr/xtel/download/ + +MAINTAINER= bouyer@netbsd.org +HOMEPAGE= http://pficheux.free.fr/xtel/ +COMMENT= Minitel(r) emulator + +USE_BUILDLINK_ONLY= YES +USE_IMAKE= YES + +.include "../../graphics/jpeg/buildlink.mk" +.include "../../mk/x11.buildlink.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/comms/xtel/PLIST b/comms/xtel/PLIST new file mode 100644 index 00000000000..a5d832ce052 --- /dev/null +++ b/comms/xtel/PLIST @@ -0,0 +1,37 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ +bin/install_iminitel +bin/make_xtel_lignes +bin/mdmdetect +bin/xtel +bin/xteld +lib/X11/xtel/xtel.lignes +lib/X11/xtel/xtel.services +lib/X11/xtel/modem.list +lib/X11/xtel/connect_iminitel +lib/X11/app-defaults/XTel +lib/X11/app-defaults/XTel-msg +lib/X11/fonts/xtel/g08x10.pcf.gz +lib/X11/fonts/xtel/g08x20.pcf.gz +lib/X11/fonts/xtel/g016x10.pcf.gz +lib/X11/fonts/xtel/g016x20.pcf.gz +lib/X11/fonts/xtel/g032x20.pcf.gz +lib/X11/fonts/xtel/g016x40.pcf.gz +lib/X11/fonts/xtel/g032x40.pcf.gz +lib/X11/fonts/xtel/g18x10.pcf.gz +lib/X11/fonts/xtel/g116x20.pcf.gz +lib/X11/fonts/xtel/g1s8x10.pcf.gz +lib/X11/fonts/xtel/g1s16x20.pcf.gz +lib/X11/fonts/xtel/g0s8x10.pcf.gz +lib/X11/fonts/xtel/g0s8x20.pcf.gz +lib/X11/fonts/xtel/g0s16x10.pcf.gz +lib/X11/fonts/xtel/g0s16x20.pcf.gz +lib/X11/fonts/xtel/g0s32x20.pcf.gz +lib/X11/fonts/xtel/g0s16x40.pcf.gz +lib/X11/fonts/xtel/g0s32x40.pcf.gz +lib/X11/fonts/xtel/xteldigit.pcf.gz +lib/X11/fonts/xtel/fonts.dir +lib/X11/fonts/xtel/fonts.alias +man/cat1/xtel.0 +man/cat1/xteld.0 +@dirrm lib/X11/xtel +@dirrm lib/X11/fonts/xtel diff --git a/comms/xtel/distinfo b/comms/xtel/distinfo new file mode 100644 index 00000000000..f87ef378d6f --- /dev/null +++ b/comms/xtel/distinfo @@ -0,0 +1,11 @@ +$NetBSD: distinfo,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +SHA1 (xtel-3.3.0.tar.gz) = 7ee5a5afa20bea46e08c346605c53cdd32d69dc9 +Size (xtel-3.3.0.tar.gz) = 309426 bytes +SHA1 (patch-aa) = 0999c576cfc6ce74b66a12735fe3b4ef98dcabe4 +SHA1 (patch-ab) = 28e8c26a36de294e3982a4f4edac53e4780ec2fe +SHA1 (patch-ac) = 24f9725a2636f3719ec53f14c490af47e834b4fa +SHA1 (patch-ad) = 59a8a6e2da9ecc4c954853f8d2edc47723408a4d +SHA1 (patch-ae) = 9532510a0f93b23ad85b84932c53e8644a6dd36a +SHA1 (patch-af) = c52f5b39da50c350ac3ce929b3f77eafdce4942c +SHA1 (patch-ag) = 6addd47ca368ed78011162b0b843124329909fc1 diff --git a/comms/xtel/patches/patch-aa b/comms/xtel/patches/patch-aa new file mode 100644 index 00000000000..dccd1f123e4 --- /dev/null +++ b/comms/xtel/patches/patch-aa @@ -0,0 +1,15 @@ +$NetBSD: patch-aa,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +--- Xsra/SelFile.c.orig Sat Jan 12 17:52:02 2002 ++++ Xsra/SelFile.c Sat Jan 12 17:52:18 2002 +@@ -48,8 +48,10 @@ + extern int errno; + extern int sys_nerr; + #ifndef __FreeBSD__ ++#ifndef __NetBSD__ + #ifndef __GLIBC__ + extern char *sys_errlist[]; ++#endif + #endif + #endif + diff --git a/comms/xtel/patches/patch-ab b/comms/xtel/patches/patch-ab new file mode 100644 index 00000000000..628ce8a1be8 --- /dev/null +++ b/comms/xtel/patches/patch-ab @@ -0,0 +1,31 @@ +$NetBSD: patch-ab,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +--- Imakefile.orig Mon Feb 12 17:33:01 2001 ++++ Imakefile Sat Jan 12 18:28:55 2002 +@@ -26,7 +26,7 @@ + #ifdef NO_TERMIO + TERMIOCFLAGS = -DNO_TERMIO + #else +-#if defined(USE_TERMIOS) || defined(__FreeBSD__) ++#if defined(USE_TERMIOS) || defined(__FreeBSD__) || defined (NetBSDArchitecture) + TERMIOCFLAGS = -DUSE_TERMIOS + #endif + #endif +@@ -71,7 +71,7 @@ + #ifdef NO_TVR + TVRCFLAGS= -DNO_TVR + #else +- JPEGLIB= -ljpeg ++ JPEGLIB= -L${LOCALBASE}/lib -Wl,-R${LOCALBASE}/lib -ljpeg + #endif + + #ifdef WINDAUBE +@@ -103,7 +103,7 @@ + + TELE_DEFINES = '-DXTERM_PATH="$(BINDIR)/xterm"' + +-XTELD_DEFINES = '-DFICHIER_LOG="$(LIBDIR)/xtel/xtel.log"' \ ++XTELD_DEFINES = '-DFICHIER_LOG="/var/log/xtel.log"' \ + '-DXTEL_LIBDIR="$(LIBDIR)/xtel"' + + diff --git a/comms/xtel/patches/patch-ac b/comms/xtel/patches/patch-ac new file mode 100644 index 00000000000..16d8d6bf850 --- /dev/null +++ b/comms/xtel/patches/patch-ac @@ -0,0 +1,15 @@ +$NetBSD: patch-ac,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +--- global.h.orig Sat Jan 12 17:55:27 2002 ++++ global.h Sat Jan 12 17:55:44 2002 +@@ -204,8 +204,10 @@ + * Variables + */ + #ifndef __FreeBSD__ ++#ifndef __NetBSD__ + #ifndef __GLIBC__ + extern char *sys_errlist[]; ++#endif + #endif + #endif + diff --git a/comms/xtel/patches/patch-ad b/comms/xtel/patches/patch-ad new file mode 100644 index 00000000000..8a72c331f7c --- /dev/null +++ b/comms/xtel/patches/patch-ad @@ -0,0 +1,15 @@ +$NetBSD: patch-ad,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +--- globald.h.orig Sat Jan 12 17:56:25 2002 ++++ globald.h Sat Jan 12 17:56:50 2002 +@@ -34,8 +34,10 @@ + * Variables + */ + #ifndef __FreeBSD__ ++#ifndef __NetBSD__ + #ifndef __GLIBC__ + extern char *sys_errlist[]; ++#endif + #endif + #endif + diff --git a/comms/xtel/patches/patch-ae b/comms/xtel/patches/patch-ae new file mode 100644 index 00000000000..2de56a70524 --- /dev/null +++ b/comms/xtel/patches/patch-ae @@ -0,0 +1,41 @@ +$NetBSD: patch-ae,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +--- mdmdetect.c.orig Sat Jan 12 17:57:18 2002 ++++ mdmdetect.c Sat Jan 12 17:59:39 2002 +@@ -37,7 +37,11 @@ + #include + #include + #include ++#ifdef USE_TERMIOS ++#include ++#else + #include ++#endif + #ifdef SVR4 + #include + #endif /* SVR4 */ +@@ -45,10 +49,12 @@ + #define TIMEOUT_READ 5 + + #ifndef __FreeBSD__ ++#ifndef __NetBSD__ + #ifndef __GLIBC__ + extern char *sys_errlist[]; + #endif + #endif ++#endif + extern char *xtel_basename (), *next_token (); + + static int fdl; +@@ -290,7 +296,11 @@ + check_and_lock (cp); + + sprintf (buf, "/dev/%s", cp); ++#ifdef __NetBSD ++ if ((fd = open (buf, O_RDWR)) < 0) { ++#else + if ((fd = open (buf, O_RDWR|O_NDELAY)) < 0) { ++#endif + perror (buf); + exit (1); + } diff --git a/comms/xtel/patches/patch-af b/comms/xtel/patches/patch-af new file mode 100644 index 00000000000..c4b24aa5a23 --- /dev/null +++ b/comms/xtel/patches/patch-af @@ -0,0 +1,255 @@ +$NetBSD: patch-af,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +--- modem.c.orig Tue Feb 13 10:39:23 2001 ++++ modem.c Sat Jan 12 19:27:52 2002 +@@ -32,7 +32,6 @@ + #include + #else + #ifdef USE_TERMIOS +-#include + #include + #else + #include +@@ -44,6 +43,11 @@ + #ifdef USE_SYSLOG + #include + #endif /* USE_SYSLOG */ ++#ifdef __STDC__ ++#include ++#else ++#include ++#endif + + #include "demon.h" + #include "globald.h" +@@ -87,55 +91,56 @@ + #endif + } + +-/* Syslog or not syslog ? */ +-#ifdef USE_SYSLOG +-void log_debug (fmt, p1, p2, p3, p4, p5, p6, p7) +-char *fmt; +-int p1, p2, p3, p4, p5, p6, p7; +-{ +- char msg[256]; +- +- sprintf (msg, fmt, p1, p2, p3, p4, p5, p6, p7); +- syslog (LOG_INFO, msg); +-} +- +-void log_err (s) +-char *s; +-{ +- syslog (LOG_ERR, s); +-} ++#ifdef __STDC__ ++void log_debug(const char *fmt, ...) + #else +-void log_debug (fmt, p1, p2, p3, p4, p5, p6, p7) +-char *fmt; +-int p1, p2, p3, p4, p5, p6, p7; ++void log_debug(va_alist) ++ va_dcl ++#endif + { ++ va_list ap; ++#ifdef __STDC__ ++ va_start(ap, fmt); ++#else ++ const char *fmt; ++ va_start(ap); ++ fmt = va_arg(ap, const char *); ++#endif ++#ifdef USE_SYSLOG ++ vsyslog(LOG_INFO, fmt, ap); ++#else + fprintf (fp_console, "%s[%d] ", prefix, getpid()); +- fprintf (fp_console, fmt, p1, p2, p3, p4, p5, p6, p7); ++ vfprintf (fp_console, fmt, ap); + fprintf (fp_console, "\n\r"); ++#endif ++ va_end(ap); + } + +-void log_err (s) +-char *s; ++#ifdef __STDC__ ++void log_err(const char *fmt, ...) ++#else ++void log_err(va_alist) ++ va_dcl ++#endif + { ++ va_list ap; ++#ifdef __STDC__ ++ va_start(ap, fmt); ++#else ++ const char *fmt; ++ va_start(ap); ++ fmt = va_arg(ap, const char *); ++#endif ++#ifdef USE_SYSLOG ++ vsyslog(LOG_ERR, fmt, ap); ++#else + fprintf (fp_console, "%s[%d] ", prefix, getpid()); +- +- while (*s) { +- if (*s != '%') +- fputc (*s, fp_console); +- else if (*(s+1) == 'm') { +- fprintf (fp_console, "%s", sys_errlist[errno]); +- s++; +- } +- +- s++; +- } +- ++ vfprintf (fp_console, fmt, ap); + fprintf (fp_console, "\n\r"); ++#endif ++ va_end(ap); + } + +-#endif /* USE_SYSLOG */ +- +- + /* Envoi d'une commande MODEM */ + static void writemodem (fd, buf, n) + int fd; +@@ -165,8 +170,10 @@ + #else + + #ifdef USE_TERMIOS +- ioctl (fd, TIOCGETA, &term); +- memcpy ((char *)&term_sauve, (char *)&term, sizeof(struct termios)); ++ if (tcgetattr(fd, &term) < 0) { ++ log_err("tcgetattr: %s", strerror(errno)); ++ exit(1); ++ } + #else + ioctl (fd, TCGETA, &term); + memcpy ((char *)&term_sauve, (char *)&term, sizeof(struct termio)); +@@ -174,11 +181,21 @@ + + /* Parametrage de la ligne */ + term.c_cc[VMIN] = 1; ++#ifdef __NetBSD__ ++ term.c_cc[VTIME] = term.c_cc[VKILL] = term.c_cc[VERASE] = 0; ++ term.c_iflag = IGNBRK | IGNPAR; ++ term.c_oflag = term.c_lflag = 0; ++#else + term.c_cc[VTIME] = 0; + term.c_iflag &= ~(IXON|IXOFF|ICRNL); + term.c_lflag &= ~(ICANON|ISIG|ECHO|IEXTEN); ++#endif + + #ifdef USE_TERMIOS ++#ifdef __NetBSD__ ++ term.c_cflag = (CREAD | HUPCL | CRTSCTS); ++ cfsetspeed( &term, speed); ++#else + /* + * FreeBSD 1.1 (Beta) n'a pas l'air d'apprecier qu'on mette clocal + * a 0... (blocage au premier write sur /dev/cua01) +@@ -186,6 +203,7 @@ + term.c_cflag &= ~(CSIZE|CSTOPB); + term.c_cflag |= (CREAD|HUPCL); + term.c_ispeed = term.c_ospeed = speed; ++#endif /* __NetBSD__ */ + #else + term.c_cflag &= ~(CSIZE|CBAUD|CLOCAL); + +@@ -223,10 +241,12 @@ + #endif /* sun */ + + #ifdef USE_TERMIOS ++#ifndef __NetBSD__ + term.c_iflag &= ~(IGNCR|ICRNL|INLCR|IMAXBEL); + term.c_iflag |= (ISTRIP|INPCK); + term.c_lflag &= ~(ECHOCTL|IEXTEN); + term.c_oflag &= ~OPOST; ++#endif /* __NetBSD__ */ + #endif /* USE_TERMIOS */ + + /* Cas du Minitel 1/2 */ +@@ -235,7 +255,10 @@ + + /* Affectation des parametres */ + #ifdef USE_TERMIOS +- ioctl (fd, TIOCSETA, &term); ++ if (tcsetattr (fd, TCSANOW, &term) < 0) { ++ log_err("tcsetattr(1):%s", strerror(errno)); ++ exit(1); ++ } + #else + ioctl (fd, TCSETA, &term); + #endif /* USE_TERMIOS */ +@@ -256,10 +279,11 @@ + ioctl (fd, TIOCSETP, &term_sauve); + #else + #ifdef USE_TERMIOS +- term.c_ispeed = B0; +- term.c_ospeed = B0; +- ioctl (fd, TIOCSETAW, &term); +- ioctl (fd, TIOCSETA, &term_sauve); ++ cfsetspeed(&term_sauve, B0); ++ if (tcsetattr (fd, TCSADRAIN, &term_sauve) < 0) { ++ log_err("tcsetattr(2):%s", strerror(errno)); ++ exit(1); ++ } + #else + term.c_cflag &= ~CBAUD; + term.c_cflag |= B0; +@@ -285,7 +309,7 @@ + int reply_size; + { + fd_set a_lire, t_a_lire; +- int i, erreur, fin, nbread, cmodem; ++ int i, erreur, fin, nbread, cmodem = 0; + char *pt_chat, c, *q; + + delai_maxi.tv_sec = tmax; +@@ -307,14 +331,20 @@ + * (comme le Hayes Optima par exemple)... + */ + #ifdef USE_TERMIOS +- ioctl (fd, TCIOCGETA, &term); ++ if (tcgetattr(fd, &term) < 0) { ++ log_err("tcgetattr: %s", strerror(errno)); ++ exit(1); ++ } + #else + ioctl (fd, TCGETA, &term); + #endif /* USE_TERMIOS */ +- if ((term.c_cflag | CLOCAL) == 0) { ++ if ((term.c_cflag & CLOCAL) == 0) { + term.c_cflag |= CLOCAL; + #ifdef USE_TERMIOS +- ioctl (fd, TCIOCSETA, &term); ++ if (tcsetattr (fd, TCSANOW, &term) < 0) { ++ log_err("tcsetattr(3):%s", strerror(errno)); ++ exit(1); ++ } + #else + ioctl (fd, TCSETA, &term); + #endif /* USE_TERMIOS */ +@@ -586,13 +616,17 @@ + fin = ((erreur != 0 || *(pt_chat-1) == 0) ? 1 : 0); + usleep (30000); + } ++ sleep(3); + + #ifndef NO_TERMIO + /* Repasse en controle modem */ + if (cmodem) { + term.c_cflag &= ~CLOCAL; + #ifdef USE_TERMIOS +- ioctl (fd, TCIOCSETA, &term); ++ if (tcsetattr (fd, TCSANOW, &term) < 0) { ++ log_err("tcsetattr(4):%s", strerror(errno)); ++ exit(1); ++ } + #else + ioctl (fd, TCSETA, &term); + #endif /* USE_TERMIOS */ diff --git a/comms/xtel/patches/patch-ag b/comms/xtel/patches/patch-ag new file mode 100644 index 00000000000..cb4979d92b1 --- /dev/null +++ b/comms/xtel/patches/patch-ag @@ -0,0 +1,62 @@ +$NetBSD: patch-ag,v 1.1.1.1 2002/01/12 18:34:56 bouyer Exp $ + +--- xteld.c.orig Sat Jan 12 19:24:14 2002 ++++ xteld.c Sat Jan 12 19:25:38 2002 +@@ -624,12 +624,12 @@ + flag_crlf = True; + + if (pipe (tuyau_in) < 0) { +- log_err ("pipe: tuyau_in: %m"); ++ log_err ("pipe: tuyau_in: %s", strerror(errno)); + exit (1); + } + + if (pipe (tuyau_out) < 0) { +- log_err ("pipe: tuyau_out: %m"); ++ log_err ("pipe: tuyau_out: %s", strerror(errno)); + exit (1); + } + +@@ -674,7 +674,7 @@ + #endif + + if (execvp (code_teletel, Argv) < 0) { +- log_err ("execlp: %m"); ++ log_err ("execlp: %s", strerror(errno)); + exit (1); + } + } +@@ -1060,7 +1060,7 @@ + return 0; + + err: +- log_err ("read: %m"); ++ log_err ("read: %s", strerror(errno)); + return -1; + } + +@@ -1079,13 +1079,13 @@ + /* Adresse du client */ + len = sizeof (client); + if (getpeername (XTELD_INPUT, (struct sockaddr *) &client, &len) < 0) { +- log_err ("getpeername: %m"); ++ log_err ("getpeername: %s", strerror(errno)); + } + else { + struct hostent *h; + + if ((h = gethostbyaddr ((char *)&client.sin_addr, sizeof(client.sin_addr), AF_INET)) == NULL) { +- log_err ("gethostbyaddr: %m"); ++ log_err ("gethostbyaddr: %s", strerror(errno)); + return NULL; + } + else +@@ -1391,7 +1391,7 @@ + return 1; + + err: +- log_err ("read: %m"); ++ log_err ("read: %s", strerror(errno)); + + return -1; + } -- cgit v1.2.3