cvs commit: apache-apr/include apr_file_io.h

1999-02-25 Thread rbb
rbb 99/02/25 13:34:24

  Modified:include  apr_file_io.h
  Log:
  Added prototypes for copying file descriptors and getting stat information.
  
  Revision  ChangesPath
  1.6   +5 -0  apache-apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===
  RCS file: /home/cvs/apache-apr/include/apr_file_io.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apr_file_io.h 1999/02/25 19:57:10 1.5
  +++ apr_file_io.h 1999/02/25 21:34:23 1.6
  @@ -96,5 +96,10 @@
   
   apr_uint64_t apr_read(apr_file_t *, void *, apr_uint64_t);
   apr_uint64_t apr_write(apr_file_t *, void *, apr_uint64_t);
  +
  +apr_file_t *apr_dupfile(apr_file_t *);
  +apr_status_t apr_getfileinfo(char *, apr_file_t *);
  +apr_status_t apr_updatefileinfo(apr_file_t *);
  +
   #endif  /* ! APR_FILE_IO_H */
   
  
  
  


cvs commit: apache-apr/apr/file_io/unix filedup.c filestat.c Makefile open.c

1999-02-25 Thread rbb
rbb 99/02/25 13:33:46

  Modified:apr/file_io/unix Makefile open.c
  Added:   apr/file_io/unix filedup.c filestat.c
  Log:
  Added logic to copy apr file descriptos, and get stat information for
  files.
  
  Revision  ChangesPath
  1.3   +4 -3  apache-apr/apr/file_io/unix/Makefile
  
  Index: Makefile
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/Makefile,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile  1999/02/25 19:58:41 1.2
  +++ Makefile  1999/02/25 21:33:42 1.3
  @@ -47,7 +47,7 @@
   
   LIB=  libfile.a
   
  -OBJS= open.o readwrite.o\
  +OBJS= open.o readwrite.o filedup.o filestat.o\
   
   .c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $<
  @@ -82,6 +82,7 @@
   $(OBJS): Makefile
   
   # DO NOT REMOVE
  -alloc.o: open.c 
  +open.o: open.c filestat.c
   readwrite.o: readwrite.c
  -
  +filedup.o: filedup.c
  +filestat.o: filestat.c
  
  
  
  1.9   +1 -8  apache-apr/apr/file_io/unix/open.c
  
  Index: open.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/open.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- open.c1999/02/25 19:58:41 1.8
  +++ open.c1999/02/25 21:33:43 1.9
  @@ -116,14 +116,7 @@
   return NULL;
   }
   
  -if (stat(dafile->fname, &info) == 0) {
  -dafile->protection = info.st_mode;
  - dafile->user = info.st_uid;
  - dafile->group = info.st_gid;
  - dafile->size = info.st_size;
  - dafile->atime = info.st_atime;
  - dafile->mtime = info.st_mtime;
  - dafile->ctime = info.st_ctime;
  +if (apr_updatefileinfo(dafile) == APR_SUCCESS) {
return dafile;
   }
   else {
  
  
  
  1.1  apache-apr/apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===
  /* 
   * Copyright (c) 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.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see .
   *
   */
  
  #include "apr_file_io.h"
  #include "apr_general.h"
  
  apr_file_t *apr_dupfile(apr_file_t *old_file)
  {
  apr_file_t * new_file = (apr_file_t *)malloc(sizeof(apr_file_t));
  
  

cvs commit: apache-apr/docs fileio.txt

1999-02-25 Thread rbb
rbb 99/02/25 13:31:36

  Modified:docs fileio.txt
  Log:
  Added the definitions for file stat'ing, and copying apr_file_t descriptors.
  There are two ways to stat a file.  1) Provide filename, and get a new
  instance of apr_file_t.  2)  Provide an apr_file_t and it will update the
  variable for you.
  
  Revision  ChangesPath
  1.5   +23 -2 apache-apr/docs/fileio.txt
  
  Index: fileio.txt
  ===
  RCS file: /home/cvs/apache-apr/docs/fileio.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- fileio.txt1999/02/25 19:55:22 1.4
  +++ fileio.txt1999/02/25 21:31:36 1.5
  @@ -61,11 +61,32 @@
   Notes:  apr_write tries to update the apr_file_t that is passed in, but it 
fails
   silently if it is unable to do so.
   
  - APRStatus apr_getfileinfo(char *, APRFileInfo *)  
  + apr_file_t apr_dupfile(apr_file_t *)
  +Copy data from one apr_file_t to a new one.
  + Arguments:
  +arg 1)  the file info to save.
  +return) a new file structure.
  +
  +Notes:  This does not duplicate the file descriptor, it just saves the data
  +from apr_file_t to a new apr_file_t.  This is used so user programs
  +do not need access to the internals of apr_file_t
  +
  + apr_status apr_getfileinfo(char *, apr_file_t *)  
