martin 99/12/09 09:12:21
Added: src/os/os390 Makefile.tmpl README.os390 ebcdic.c ebcdic.h os-inline.c os.c os.h xebcdic.sh Log: OS specific files for supporting Apache on OS390 Submitted by: Ovies Brabson <[EMAIL PROTECTED]> Revision Changes Path 1.1 apache-1.3/src/os/os390/Makefile.tmpl Index: Makefile.tmpl =================================================================== CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) LIBS=$(EXTRA_LIBS) $(LIBS1) INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) OBJS= os.o os-inline.o ebcdic.o LIB= libos.a all: $(LIB) $(LIB): $(OBJS) rm -f $@ ar cr $@ $(OBJS) $(RANLIB) $@ .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $< clean: rm -f $(OBJS) $(LIB) distclean: clean -rm -f Makefile # We really don't expect end users to use this rule. It works only with # gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after # using it. depend: cp Makefile.tmpl Makefile.tmpl.bak \ && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \ && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \ && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \ -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \ > Makefile.tmpl \ && rm Makefile.new $(OBJS): Makefile # DO NOT REMOVE ebcdic.o: ebcdic.c ebcdic.o: $(INCDIR)/ap_config.h ebcdic.o: $(INCDIR)/ap_mmn.h ebcdic.o: $(INCDIR)/ap_config_auto.h ebcdic.o: os.h ebcdic.o: $(INCDIR)/ap_ctype.h ebcdic.o: $(INCDIR)/hsregex.h ebcdic.o: ebcdic.h os-inline.o: os-inline.c os-inline.o: $(INCDIR)/ap_config.h os-inline.o: $(INCDIR)/ap_mmn.h os-inline.o: $(INCDIR)/ap_config_auto.h os-inline.o: os.h os-inline.o: $(INCDIR)/ap_ctype.h os-inline.o: $(INCDIR)/hsregex.h os.o: os.c os.o: $(INCDIR)/httpd.h os.o: $(INCDIR)/ap_config.h os.o: $(INCDIR)/ap_mmn.h os.o: $(INCDIR)/ap_config_auto.h os.o: os.h os.o: $(INCDIR)/ap_ctype.h os.o: $(INCDIR)/hsregex.h os.o: $(INCDIR)/alloc.h os.o: $(INCDIR)/buff.h os.o: $(INCDIR)/ap.h os.o: ebcdic.h os.o: $(INCDIR)/util_uri.h os.o: $(INCDIR)/http_core.h 1.1 apache-1.3/src/os/os390/README.os390 Index: README.os390 =================================================================== README.os390 ============== This file describes how one extracts the apache source files from a compressed archive on one of the apache source code distribution web pages to an OS/390 system. OS/390 represents characters with the ebcdic code set. The files in the apache source trees on the web represent characters using the ascii code set. The procedure described here de-compresses the archive file and extracts the files from the archive while translating characters in the files from ascii to ebcdic. Once you download the compressed archive to an OS/390 system and follow this procedure, you will be ready to configure, compile, and install apache on your OS/390 system. This procedure assumes that you will download the apache tree using a browser on a workstation and then you will transfer the compressed archive from your workstation to an OS/390 system. You could probably just ftp the compressed archive to your OS/390 system ifyou like. If you download to a workstation as described here, it is assumed that the workstation has TCP/IP and FTP installed on it. It is also assumed that you have TCP/IP and FTP access from the workstation to the OS/390 system you want to put apache on. Procedure for extracting apache source to an OS/390 system: ----------------------------------------------------------- - From either www.apache.org/dist or from dev.apache.org/from-CVS/apache-version select one of the source trees with a file type of .tar.gz or .tar.Z and download it to your workstation. Ensure that the name of the downloaded file remains the same as the name of the file on the web page. - Also from the same web page download xebcdic.sh. - From your workstation ftp to the OS/390 system you would like to run apache on. - ftp os390-host-name - You'll be prompted for user id and password. - Once you've logged in successfully you'll get the ftp prompt. - FTP the .tar.gz file and xebcdic.sh files you downloaded to your workstation to the OS/390 system. The xebcdic.sh file must be ftp'ed in ascii mode. The apache compressed archive file must be ftp'ed in binary mode. - put xebcdic.sh - bin - put apache-compressed-archive-file-name - End your ftp connection. - bye or quit - From your OS/390 system use the xebcdic.sh shell script to de-compress and extract the apache source. This script will de-compress the apache source tree and will then extract all the files from the archive. As the files are extracted, they are all translated from ascii to ebcdic. All the gif files are then re-extracted from the archive without applying the ascii to ebcdic translation so that they won't be corrupted. The name of the compressed archive file you specify to xebcdic.sh must follow the following format: apache-version_timeStamp.tar.gz or apache-version_timeStamp.tar.Z or apache-version.tar.gz or apache-version.tar.Z or apache_version.tar.gz or apache_version.tar.Z When you invoke the script, you may specify which file types should be re-extracted without applying the ascii to ebcdic translation. This can be used to save static pages as ascii improving performance when serving those pages by avoiding the ebcdic to ascii translation at the time they are served. Please refer to top-of-source-tree/src/README.ebcdic for information on how to use the AddType and DefaultType directives to serve static pages without trying to translate from ebcdic to ascii. - To extract the source tree and have html and txt files re-extracted without translation specify the following: ./xebcdic.sh apache-compressed-archive-file-name --f=*.html --f=*.txt - To extract the source tree and have the static text content files that are part of the source tree stored on your OS/390 system in ascii specify the following: ./xebcdic.sh apache-compressed-archive-file-name --all-ascii-content - The apache source tree is now ready for you to configure, make and install. Refer to top-of-source-tree/INSTALL for directions on how to proceed. 1.1 apache-1.3/src/os/os390/ebcdic.c Index: ebcdic.c =================================================================== /* ==================================================================== * 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 * [EMAIL PROTECTED] * * 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 OS/390 Unix System Services operating system. It is a modified version of <[EMAIL PROTECTED]>'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*/ 1.1 apache-1.3/src/os/os390/ebcdic.h Index: ebcdic.h =================================================================== #include <sys/types.h> extern const unsigned char os_toascii[256]; extern const unsigned char os_toebcdic[256]; void ebcdic2ascii(void *dest, const void *srce, size_t count); void ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count); void ascii2ebcdic(void *dest, const void *srce, size_t count); 1.1 apache-1.3/src/os/os390/os-inline.c Index: os-inline.c =================================================================== /* * This file contains functions which can be inlined if the compiler * has an "inline" modifier. Because of this, this file is both a * header file and a compilable module. * * Only inlineable functions should be defined in here. They must all * include the INLINE modifier. * * If the compiler supports inline, this file will be #included as a * header file from os.h to create all the inline function * definitions. INLINE will be defined to whatever is required on * function definitions to make them inline declarations. * * If the compiler does not support inline, this file will be compiled * as a normal C file into libos.a (along with os.c). In this case * INLINE will _not_ be set so we can use this to test if we are * compiling this source file. */ #ifndef INLINE #define INLINE /* Anything required only when compiling */ #include "ap_config.h" #endif INLINE int ap_os_is_path_absolute(const char *file) { return (file && file[0] == '/' ? 1 : 0); } 1.1 apache-1.3/src/os/os390/os.c Index: os.c =================================================================== /* ==================================================================== * 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 * [EMAIL PROTECTED] * * 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/>. * */ /* * This file will include OS specific functions which are not inlineable. * Any inlineable functions should be defined in os-inline.c instead. */ #include "httpd.h" #include "http_core.h" #include "os.h" /* Check the Content-Type to decide if conversion is needed */ int ap_checkconv(struct request_rec *r) { int convert_to_ascii; const char *type; /* To make serving of "raw ASCII text" files easy (they serve faster * since they don't have to be converted from EBCDIC), a new * "magic" type prefix was invented: text/x-ascii-{plain,html,...} * If we detect one of these content types here, we simply correct * the type to the real text/{plain,html,...} type. Otherwise, we * set a flag that translation is required later on. */ type = (r->content_type == NULL) ? ap_default_type(r) : r->content_type; /* If no content type is set then treat it as (ebcdic) text/plain */ convert_to_ascii = (type == NULL); /* Conversion is applied to text/ files only, if ever. */ if (type && (strncasecmp(type, "text/", 5) == 0 || strncasecmp(type, "message/", 8) == 0)) { if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX, sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0) r->content_type = ap_pstrcat(r->pool, "text/", type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1, NULL); else /* translate EBCDIC to ASCII */ convert_to_ascii = 1; } /* Enable conversion if it's a text document */ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii); return convert_to_ascii; } 1.1 apache-1.3/src/os/os390/os.h Index: os.h =================================================================== #ifndef APACHE_OS_H #define APACHE_OS_H #define PLATFORM "OS390" /* * This file in included in all Apache source code. It contains definitions * of facilities available on _this_ operating system (HAVE_* macros), * and prototypes of OS specific functions defined in os.c or os-inline.c */ #if !defined(INLINE) && defined(USE_GNU_INLINE) /* Compiler supports inline, so include the inlineable functions as * part of the header */ #define INLINE extern ap_inline INLINE int ap_os_is_path_absolute(const char *file); #include "os-inline.c" #endif #ifndef INLINE /* Compiler does not support inline, so prototype the inlineable functions * as normal */ extern int ap_os_is_path_absolute(const char *file); #endif /* Other ap_os_ routines not used by this platform */ #define ap_os_is_filename_valid(f) (1) #define ap_os_kill(pid, sig) kill(pid, sig) /* Sorry if this is ugly, but the include order doesn't allow me * to use request_rec here... */ struct request_rec; extern int ap_checkconv(struct request_rec *r); #endif /*! APACHE_OS_H*/ 1.1 apache-1.3/src/os/os390/xebcdic.sh Index: xebcdic.sh =================================================================== #!/bin/sh # # xebcdic.sh fileName [--all-ascii-content] [--f=pattern ... ] # # This shell script decompresses an archive containing an apache source tree # and then extracts the source files from the archive. The source files are # translated from ASCII to EBCDIC as they are extracted from the archive. # Once all the files have been extracted and translated, the binary files are # re-extracted to undo the ASCII to EBCDIC translation on those files. Once # this script is done, the extracted tree can be used on an EBCDIC based # system. # # Input: fileName -- fileName has one of the following formats: # apache-version_timeStamp.tar.gz or # apache-version_timeStamp.tar.Z or # apache-version.tar.gz or # apache-version.tar.Z or # apache_version.tar.gz or # apache_version.tar.Z # # --f=pattern -- specifies that all files which match the pattern # are to be re-extracted without ascii to ebcdic # translation being applied. pattern is a file name # specification that may contain path names and # the wildcard character. All paths are assumed to # be under the apache source tree top. Binary files # are always re-extracted without ascii to ebcdic # translation regardless of whether any pattern is # specified or not. Multiple patterns may be specified # by repeating this option. # # # --all-ascii-content -- specifies that all the text content shipped # with the apache tree should be stored in # ascii on the OS/390 system. This re-extracts # all the *.htm* files in the htdocs directory # of the apache tree without doing the ascii # to ebcdic translation. In addition to the # *.htm* files, file htdocs/manual/LICENSE and # file htdocs/manual/misc/HTTP_Features.tsv # are also stored in ascii. If this option # is specified, directives AddType and # DefaultType need to be used to correctly # serve the pages without trying to first # translate from ebcdic to ascii. See # apache-tree-top/src/README.EBCDIC. # # Example Invocations: # # ./xebcdic.sh apache_1.3.9.tar.gz: Runs gunzip, runs pax and # extracts everything translating it to ebcdic, and re-extracts # all gif files in the htdocs and icons directories without # applying ascii to ebcdic translation. # # ./xebcdic.sh apache_1.3.9.tar.gz --f=*.htm* --f=htdocs/*.tsv: # Runs gunzip, runs pax and extracts everything translating it to # ebcdic, re-extracts all gif files without ascii to ebcdic # translation, and re-extracts all the *.htm* files in the apache # source tree and all *.tsv files in the htdocs directory of the # apache source tree without ascii to ebcdic translation. # # ./xebcdic.sh apache_1.3.9.tar.gz --all-ascii-content: Runs gunzip, # runs pax and extracts everything translating it to ebcdic, # re-extracts all gif files without ascii to ebcdic translation, # and re-extracts all the *.htm* files in the htdocs directory # as well as htdocs/manual/LICENSE and # htdocs/manual/misc/HTTP_Features.tsv without ascii to ebcdic # translation. # # Output: fileName.tar.gz is replaced with fileName.tar and the apache # source tree is extracted into a directory named apache-version or # apache_version. All files except binary files and any files # specified through the options are translated from ascii to # ebcdic. # # Assumptions: The path to gunzip, uncompress and pax is defined and # from where this script is invoked. # echo "Input file name is: $1" # Verify fileName if ! echo $1 | grep -q 'apache_.*\.tar\.gz' && \ ! echo $1 | grep -q 'apache_.*\.tar\.Z' && \ ! echo $1 | grep -q 'apache-.*_.*\.tar\.gz' && \ ! echo $1 | grep -q 'apache-.*_.*\.tar\.Z' && \ ! echo $1 | grep -q 'apache-.*\.tar\.gz' && \ ! echo $1 | grep -q 'apache-.*\.tar\.Z' then echo "Filename, $1, does not follow required format." echo "Filename should have one of the following formats:" echo "apache-version_timeStamp.tar.gz or" echo "apache-version_timeStamp.tar.Z or" echo "apache-version.tar.gz or" echo "apache-version.tar.Z or" echo "apache_version.tar.gz or" echo "apache_version.tar.Z" exit 1; fi if [ ! -f $1 ]; then echo "$1 is not a file" exit 1; fi if [ ! -a $1 ]; then echo "$1 file does not exist" exit 1; fi # Verify fileType option if specified for option in $@ do case "$option" in $1) ;; --all-ascii-content) ;; --f=*) ;; *) echo "Invalid option specified. Command syntax is:" echo "xebcdic.sh compressed-archive-file-name [--all-ascii-content]" echo " [--f=pattern ... ]" exit 1; ;; esac done # Figure out whether to gunzip or uncompress if echo $1 | grep -q 'apache[-_].*\.tar\.gz'; then DECOMPRESS="gunzip" else DECOMPRESS="uncompress" fi echo "Decompression utility $DECOMPRESS will be used." # Set name of tar file after decompressing if [ "x$DECOMPRESS" = "xgunzip" ]; then TARFILE=`echo $1 | sed s/\.tar\.gz/\.tar/` else TARFILE=`echo $1 | sed s/\.tar\.Z/\.tar/` fi echo "Archive file name is: $TARFILE" # Set name of apache source tree directory if echo $1 | grep -q 'apache-.*_.*\.tar*'; then APDIR=`echo $1 | sed s/_.*//` else APDIR=`echo $1 | sed s/\.tar.*//` fi echo "Apache source tree top is: $APDIR" # Decompress input file echo "Starting decompression of $1" if [ "x$DECOMPRESS" = "xgunzip" ]; then if gunzip $1; then echo "Decompression of $1 completed successfully" else exit 1; fi else if uncompress $1; then echo "Decompression of $1 completed successfully" else exit 1; fi fi # Extract source files and translate them all from ASCII to EBCDIC # Determine code page for locale echo "Starting extraction of source files from archive $TARFILE." echo "ASCII being translated to EBCDIC." echo "ASCII code page assumed to be ISO8859-1." echo "EBCDIC code page assumed to be IBM-1047." pax -ofrom=ISO8859-1,to=IBM-1047 -rvf $TARFILE echo "Extraction and translation of source files from archive completed." # Re-extract gif files without ASCII to EBCDIC translation echo "Re-extracting gif files without ASCII to EBCDIC translation" pax -rvf $TARFILE $(find $APDIR/htdocs -type f -name "*.gif*") pax -rvf $TARFILE $(find $APDIR/icons -type f -name "*.gif*") # Re-extract appropriate files as requested by user for option in $@; do case "$option" in $1) ;; --all-ascii-content) echo "Re-extracting files in $APDIR/htdocs without ASCII to EBCDIC translation" pax -rvf $TARFILE $(find $APDIR/htdocs -type f -name "*.htm*") pax -rvf $TARFILE $(find $APDIR/htdocs -type f -name "*.tsv*") pax -rvf $TARFILE $(find $APDIR/htdocs -name "manual/LICENSE") ;; --f=*) PATTERN=`echo $option | sed s/--f=//` if [ "x$PATTERN" != "x" ]; then echo "Re-extracting files matching $PATTERN without ASCII to EBCDIC translation" pax -rvf $TARFILE $(find $APDIR -type f -name "$PATTERN") fi ;; *) ;; esac done