diff -Nur busybox-0.60.3-orig/Config.h busybox-0.60.3/Config.h --- busybox-0.60.3-orig/Config.h Sat Apr 6 12:22:15 2002 +++ busybox-0.60.3/Config.h Thu Jun 13 11:41:14 2002 @@ -7,6 +7,7 @@ // // // BusyBox Applications +#define SCOEMU //#define BB_ADJTIMEX //#define BB_AR #define BB_ASH diff -Nur busybox-0.60.3-orig/scoemu.h busybox-0.60.3/scoemu.h --- busybox-0.60.3-orig/scoemu.h Thu Jan 1 08:00:00 1970 +++ busybox-0.60.3/scoemu.h Thu Jun 13 11:04:00 2002 @@ -0,0 +1,53 @@ +/* vi: set sw=4 ts=4: */ +/* + * Busybox scoemu.h internal header file for SCOEMU + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * William Emmanuel S. Yu + * Ateneo de Manila University + * + */ +#ifndef _BB_SCOEMU_H_ +#define _BB_SCOEMU_H_ 1 + +#define NRKBMAP 18 +#define KBORIGSIZE { \ + 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, \ + 4, 4, 4, 4, 3, 3 \ +} + +#define KBORIGMAP { \ + {27, 91, 91, 65, 0}, {27, 91, 91, 66, 0}, {27, 91, 91, 67, 0}, \ + {27, 91, 91, 68, 0}, \ + {27, 91, 91, 69, 0}, {27, 91, 49, 55, 126}, {27, 91, 49, 56, 126}, \ + {27, 91, 49, 57, 126}, \ + {27, 91, 50, 48, 126}, {27, 91, 50, 49, 126}, {27, 91, 50, 51, 126}, \ + {27, 91, 50, 52, 126}, \ + {27, 91, 53, 126, 0}, {27, 91, 54, 126, 0}, {27, 91, 51, 126, 0}, \ + {27, 91, 50, 126, 0}, \ + {27, 91, 72, 0, 0}, {27, 91, 70, 0, 0} \ +} + +#define KBNEWMAP { \ + "\033[M", "\033[N", "\033[O", "\033[P", \ + "\033[Q", "\033[R", "\033[S", "\033[T", \ + "\033[U", "\033[V", "\033[W", "\033[X", \ + "\033[I", "\033[G", "\177", "\033[L", \ + "\033[H", "\033[F" \ +} + +#endif /* _BB_SCOEMU_H_ */ diff -Nur busybox-0.60.3-orig/telnet.c busybox-0.60.3/telnet.c --- busybox-0.60.3-orig/telnet.c Sat Apr 27 11:53:55 2002 +++ busybox-0.60.3/telnet.c Mon Jun 10 13:45:35 2002 @@ -28,6 +28,7 @@ * Modified 2000/06/13 for inclusion in BusyBox by Erik Andersen * Modified 2001/05/07 to add ability to pass TTYPE to remote host by Jim McQuillan * + * Modified 2002/06/10 added SCO emulation by William Emmanuel S. Yu * */ @@ -49,6 +50,10 @@ # include #endif +#ifdef SCOEMU +#include "scoemu.h" +#endif + #if 0 static const int DOTRACE = 1; #endif @@ -227,6 +232,13 @@ byte * p = G.buf; byte outbuf[4*DATABUFSIZE]; +#ifdef SCOEMU + int flag, k; + int kbmap[NRKBMAP][5] = KBORIGMAP; + char *kbnewmap[NRKBMAP] = KBNEWMAP; + int kbsize[NRKBMAP] = KBORIGSIZE; +#endif + for (i = len, j = 0; i > 0; i--, p++) { if (*p == 0x1d) @@ -240,6 +252,22 @@ else if (*p == 0x0d) outbuf[j++] = 0x00; } + +#ifdef SCOEMU + for (k = 0; k < NRKBMAP; k++) { + flag = 1; + + for (i = 0; i < kbsize[k]; i++) + if (outbuf[i] != kbmap[k][i]) + flag = 0; + + if (flag == 1) { + strcpy(outbuf, kbnewmap[k]); + j = strlen (outbuf); + } + } +#endif + if (j > 0 ) write(G.netfd, outbuf, j); }