Get information about the file with the given path name.
Arguments:
arg 1)  path to file to get information about
  - arg 2)  Structure to store file's information in. (Returned by APR)
  + arg 2)  Structure to store file's information in. 
  +return) APR_SUCCESS or APR_FAILURE.
  +
  + apr_status apr_updatefileinfo(apr_file_t *)  
  + Get information about the file with the given path name.
  + Arguments:
  + arg 1)  Structure to store file's information in. 
  +return) APR_SUCCESS or APR_FAILURE.
  +
  +Notes:  apr_updatefileinfo overwrites the old info, so if it is needed, the 
old
  +info should be saved off to the side, using apr_dupfile.
  +
APRStatus apr_seek(APRFile, APRInt64, APRSeekWhere, APRInt64 *)
Moves the read/write file offset pointer
Arguments:
  
  
  


cvs commit: apache-apr/apr/file_io/unix readwrite.c Makefile open.c

1999-02-25 Thread rbb
rbb 99/02/25 11:58:42

  Modified:apr/file_io/unix Makefile open.c
  Added:   apr/file_io/unix readwrite.c
  Log:
  Added readwrite file, for all reading and writing functions, and made
  minor changes to apr_close, so it works nicely with the rest of the file I/O
  functions.
  
  Revision  ChangesPath
  1.2   +3 -1  apache-apr/apr/file_io/unix/Makefile
  
  Index: Makefile
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/Makefile,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile  1999/02/25 16:33:19 1.1
  +++ Makefile  1999/02/25 19:58:41 1.2
  @@ -47,7 +47,7 @@
   
   LIB=  libfile.a
   
  -OBJS= open.o \
  +OBJS= open.o readwrite.o\
   
   .c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $<
  @@ -83,3 +83,5 @@
   
   # DO NOT REMOVE
   alloc.o: open.c 
  +readwrite.o: readwrite.c
  +
  
  
  
  1.8   +3 -3  apache-apr/apr/file_io/unix/open.c
  
  Index: open.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/open.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- open.c1999/02/25 16:36:37 1.7
  +++ open.c1999/02/25 19:58:41 1.8
  @@ -133,10 +133,10 @@
   }
   }
   
  -apr_status_t apr_close(apr_file_t file)
  +apr_status_t apr_close(apr_file_t *file)
   {
  -if (close(file.filedes) == 0) {
  -file.filedes = -1;
  +if (close(file->filedes) == 0) {
  +file->filedes = -1;
   return APR_SUCCESS;
   }
   else {
  
  
  
  1.1  apache-apr/apr/file_io/unix/readwrite.c
  
  Index: readwrite.c
  ===
  /* 
   * Copyright (c) 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.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see .
   *
   */
  
  #include "apr_file_io.h"
  #include "apr_general.h"
  #include "apr_errno.h"
  #include 
  #include 
  
  apr_uint64_t apr_read(apr_file_t *thefile, void *buf, apr_uint64_t nbytes)
  {
  apr_int64_t rv;
  
  if (thefile->filedes < 0) {
  errno = EBADF;
  return -1;
  }
  
  rv = read(thefile->filedes, buf, nbytes);
  
  return rv;
  }
  
  apr_uint64_t apr_

cvs commit: apache-apr/include apr_file_io.h apr_general.h

1999-02-25 Thread rbb
rbb 99/02/25 11:57:11

  Modified:include  apr_file_io.h apr_general.h
  Log:
  Added typedefs for all the integer types.  They most likely aren't correct,
  but until I get a chance to fix them, they will work.
  
  Revision  ChangesPath
  1.5   +5 -2  apache-apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===
  RCS file: /home/cvs/apache-apr/include/apr_file_io.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apr_file_io.h 1999/02/23 21:23:45 1.4
  +++ apr_file_io.h 1999/02/25 19:57:10 1.5
  @@ -91,7 +91,10 @@
   typedef mode_t apr_fileperms_t;
   
   /*   Function definitions */
  -apr_file_t *apr_open(char *fname, apr_int32_t flag, apr_fileperms_t mode);
  -apr_status_t apr_close(apr_file_t file);
  +apr_file_t *apr_open(char *, apr_int32_t, apr_fileperms_t);
  +apr_status_t apr_close(apr_file_t *);
  +
  +apr_uint64_t apr_read(apr_file_t *, void *, apr_uint64_t);
  +apr_uint64_t apr_write(apr_file_t *, void *, apr_uint64_t);
   #endif  /* ! APR_FILE_IO_H */
   
  
  
  
  1.4   +8 -1  apache-apr/include/apr_general.h
  
  Index: apr_general.h
  ===
  RCS file: /home/cvs/apache-apr/include/apr_general.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_general.h 1999/02/23 21:23:45 1.3
  +++ apr_general.h 1999/02/25 19:57:10 1.4
  @@ -59,6 +59,13 @@
   #define TRUE 1
   #define FALSE 0
   
  -typedef int apr_int32_t;
  +typedef short apr_int16_t;
  +typedef unsigned shortapr_uint16_t;
  +typedef int   apr_int32_t;
  +typedef unsigned int  apr_uint32_t;
  +typedef long  apr_int64_t;
  +typedef unsigned long apr_uint64_t;
  +
  +
   
   #endif  /* ! APR_GENERAL_H */
  
  
  


cvs commit: apache-apr/docs fileio.txt

1999-02-25 Thread rbb
rbb 99/02/25 11:55:22

  Modified:docs fileio.txt
  Log:
  Re-wrote fileio.txt for apr_read and apr_write.  I also modified apr_close.
  
  Revision  ChangesPath
  1.4   +26 -17apache-apr/docs/fileio.txt
  
  Index: fileio.txt
  ===
  RCS file: /home/cvs/apache-apr/docs/fileio.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- fileio.txt1999/02/23 21:13:55 1.3
  +++ fileio.txt1999/02/25 19:55:22 1.4
  @@ -15,7 +15,8 @@
APR_TRUNCATEIf the file is there, length is 
truncated to 0.
APR_BINARY  Not a text file.
  - APR_BUFFEREDbuffer the data.
  + APR_BUFFEREDbuffer the data.  Default is 
  + non-buffered
APR_EXCLreturn error if APR_CREATE and file
exists.
APR_NONBLOCKdon't block on read or write.
  @@ -32,38 +33,34 @@
   is small, and a stat isn't required after opening the file. 
   
   
  -apr_status_t apr_close(apr_file_t);
  +apr_status_t apr_close(apr_file_t *);
Close the specified file descriptor
Arguments:
arg 1)  file descriptor of file to be closed.
  +return) APR_SUCCESS or APR_FAILURE
  +
   Notes:  The fields within the APRFile structure will not be changed when a 
file
is closed.  The ONLY updated field, will be the file descriptor.
   
  - APRStatus apr_read(APRFile, void *, APRUInt64, APRUInt64 *)
  + apr_uint64_t apr_read(apr_file_t *, void *, apr_uint64_t)
Read n bytes from file and store in buffer.
Arguments:
arg 1)  File descriptor to read from
arg 2)  buffer to store data in
arg 3)  number of bytes to read
  - arg 4)  pointer to number of bytes read. (returned by APR)
  - APRStatus apr_write(APRFile, void *, APRUInt64, APRUInt64 *)
  + return) pointer to number of bytes read.
  +
  + apr_uint64_t apr_write(apr_file_t *, void *, apr_uint64_t)
