diff options
author | Bob Beck <beck@cvs.openbsd.org> | 1999-03-01 01:16:05 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 1999-03-01 01:16:05 +0000 |
commit | 85ea6023f3b47eacbd1c0ffc7e1575df2745ee24 (patch) | |
tree | 3cb92a150bda37faff6ed043fc8c33064359069e | |
parent | 21d723c6847eebcff10c51f4ca9a9f2f90cdea59 (diff) |
Apache 1.3.4
-rw-r--r-- | usr.sbin/httpd/src/Makefile_win32.txt | 119 | ||||
-rw-r--r-- | usr.sbin/httpd/src/Makefile_win32_debug.txt | 119 | ||||
-rw-r--r-- | usr.sbin/httpd/src/helpers/findprg.sh | 24 | ||||
-rw-r--r-- | usr.sbin/httpd/src/os/tpf/ebcdic.c | 221 |
4 files changed, 483 insertions, 0 deletions
diff --git a/usr.sbin/httpd/src/Makefile_win32.txt b/usr.sbin/httpd/src/Makefile_win32.txt new file mode 100644 index 00000000000..bcd50c90a86 --- /dev/null +++ b/usr.sbin/httpd/src/Makefile_win32.txt @@ -0,0 +1,119 @@ +# Makefile for Windows NT and Windows 95 + +# Targets are: +# _apache - build Apache in Release mode +# install - build and install a Release build +# clean - remove (most) files generated by a Release build +# +# The default installation directory is \Apache. This can be changed +# with the INSTDIR macro, for example: +# +# nmake /f Makefile_win32.txt INSTDIR="d:\Program Files\Apache" install +# +# Note: this does *NOT* change the compiled in default "server root" + +!IF "$(INSTDIR)" == "" +INSTDIR=\Apache +!MESSAGE Using default install directory \Apache +!ENDIF + +default: _apache + +_apache: _build + +install: _build _install + +_build: + cd os\win32 + nmake /nologo CFG="ApacheOS - Win32 Release" -f ApacheOS.mak + cd ..\.. + cd regex + nmake /nologo CFG="regex - Win32 Release" -f regex.mak + cd .. + cd ap + nmake /nologo CFG="ap - Win32 Release" -f ap.mak + cd .. + cd main + nmake /nologo CFG="gen_uri_delims - Win32 Release" -f gen_uri_delims.mak + nmake /nologo CFG="gen_test_char - Win32 Release" -f gen_test_char.mak + cd .. + -del CoreR\buildmark.obj + nmake /nologo CFG="ApacheCore - Win32 Release" -f ApacheCore.mak + nmake /nologo CFG="Apache - Win32 Release" -f Apache.mak + cd os\win32 + set CFG=ApacheModuleStatus - Win32 Release + nmake /nologo CFG="ApacheModuleStatus - Win32 Release" -f ApacheModuleStatus.mak +# nmake /nologo CFG ""/nologo -f ApacheModuleStatus.mak"=ApacheModuleInfo - Win32 Release" -f ApacheModuleInfo.mak + nmake /nologo CFG="ApacheModuleAuthAnon - Win32 Release" -f ApacheModuleAuthAnon.mak + nmake /nologo CFG="ApacheModuleDigest - Win32 Release" -f ApacheModuleDigest.mak + nmake /nologo CFG="ApacheModuleCERNMeta - Win32 Release" -f ApacheModuleCERNMeta.mak + nmake /nologo CFG="ApacheModuleExpires - Win32 Release" -f ApacheModuleExpires.mak + nmake /nologo CFG="ApacheModuleHeaders - Win32 Release" -f ApacheModuleHeaders.mak + nmake /nologo CFG="ApacheModuleSpeling - Win32 Release" -f ApacheModuleSpeling.mak + nmake /nologo CFG="ApacheModuleUserTrack - Win32 Release" -f ApacheModuleUserTrack.mak + nmake /nologo CFG="ApacheModuleRewrite - Win32 Release" -f ApacheModuleRewrite.mak + cd ..\.. + cd modules\proxy + nmake /nologo CFG="ApacheModuleProxy - Win32 Release" -f ApacheModuleProxy.mak + cd ..\.. + +_install: + -mkdir $(INSTDIR) + -mkdir $(INSTDIR)\modules + -mkdir $(INSTDIR)\logs + -mkdir $(INSTDIR)\conf + copy ApacheR\Apache.exe $(INSTDIR) + copy CoreR\ApacheCore.dll $(INSTDIR) + copy os\win32\ApacheModuleStatusR\ApacheModuleStatus.dll $(INSTDIR)\modules +# copy os\win32\ApacheModuleInfoR\ApacheModuleInfo.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleAuthAnonR\ApacheModuleAuthAnon.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleDigestR\ApacheModuleDigest.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleCERNMetaR\ApacheModuleCERNMeta.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleExpiresR\ApacheModuleExpires.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleHeadersR\ApacheModuleHeaders.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleRewriteR\ApacheModuleRewrite.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleSpelingR\ApacheModuleSpeling.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleUserTrackR\ApacheModuleUserTrack.dll $(INSTDIR)\modules + copy modules\proxy\Release\ApacheModuleProxy.dll $(INSTDIR)\modules + +clean: + cd os\win32 + nmake /nologo CFG="ApacheOS - Win32 Release" -f ApacheOS.mak clean + cd ..\.. + cd regex + nmake /nologo CFG="regex - Win32 Release" -f regex.mak clean + cd .. + cd ap + nmake /nologo CFG="ap - Win32 Release" -f ap.mak clean + cd .. + cd main + nmake /nologo CFG="gen_uri_delims - Win32 Release" -f gen_uri_delims.mak clean + del uri_delims.h + nmake /nologo CFG="gen_test_char - Win32 Release" -f gen_test_char.mak clean + del test_char.h + cd .. + nmake /nologo CFG="ApacheCore - Win32 Release" -f ApacheCore.mak clean + nmake /nologo CFG="Apache - Win32 Release" -f Apache.mak clean + cd os\win32 + nmake /nologo CFG="ApacheModuleStatus - Win32 Release" -f ApacheModuleStatus.mak clean +# nmake /nologo CFG="ApacheModuleInfo - Win32 Release" -f ApacheModuleInfo.mak clean + nmake /nologo CFG="ApacheModuleAuthAnon - Win32 Release" -f ApacheModuleAuthAnon.mak clean + nmake /nologo CFG="ApacheModuleDigest - Win32 Release" -f ApacheModuleDigest.mak clean + nmake /nologo CFG="ApacheModuleCERNMeta - Win32 Release" -f ApacheModuleCERNMeta.mak clean + nmake /nologo CFG="ApacheModuleExpires - Win32 Release" -f ApacheModuleExpires.mak clean + nmake /nologo CFG="ApacheModuleHeaders - Win32 Release" -f ApacheModuleHeaders.mak clean + nmake /nologo CFG="ApacheModuleSpeling - Win32 Release" -f ApacheModuleSpeling.mak clean + nmake /nologo CFG="ApacheModuleUserTrack - Win32 Release" -f ApacheModuleUserTrack.mak clean + nmake /nologo CFG="ApacheModuleRewrite - Win32 Release" -f ApacheModuleRewrite.mak clean + cd ..\.. + cd modules\proxy + nmake /nologo CFG="ApacheModuleProxy - Win32 Release" -f ApacheModuleProxy.mak clean + cd ..\.. + cd os\win32\installer\installdll + nmake /nologo CFG="install - Win32 Release" -f install.mak clean + cd ..\..\.. + +installdll: + cd os\win32\installer\installdll + nmake /nologo CFG="install - Win32 Release" -f install.mak + cd ..\..\.. diff --git a/usr.sbin/httpd/src/Makefile_win32_debug.txt b/usr.sbin/httpd/src/Makefile_win32_debug.txt new file mode 100644 index 00000000000..599676f86ec --- /dev/null +++ b/usr.sbin/httpd/src/Makefile_win32_debug.txt @@ -0,0 +1,119 @@ +# Makefile for Windows NT and Windows 95 + +# Targets are: +# _apache - build Apache in Debug mode +# install - build and install a Debug build +# clean - remove (most) files generated by a Debug build +# +# The default installation directory is \Apache. This can be changed +# with the INSTDIR macro, for example: +# +# nmake /f Makefile_win32_debug.txt INSTDIR="d:\Program Files\Apache" install +# +# Note: this does *NOT* change the compiled in default "server root" + +!IF "$(INSTDIR)" == "" +INSTDIR=\Apache +!MESSAGE Using default install directory \Apache +!ENDIF + +default: _apache + +_apache: _build + +install: _build _install + +_build: + cd os\win32 + nmake /nologo CFG="ApacheOS - Win32 Debug" -f ApacheOS.mak + cd ..\.. + cd regex + nmake /nologo CFG="regex - Win32 Debug" -f regex.mak + cd .. + cd ap + nmake /nologo CFG="ap - Win32 Debug" -f ap.mak + cd .. + cd main + nmake /nologo CFG="gen_uri_delims - Win32 Debug" -f gen_uri_delims.mak + nmake /nologo CFG="gen_test_char - Win32 Debug" -f gen_test_char.mak + cd .. + -del CoreD\buildmark.obj + nmake /nologo CFG="ApacheCore - Win32 Debug" -f ApacheCore.mak + nmake /nologo CFG="Apache - Win32 Debug" -f Apache.mak + cd os\win32 + set CFG=ApacheModuleStatus - Win32 Debug + nmake /nologo CFG="ApacheModuleStatus - Win32 Debug" -f ApacheModuleStatus.mak +# nmake /nologo CFG ""/nologo -f ApacheModuleStatus.mak"=ApacheModuleInfo - Win32 Debug" -f ApacheModuleInfo.mak + nmake /nologo CFG="ApacheModuleAuthAnon - Win32 Debug" -f ApacheModuleAuthAnon.mak + nmake /nologo CFG="ApacheModuleDigest - Win32 Debug" -f ApacheModuleDigest.mak + nmake /nologo CFG="ApacheModuleCERNMeta - Win32 Debug" -f ApacheModuleCERNMeta.mak + nmake /nologo CFG="ApacheModuleExpires - Win32 Debug" -f ApacheModuleExpires.mak + nmake /nologo CFG="ApacheModuleHeaders - Win32 Debug" -f ApacheModuleHeaders.mak + nmake /nologo CFG="ApacheModuleSpeling - Win32 Debug" -f ApacheModuleSpeling.mak + nmake /nologo CFG="ApacheModuleUserTrack - Win32 Debug" -f ApacheModuleUserTrack.mak + nmake /nologo CFG="ApacheModuleRewrite - Win32 Debug" -f ApacheModuleRewrite.mak + cd ..\.. + cd modules\proxy + nmake /nologo CFG="ApacheModuleProxy - Win32 Debug" -f ApacheModuleProxy.mak + cd ..\.. + +_install: + -mkdir $(INSTDIR) + -mkdir $(INSTDIR)\modules + -mkdir $(INSTDIR)\logs + -mkdir $(INSTDIR)\conf + copy ApacheD\Apache.exe $(INSTDIR) + copy CoreD\ApacheCore.dll $(INSTDIR) + copy os\win32\ApacheModuleStatusD\ApacheModuleStatus.dll $(INSTDIR)\modules +# copy os\win32\ApacheModuleInfoD\ApacheModuleInfo.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleAuthAnonD\ApacheModuleAuthAnon.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleDigestD\ApacheModuleDigest.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleCERNMetaD\ApacheModuleCERNMeta.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleExpiresD\ApacheModuleExpires.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleHeadersD\ApacheModuleHeaders.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleRewriteD\ApacheModuleRewrite.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleSpelingD\ApacheModuleSpeling.dll $(INSTDIR)\modules + copy os\win32\ApacheModuleUserTrackD\ApacheModuleUserTrack.dll $(INSTDIR)\modules + copy modules\proxy\Debug\ApacheModuleProxy.dll $(INSTDIR)\modules + +clean: + cd os\win32 + nmake /nologo CFG="ApacheOS - Win32 Debug" -f ApacheOS.mak clean + cd ..\.. + cd regex + nmake /nologo CFG="regex - Win32 Debug" -f regex.mak clean + cd .. + cd ap + nmake /nologo CFG="ap - Win32 Debug" -f ap.mak clean + cd .. + cd main + nmake /nologo CFG="gen_uri_delims - Win32 Debug" -f gen_uri_delims.mak clean + del uri_delims.h + nmake /nologo CFG="gen_test_char - Win32 Debug" -f gen_test_char.mak clean + del test_char.h + cd .. + nmake /nologo CFG="ApacheCore - Win32 Debug" -f ApacheCore.mak clean + nmake /nologo CFG="Apache - Win32 Debug" -f Apache.mak clean + cd os\win32 + nmake /nologo CFG="ApacheModuleStatus - Win32 Debug" -f ApacheModuleStatus.mak clean +# nmake /nologo CFG="ApacheModuleInfo - Win32 Debug" -f ApacheModuleInfo.mak clean + nmake /nologo CFG="ApacheModuleAuthAnon - Win32 Debug" -f ApacheModuleAuthAnon.mak clean + nmake /nologo CFG="ApacheModuleDigest - Win32 Debug" -f ApacheModuleDigest.mak clean + nmake /nologo CFG="ApacheModuleCERNMeta - Win32 Debug" -f ApacheModuleCERNMeta.mak clean + nmake /nologo CFG="ApacheModuleExpires - Win32 Debug" -f ApacheModuleExpires.mak clean + nmake /nologo CFG="ApacheModuleHeaders - Win32 Debug" -f ApacheModuleHeaders.mak clean + nmake /nologo CFG="ApacheModuleSpeling - Win32 Debug" -f ApacheModuleSpeling.mak clean + nmake /nologo CFG="ApacheModuleUserTrack - Win32 Debug" -f ApacheModuleUserTrack.mak clean + nmake /nologo CFG="ApacheModuleRewrite - Win32 Debug" -f ApacheModuleRewrite.mak clean + cd ..\.. + cd modules\proxy + nmake /nologo CFG="ApacheModuleProxy - Win32 Debug" -f ApacheModuleProxy.mak clean + cd ..\.. + cd os\win32\installer\installdll + nmake /nologo CFG="install - Win32 Debug" -f install.mak clean + cd ..\..\.. + +installdll: + cd os\win32\installer\installdll + nmake /nologo CFG="install - Win32 Debug" -f install.mak + cd ..\..\.. diff --git a/usr.sbin/httpd/src/helpers/findprg.sh b/usr.sbin/httpd/src/helpers/findprg.sh new file mode 100644 index 00000000000..8b2f391c976 --- /dev/null +++ b/usr.sbin/httpd/src/helpers/findprg.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Usage: findprg.sh <program-name> +# Return value is the absolute path of the program if it was found. +# Initially written by Lars Eilebrecht <lars@apache.org>. +# +# This script falls under the Apache License. +# See http://www.apache.org/docs/LICENSE + + +if [ ".`which $1`" != . ] +then + echo `which $1` + exit 0 +else + PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" + if [ ".`which $1`" != . ] + then + echo `which $1` + exit 0 + else + exit 1 + fi +fi diff --git a/usr.sbin/httpd/src/os/tpf/ebcdic.c b/usr.sbin/httpd/src/os/tpf/ebcdic.c new file mode 100644 index 00000000000..be029f42597 --- /dev/null +++ b/usr.sbin/httpd/src/os/tpf/ebcdic.c @@ -0,0 +1,221 @@ +/* ==================================================================== + * Copyright (c) 1998-1999 The Apache Group. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * 4. The names "Apache Server" and "Apache Group" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Group and was originally based + * on public domain software written at the National Center for + * Supercomputing Applications, University of Illinois, Urbana-Champaign. + * For more information on the Apache Group and the Apache HTTP server + * project, please see <http://www.apache.org/>. + * + */ + + +#ifdef CHARSET_EBCDIC +#include "ap_config.h" +#include "ebcdic.h" +/* +This code does basic character mapping for IBM's TPF operating system. +It is a modified version of <Martin.Kraemer@Mch.SNI.De>'s code for +the BS2000 (apache/src/os/bs2000/ebcdic.c). +*/ + +/* +Bijective EBCDIC (character set IBM-1047) to US-ASCII table: +This table is bijective - there are no ambigous or duplicate characters. +*/ +const unsigned char os_toascii_strictly[256] = { + 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */ + 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ + 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */ + 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */ + 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */ + 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */ + 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */ + 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */ + 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */ + 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */ + 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */ + 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */ + 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */ + 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */ + 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */ + 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */ + 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */ + 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */ + 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */ + 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */ + 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */ + 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */ + 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */ + 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */ + 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */ + 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */ + 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */ + 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */ + 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */ +}; + +/* +Server EBCDIC (character set IBM-1047) to US-ASCII table: +This table is a copy of the os_toascii_strictly bijective table above. +The only change is that hex 0a (\012 octal) is mapped to hex 0a +(ASCII's line feed) instead of hex 8e. This is done because throughout +Apache, protocol string definitions hardcode the linefeed as \012 (octal): +"Content-Type: text/plain\015\012". Without this kludge all protocol +string definitions would need to be changed from ...\012 to ...\025. +*/ +const unsigned char os_toascii[256] = { + 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */ + 0x87, 0x8d, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ + 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */ + 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */ + 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */ + 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */ + 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */ + 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */ + 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */ + 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */ + 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */ + 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */ + 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */ + 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */ + 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */ + 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */ + 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */ + 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */ + 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */ + 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */ + 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */ + 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */ + 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */ + 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */ + 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */ + 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */ + 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */ + 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */ + 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */ +}; + +/* +The US-ASCII to EBCDIC (character set IBM-1047) table: +This table is bijective (no ambiguous or duplicate characters) +*/ +const unsigned char os_toebcdic[256] = { + 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */ + 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ + 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */ + 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ + 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */ + 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */ + 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */ + 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */ + 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */ + 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */ + 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */ + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */ + 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */ + 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */ + 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */ + 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */ + 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */ + 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */ + 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */ + 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */ + 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */ + 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */ + 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */ + 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */ + 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */ + 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */ + 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */ + 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */ + 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */ +}; + +/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset) + * dest and srce may be identical, or separate memory blocks, but + * should not overlap. + */ +void +ebcdic2ascii(void *dest, const void *srce, size_t count) +{ + unsigned char *udest = dest; + const unsigned char *usrce = srce; + while (count-- != 0) { + *udest++ = os_toascii[*usrce++]; + } +} +void +ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count) +{ + while (count-- != 0) { + *dest++ = os_toascii_strictly[*srce++]; + } +} +void +ascii2ebcdic(void *dest, const void *srce, size_t count) +{ + unsigned char *udest = dest; + const unsigned char *usrce = srce; + + while (count-- != 0) { + *udest++ = os_toebcdic[*usrce++]; + } +} +#endif /*CHARSET_EBCDIC*/ + |