randy 98/02/02 18:41:22
Modified: src/ap Makefile.tmpl
src/include ap.h
src/main buff.c
Added: src/ap ap_read.c ap_write.c
Log:
Abstract read() and write() to the ap library to make it easier
to add in different types of read/write libraries in a central
location. This mainly keeps buff.c less messy with #ifdefs.
Revision Changes Path
1.10 +4 -1 apache-1.3/src/ap/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/ap/Makefile.tmpl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Makefile.tmpl 1998/02/01 15:56:21 1.9
+++ Makefile.tmpl 1998/02/03 02:41:19 1.10
@@ -6,7 +6,8 @@
LIB=libap.a
-OBJS=ap_signal.o ap_slack.o ap_snprintf.o ap_strings.o ap_cpystrn.o
ap_execve.o
+OBJS=ap_signal.o ap_slack.o ap_snprintf.o ap_strings.o ap_cpystrn.o \
+ ap_execve.o ap_read.o ap_write.o
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
@@ -30,3 +31,5 @@
ap_strings.o: $(INCDIR)/httpd.h
ap_cpystrn.o: $(INCDIR)/httpd.h
ap_execve.o: $(INCDIR)/httpd.h $(INCDIR)/http_log.h
+ap_read.o: $(INCDIR)/httpd.h
+ap_write.o: $(INCDIR)/httpd.h
1.1 apache-1.3/src/ap/ap_read.c
Index: ap_read.c
===================================================================
/* ====================================================================
* Copyright (c) 1995-1998 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. 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/>.
*
*/
#include "httpd.h"
/* the lowest level reading primitive */
API_EXPORT(int) ap_read(BUFF *fb, void *buf, int nbyte)
{
int rv;
rv = read(fb->fd_in, buf, nbyte);
return rv;
}
1.1 apache-1.3/src/ap/ap_write.c
Index: ap_write.c
===================================================================
/* ====================================================================
* Copyright (c) 1995-1998 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. 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/>.
*
*/
#include "httpd.h"
/* the lowest level writing primitive */
API_EXPORT(int) ap_write(BUFF *fb, const void *buf, int nbyte)
{
int rv;
#if defined (B_SFIO)
rv = sfwrite(fb->sf_out, buf, nbyte);
#else
rv = write(fb->fd, buf, nbyte);
#endif
return rv;
}
1.5 +2 -0 apache-1.3/src/include/ap.h
Index: ap.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/ap.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ap.h 1998/01/25 16:13:11 1.4
+++ ap.h 1998/02/03 02:41:21 1.5
@@ -57,6 +57,8 @@
#ifndef APACHE_AP_H
#define APACHE_AP_H
+API_EXPORT(int) ap_read(BUFF *fb, void *buf, int nbyte);
+API_EXPORT(int) ap_write(BUFF *fb, const void *buf, int nbyte);
API_EXPORT(char *) ap_cpystrn(char *, const char *, size_t);
int ap_slack(int, int);
API_EXPORT(char *) ap_escape_quotes(pool *, const char *);
1.61 +5 -7 apache-1.3/src/main/buff.c
Index: buff.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- buff.c 1998/01/27 05:35:32 1.60
+++ buff.c 1998/02/03 02:41:22 1.61
@@ -233,9 +233,9 @@
errno = WSAGetLastError();
}
else
- rv = read(fb->fd_in, buf, nbyte);
+ rv = ap_read(fb, buf, nbyte);
#else
- rv = read(fb->fd_in, buf, nbyte);
+ rv = ap_read(fb, buf, nbyte);
#endif /* WIN32 */
return rv;
}
@@ -252,11 +252,9 @@
errno = WSAGetLastError();
}
else
- rv = write(fb->fd, buf, nbyte);
-#elif defined (B_SFIO)
- rv = sfwrite(fb->sf_out, buf, nbyte);
+ rv = ap_write(fb, buf, nbyte);
#else
- rv = write(fb->fd, buf, nbyte);
+ rv = ap_write(fb, buf, nbyte);
#endif /* WIN32 */
return rv;
}
@@ -569,7 +567,7 @@
int bsfio_write(Sfio_t * f, char *buf, int nbyte, apache_sfio *disc)
{
- return write(disc->buff->fd, buf, nbyte);
+ return ap_write(disc->buff, buf, nbyte);
}
Sfdisc_t *bsfio_new(pool *p, BUFF *b)