Write n bytes of data from buffer to file
Arguments:
arg 1)  File descriptor to write data to
arg 2)  buffer to read data from
arg 3)  number of bytes to write
  - arg 4)  pointer to number of bytes written. (returned by APR)
  - APRStatus apr_writev(APRFile, APRIOVec *, APRUInt64, APUInt64 *)
  - Same as apr_write, except it gets the data from the APRIOVec array.
  - Arguments:
  - arg 1)  File descriptor to write data to
  - arg 2)  Array from which to get the data to write to the file
  - arg 3)  Number of elements in the APRIOVec array.  Must be smaller
  - than apr_MAX_IOVEC_SIZE, if not function will fail with
  - apr_BUFFER_OVERFLOW_ERROR
  - arg 4) number of bytes written.  APR_FAILURE on failure.
  - NOTES: apr_writev will write a complete entry from APRIOVec array before
  - moving on to the next one.
  + return) pointer to number of bytes written. 
  +
  +Notes:  apr_write tries to update the apr_file_t that is passed in, but it 
fails
  +silently if it is unable to do so.
  +
APRStatus apr_getfileinfo(char *, APRFileInfo *)  
Get information about the file with the given path name.
Arguments:
  @@ -96,6 +93,18 @@
Arguments:
arg 1) Abstracted directory descriptor to read from.
arg 2) the next directory entry.
  +
  + APRStatus apr_writev(APRFile, APRIOVec *, APRUInt64, APUInt64 *)
  + Same as apr_write, except it gets the data from the APRIOVec array.
  + Arguments:
  + arg 1)  File descriptor to write data to
  + arg 2)  Array from which to get the data to write to the file
  + arg 3)  Number of elements in the APRIOVec array.  Must be smaller
  + than apr_MAX_IOVEC_SIZE, if not function will fail with
  + apr_BUFFER_OVERFLOW_ERROR
  + arg 4) number of bytes written.  APR_FAILURE on failure.
  + NOTES: apr_writev will write a complete entry from APRIOVec array before
  + moving on to the next one.
   
   
    IMPLEMENTATION DETAILS **
  
  
  


