rbb 99/04/07 13:42:11
Modified: apr/file_io/unix Makefile apr/test testfile.c docs fileio.txt include apr_file_io.h apr_general.h Log: added apr_seek function, and all needed typedefs and defines. Revision Changes Path 1.4 +2 -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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 1999/02/25 21:33:42 1.3 +++ Makefile 1999/04/07 20:42:02 1.4 @@ -47,7 +47,7 @@ LIB= libfile.a -OBJS= open.o readwrite.o filedup.o filestat.o\ +OBJS= open.o readwrite.o filedup.o filestat.o seek.o\ .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $< @@ -86,3 +86,4 @@ readwrite.o: readwrite.c filedup.o: filedup.c filestat.o: filestat.c +seek.o: seek.c 1.5 +1 -5 apache-apr/apr/test/testfile.c Index: testfile.c =================================================================== RCS file: /home/cvs/apache-apr/apr/test/testfile.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- testfile.c 1999/02/26 18:58:59 1.4 +++ testfile.c 1999/04/07 20:42:05 1.5 @@ -112,11 +112,7 @@ } fprintf(stdout, "Moving to start of file......."); -#ifdef BEOS - if (lseek(thefile->filedes, 0, SEEK_SET) != 0) { -#else - if (lseek(thefile->filedes, SEEK_SET, 0) != 0) { -#endif + if (apr_seek(thefile, 0, SEEK_SET) != 0) { perror("couldn't seek to beginning of file."); exit(-1); } 1.7 +6 -3 apache-apr/docs/fileio.txt Index: fileio.txt =================================================================== RCS file: /home/cvs/apache-apr/docs/fileio.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- fileio.txt 1999/04/07 19:48:31 1.6 +++ fileio.txt 1999/04/07 20:42:07 1.7 @@ -87,14 +87,17 @@ 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 *) + apr_off_t apr_seek(apr_file_t, apr_off_t, apr_seek_where_t) Moves the read/write file offset pointer Arguments: arg 1) Pointer to File descriptor arg 2) offset into file to move pointer to arg 3) How to move the pointer. See APRSeekWhere def below. - arg 4) Offset into file that the pointer was set to. (Returned by - APR) + APR_SET -- set the offset to offset + APR_CUR -- add the offset to the current position + APR_END -- add the offset to the current file size. + return) Offset into file that the pointer was set to. + APRStatus apr_access(char *, APRFilePerms) Determine the Accessibility of a file Arguments: 1.8 +9 -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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- apr_file_io.h 1999/04/07 19:43:45 1.7 +++ apr_file_io.h 1999/04/07 20:42:09 1.8 @@ -75,6 +75,14 @@ exists. */ #define APR_NONBLOCK 256 /* Don't block when reading or writing */ +/* flags for apr_seek */ +#define APR_SET SEEK_SET +#define APR_CUR SEEK_CUR +#define APR_END SEEK_END + +/* should be same as whence type in lseek, POSIZ defines this as int */ +typedef int apr_seek_where_t; + typedef struct apr_file_t { int filedes; char * fname; @@ -101,5 +109,6 @@ apr_status_t apr_getfileinfo(char *, apr_file_t *); apr_status_t apr_updatefileinfo(apr_file_t *); +apr_off_t apr_seek(apr_file_t *, apr_off_t, apr_seek_where_t); #endif /* ! APR_FILE_IO_H */ 1.6 +2 -0 apache-apr/include/apr_general.h Index: apr_general.h =================================================================== RCS file: /home/cvs/apache-apr/include/apr_general.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- apr_general.h 1999/04/07 19:43:46 1.5 +++ apr_general.h 1999/04/07 20:42:09 1.6 @@ -68,4 +68,6 @@ typedef apr_int32_t apr_size_t; +typedef apr_int32_t apr_off_t; + #endif /* ! APR_GENERAL_H */