cvs commit: apache-apr/apr/test testfile.c

1999-02-25 Thread rbb
rbb 99/02/25 11:48:58

  Modified:apr/test testfile.c
  Log:
  Updated test program for apr_read and apr_write.
  
  Revision  ChangesPath
  1.3   +50 -4 apache-apr/apr/test/testfile.c
  
  Index: testfile.c
  ===
  RCS file: /home/cvs/apache-apr/apr/test/testfile.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- testfile.c1999/02/25 17:34:33 1.2
  +++ testfile.c1999/02/25 19:48:57 1.3
  @@ -63,10 +63,14 @@
   {
   apr_file_t *thefile = NULL;
   apr_status_t status = 0;
  -apr_int32_t flag = APR_READ | APR_CREATE | APR_NONBLOCK;
  +apr_int32_t flag = APR_READ | APR_WRITE | APR_CREATE | APR_NONBLOCK;
  +apr_uint64_t rv = 0;
  +apr_uint64_t nbytes = 0;
  +char buf;
  +char *filename = "test.fil";
   
   fprintf(stdout, "Opening file...");
  -thefile = apr_open("test.fil", flag, 444);
  +thefile = apr_open(filename, flag, 444);
   if (thefile == NULL) {
   perror("Didn't open file");
   exit(-1);
  @@ -80,7 +84,7 @@
   fprintf(stderr, "Bad file des\n");
   exit(-1);
   }
  -if (strcmp(thefile->fname, "rbb.fil") != 0) {
  +if (strcmp(thefile->fname, filename) != 0) {
   fprintf(stderr, "wrong filename\n");
   exit(-1);
   }
  @@ -88,8 +92,50 @@
   fprintf(stdout, "OK\n");
   }
   
  +fprintf(stdout, "Writing to file...");
  +
  +nbytes = (apr_uint64_t)strlen("this is a test");
  +rv = apr_write(thefile, "this is a test", nbytes);
  +if (rv == -1) {
  +perror("something's wrong");
  +exit(-1);
  +}
  +if (rv != nbytes) {
  +fprintf(stderr, "didn't write properly.\n");
  +exit(-1);
  +}
  +else {
  +fprintf(stdout, "OK\n");
  +}
  +
  +fprintf(stdout, "Moving to start of file...");
  +
  +if (lseek(thefile->filedes, SEEK_SET, 0) != 0) {
  +perror("couldn't seek to beginning of file.");
  +exit(-1);
  +}
  +else {
  +fprintf(stdout, "OK\n");
  +}
  +
  +fprintf(stdout, "Reading from the file...");
  +nbytes = (apr_uint64_t)strlen("this is a test");
  +rv = apr_read(thefile, &buf, nbytes);
  +if (rv == -1) {
  +perror("something's wrong");
  +exit(-1);
  +}
  +nbytes = (apr_uint64_t)strlen("this is a test");
  +if (rv != nbytes) {
  +fprintf(stderr, "didn't read properly.\n");
  +exit(-1);
  +}
  +else {
  +fprintf(stdout, "OK\n");
  +}
  +
   fprintf(stdout, "Closing File...");
  -status = apr_close(*thefile);
  +status = apr_close(thefile);
   if (status == APR_FAILURE) {
   fprintf(stderr, "Couldn't close the file\n");
   exit(-1); 
  
  
  


cvs commit: apache-apr/apr/test testfile.c

1999-02-25 Thread rbb
rbb 99/02/25 09:34:33

  Modified:apr/test testfile.c
  Log:
  Forgot to add the Copyright comment when I checked this in the first time,
  so I'm adding it now.
  
  Revision  ChangesPath
  1.2   +55 -0 apache-apr/apr/test/testfile.c
  
  Index: testfile.c
  ===
  RCS file: /home/cvs/apache-apr/apr/test/testfile.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testfile.c1999/02/25 16:42:38 1.1
  +++ testfile.c1999/02/25 17:34:33 1.2
  @@ -1,3 +1,58 @@
  +/* 
  + * Copyright (c) 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.
  + * For more information on the Apache Group and the Apache HTTP server
  + * project, please see .
  + *
  + */
  +
   #include "apr_file_io.h"
   #include "apr_errno.h"
   #include "apr_general.h"
  
  
  


cvs commit: apache-apr/apr/test Makefile testfile.c

1999-02-25 Thread rbb
rbb 99/02/25 08:42:39

  Added:   apr/test Makefile testfile.c
  Log:
  Test program for the file I/O.  And, the makefile required to build it.
  I would really like to see people create test programs as they make apr
  functions.
  
  Revision  ChangesPath
  1.1  apache-apr/apr/test/Makefile
  
  Index: Makefile
  ===
  ##
  ##  Apache Makefile, automatically generated by Configure script.
  ##  Hand-edited changes will be lost if the Configure script is re-run.
  ##  Sources: - ../Makefile.config (via Configuration.apaci)
  ##   - ./Makefile.tmpl
  ##
  
  ##
  ##  Inherited Makefile options from Configure script
  ##  (Begin of automatically generated section)
  ##
  SRCDIR=..
  EXTRA_CFLAGS=-g 
  EXTRA_LDFLAGS=
  EXTRA_LIBS= -L../file_io -lfile
  EXTRA_INCLUDES=
  EXTRA_DEPS=
  OSDIR=
  INCDIR=../../include
  INCLUDES0=-I $(INCDIR)
  SHELL=/bin/sh
  CC=gcc
  CPP=gcc -E
  TARGET=
  OPTIM=
  CFLAGS_SHLIB=-fpic -DSHARED_MODULE
  LD_SHLIB=ld
  LDFLAGS_SHLIB=-Bshareable
  LDFLAGS_SHLIB_EXPORT=-rdynamic
  CFLAGS1= -DLINUX=2 -pthread -DUSE_HSREGEX
  INCLUDES1=
  LIBS_SHLIB=
  LDFLAGS1=
  MFLAGS_STATIC=--no-print-directory
  REGLIB=regex/libregex.a
  RANLIB=ranlib
  LIBS1= -lm -lcrypt -lndbm -ldl 
  ##
  ##  (End of automatically generated section)
  ##
  
  
  CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
  LIBS=$(EXTRA_LIBS) $(LIBS1)
  INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
  LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
  
  OBJS= testfile.o \
  
  .c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(LIBS) $<
  
  testfile:
$(CC) testfile.c $(INCLUDES) $(CFLAGS) $(LIBS) $<
  
  
  clean:
rm -f *.o $(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
  
  #Dependencies
  
  $(OBJS): Makefile
  
  # DO NOT REMOVE
  alloc.o: open.c 
  
  
  
  1.1  apache-apr/apr/test/testfile.c
  
  Index: testfile.c
  ===
  #include "apr_file_io.h"
  #include "apr_errno.h"
  #include "apr_general.h"
  #include "errno.h"
  #include 
  
  void main()
  {
  apr_file_t *thefile = NULL;
  apr_status_t status = 0;
  apr_int32_t flag = APR_READ | APR_CREATE | APR_NONBLOCK;
  
  fprintf(stdout, "Opening file...");
  thefile = apr_open("test.fil", flag, 444);
  if (thefile == NULL) {
  perror("Didn't open file");
  exit(-1);
  }
  else {
  fprintf(stdout, "OK\n");
  }
  
  fprintf(stdout, "Checking file...");
  if (thefile->filedes < 0) {
  fprintf(stderr, "Bad file des\n");
  exit(-1);
  }
  if (strcmp(thefile->fname, "rbb.fil") != 0) {
  fprintf(stderr, "wrong filename\n");
  exit(-1);
  }
  else {
  fprintf(stdout, "OK\n");
  }
  
  fprintf(stdout, "Closing File...");
  status = apr_close(*thefile);
  if (status == APR_FAILURE) {
  fprintf(stderr, "Couldn't close the file\n");
  exit(-1); 
  }
  else {
  fprintf(stdout, "OK\n");
  }
  }
  
  
  


cvs commit: apache-apr/apr/test - New directory

1999-02-25 Thread rbb
rbb 99/02/25 08:37:46

  apache-apr/apr/test - New directory


cvs commit: apache-apr/apr/file_io/unix open.c

1999-02-25 Thread rbb
rbb 99/02/25 08:36:38

  Modified:apr/file_io/unix open.c
  Log:
  Finally got around to testing this code, so here is a working apr_open and
  apr_close. :)
  
  Revision  ChangesPath
  1.7   +22 -17apache-apr/apr/file_io/unix/open.c
  
  Index: open.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/open.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- open.c1999/02/23 21:07:44 1.6
  +++ open.c1999/02/25 16:36:37 1.7
  @@ -55,6 +55,7 @@
   
   #include "apr_file_io.h"
   #include 
  +#include 
   
   apr_file_t *apr_open(char *fname, apr_int32_t flag,  apr_fileperms_t mode)
   {
  @@ -62,53 +63,56 @@
   apr_file_t *dafile = (apr_file_t *)malloc(sizeof(apr_file_t));
   struct stat info;
   
  -if ((flag && APR_READ) && (flag && APR_WRITE)) {
  +if ((flag & APR_READ) && (flag & APR_WRITE)) {
   oflags = O_RDWR;
   }
  -else if (flag && APR_READ) {
  +else if (flag & APR_READ) {
   oflags = O_RDONLY;
   }
  -else if (flag && APR_WRITE) {
  +else if (flag & APR_WRITE) {
   oflags = O_WRONLY;
   }
   else {
   errno = EACCES;
  - return NULL;
  + free(dafile);
  +return NULL;
   }
   
  -if (flag && APR_BUFFERED) {
  +if (flag & APR_BUFFERED) {
   dafile->buffered = TRUE;
   }
  -strcpy(dafile->fname, fname);
  +dafile->fname = strdup(fname);
   
  -if (flag && APR_CREATE) {
  +if (flag & APR_CREATE) {
   oflags |= O_CREAT; 
  - if (flag && APR_EXCL) {
  + if (flag & APR_EXCL) {
oflags |= O_EXCL;
}
   }
  -if ((flag && APR_EXCL) && !(flag && APR_CREATE)) {
  +if ((flag & APR_EXCL) && !(flag & APR_CREATE)) {
   errno = EACCES;
  - return NULL;
  + free(dafile);
  +return NULL;
   }   
   
  -if (flag && APR_APPEND) {
  +if (flag & APR_APPEND) {
   oflags |= O_APPEND;
   }
  -if (flag && APR_TRUNCATE) {
  -oflags = O_TRUNC;
  +if (flag & APR_TRUNCATE) {
  +oflags |= O_TRUNC;
   }
  -if (flag && APR_NONBLOCK) {
  -oflags = O_NONBLOCK;
  +if (flag & APR_NONBLOCK) {
  +oflags |= O_NONBLOCK;
   }
   else {
  -oflags = O_SYNC;
  +oflags |= O_SYNC;
   }

   dafile->filedes = open(fname, oflags, mode);
   
   if (dafile->filedes < 0) {
   dafile->filedes = -1;
  +free(dafile);
   return NULL;
   }
   
  @@ -124,7 +128,8 @@
   }
   else {
   errno = ENOSTAT;
  - return NULL;
  + free(dafile);
  +return NULL;
   }
   }
   
  
  
  


cvs commit: apache-apr/apr/file_io/unix Makefile

1999-02-25 Thread rbb
rbb 99/02/25 08:33:19

  Added:   apr/file_io/unix Makefile
  Log:
  A Makefile so libfile can be built without creating it everytime apache-apr
  is extracted to a new machine.  This is not a final Makefile, but it is a good
  temporary one.
  
  Revision  ChangesPath
  1.1  apache-apr/apr/file_io/unix/Makefile
  
  Index: Makefile
  ===
  ##
  ##  Apache Makefile, automatically generated by Configure script.
  ##  Hand-edited changes will be lost if the Configure script is re-run.
  ##  Sources: - ../Makefile.config (via Configuration.apaci)
  ##   - ./Makefile.tmpl
  ##
  
  ##
  ##  Inherited Makefile options from Configure script
  ##  (Begin of automatically generated section)
  ##
  SRCDIR=..
  EXTRA_CFLAGS=-g 
  EXTRA_LDFLAGS=
  EXTRA_LIBS=
  EXTRA_INCLUDES=
  EXTRA_DEPS=
  OSDIR=
  INCDIR=../../../include
  INCLUDES0=-I $(INCDIR)
  SHELL=/bin/sh
  CC=gcc
  CPP=gcc -E
  TARGET=
  OPTIM=
  CFLAGS_SHLIB=-fpic -DSHARED_MODULE
  LD_SHLIB=ld
  LDFLAGS_SHLIB=-Bshareable
  LDFLAGS_SHLIB_EXPORT=-rdynamic
  CFLAGS1= -DLINUX=2 -pthread -DUSE_HSREGEX
  INCLUDES1=
  LIBS_SHLIB=
  LDFLAGS1=
  MFLAGS_STATIC=--no-print-directory
  REGLIB=regex/libregex.a
  RANLIB=ranlib
  LIBS1= -lm -lcrypt -lndbm -ldl
  ##
  ##  (End of automatically generated section)
  ##
  
  
  CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
  LIBS=$(EXTRA_LIBS) $(LIBS1)
  INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
  LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
  
  LIB=  libfile.a
  
  OBJS= open.o \
  
  .c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $<
  
  all: $(HEADERS) $(LIB)
  
  $(LIB): $(OBJS)
rm -f $@
ar cr $@ $(OBJS)
$(RANLIB) $@
cp $@ ../
  clean:
rm -f *.o $(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
  
  #Dependencies
  
  $(OBJS): Makefile
  
  # DO NOT REMOVE
  alloc.o: open.c 
  
  
  


cvs commit: apache-1.3 STATUS

1999-02-25 Thread dougm
dougm   99/02/25 07:48:53

  Modified:.STATUS
  Log:
  update for  ap_sub_req_method_uri()
  
  Revision  ChangesPath
  1.631 +8 -3  apache-1.3/STATUS
  
  Index: STATUS
  ===
  RCS file: /home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.630
  retrieving revision 1.631
  diff -u -r1.630 -r1.631
  --- STATUS1999/02/22 12:55:14 1.630
  +++ STATUS1999/02/25 15:48:52 1.631
  @@ -1,5 +1,5 @@
 1.3 STATUS:
  -  Last modified at [$Date: 1999/02/22 12:55:14 $]
  +  Last modified at [$Date: 1999/02/25 15:48:52 $]
   
   Release:
   
  @@ -68,6 +68,7 @@
 waiting for a review from Dean for the shared memory
 hard-core stuff. When someone else is also interested
 please review the shared memory deep-level code.
  + Doug: +1 on concept (untested)
   
   * Fred's [PATCH: srm.conf and access.conf refer to httpd.conf
   Message-ID: <[EMAIL PROTECTED]>
  @@ -124,8 +125,8 @@
Mesage-ID: PR#3246, also available at
   
Status: Ken -0 for 1.3/+0 for 2.0, Lars -0 for 1.3
  -
  -* Eric Prud'hommeaux's mod_dir mods for file-level access control.
  + 
  +   * Eric Prud'hommeaux's mod_dir mods for file-level access control.
   Message-ID: <[EMAIL PROTECTED]>
   Status: Jim -0 (The current behavior seems logical to me. If there
was more universal interest in changing it, then that would be
  @@ -139,6 +140,10 @@
   * Ronald Tschalär's major update of mod_digest
   Message-ID: <[EMAIL PROTECTED]>
   Status: Big change -- needs review.
  +
  +* Greg Stein's ap_sub_req_method_uri()
  + Message-ID: <[EMAIL PROTECTED]>
  + Status: Doug +1
   
   In progress:
   
  
  
  


cvs commit: apache-apr/pthreads/src/main http_protocol.c

1999-02-25 Thread rbb
rbb 99/02/25 05:43:37

  Modified:pthreads/src/main http_protocol.c
  Log:
  Just a minor change to get the proper file descriptor.
  
  Revision  ChangesPath
  1.6   +1 -1  apache-apr/pthreads/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- http_protocol.c   1999/02/24 20:30:18 1.5
  +++ http_protocol.c   1999/02/25 13:43:36 1.6
  @@ -943,7 +943,7 @@
   ap_bnonblock(r->connection->client, B_RD);
   while (!read_request_line(r)) {
   if (errno == EAGAIN) {
  -filedes->fd = r->connection->client->fd_in;
  +filedes->fd = ap_bfileno(r->connection->client, B_RD);
   filedes->events = POLLIN; 
   filedes->revents = 0; 
   if (poll(filedes, 1, ap_get_timeout(r)) == 0) {