diff options
Diffstat (limited to 'file_io/os2')
| -rw-r--r-- | file_io/os2/Makefile.in | 77 | ||||
| -rw-r--r-- | file_io/os2/dir.c | 223 | ||||
| -rw-r--r-- | file_io/os2/fileacc.c | 188 | ||||
| -rw-r--r-- | file_io/os2/filedup.c | 88 | ||||
| -rw-r--r-- | file_io/os2/fileio.h | 94 | ||||
| -rw-r--r-- | file_io/os2/filestat.c | 112 | ||||
| -rw-r--r-- | file_io/os2/maperrorcode.c | 91 | ||||
| -rw-r--r-- | file_io/os2/open.c | 161 | ||||
| -rw-r--r-- | file_io/os2/pipe.c | 98 | ||||
| -rw-r--r-- | file_io/os2/readwrite.c | 105 | ||||
| -rw-r--r-- | file_io/os2/seek.c | 88 |
11 files changed, 0 insertions, 1325 deletions
diff --git a/file_io/os2/Makefile.in b/file_io/os2/Makefile.in deleted file mode 100644 index 2807b9373..000000000 --- a/file_io/os2/Makefile.in +++ /dev/null @@ -1,77 +0,0 @@ -#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) -#LIBS=$(EXTRA_LIBS) $(LIBS1) -#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) -#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) - -CC=@CC@ -RANLIB=@RANLIB@ -CFLAGS=@CFLAGS@ @OPTIM@ -LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ $(LIBS) -INCDIR=../../inc -INCDIR1=../../include -INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I. - -LIB=../file.a - -OBJS=dir.o \ - fileacc.o \ - filedup.o \ - filestat.o \ - open.o \ - pipe.o \ - readwrite.o \ - seek.o \ - maperrorcode.o - -.c.o: - $(CC) $(CFLAGS) -c $(INCLUDES) $< - -all: $(LIB) - -clean: - $(RM) -f *.o *.a *.so - -distclean: clean - -$(RM) -f Makefile - -$(OBJS): Makefile - -$(LIB): $(OBJS) - $(RM) -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -# -# 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.in Makefile.in.bak \ - && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > 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.in \ - && rm Makefile.new - -# DO NOT REMOVE -dir.o: dir.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h -fileacc.o: fileacc.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h -filedup.o: filedup.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h -filestat.o: filestat.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h -open.o: open.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h \ - ../include/apr_lib.h ../include/apr_config.h \ - ../include/hsregex.h -pipe.o: pipe.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h -readwrite.o: readwrite.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h -seek.o: seek.c ../../include/apr_file_io.h fileio.h \ - ../../include/apr_errno.h ../../include/apr_general.h diff --git a/file_io/os2/dir.c b/file_io/os2/dir.c deleted file mode 100644 index 3072a2243..000000000 --- a/file_io/os2/dir.c +++ /dev/null @@ -1,223 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include <string.h> - -#define INCL_DOS -#include <os2.h> - -ap_status_t dir_cleanup(void *thedir) -{ - struct dir_t *dir = thedir; - return ap_closedir(dir); -} - - - -ap_status_t ap_opendir(ap_context_t *cntxt, const char *dirname, struct dir_t **new) -{ - struct dir_t *thedir = (struct dir_t *)ap_palloc(cntxt, sizeof(struct dir_t)); - - if (thedir == NULL) - return APR_ENOMEM; - - thedir->cntxt = cntxt; - thedir->dirname = ap_pstrdup(cntxt, dirname); - thedir->handle = 0; - thedir->validentry = FALSE; - *new = thedir; - return APR_SUCCESS; -} - - - -ap_status_t ap_closedir(struct dir_t *thedir) -{ - int rv = 0; - - if (thedir->handle) { - rv = DosFindClose(thedir->handle); - - if (rv == 0) { - thedir->handle = 0; - } - } - - return os2errno(rv); -} - - - -ap_status_t ap_readdir(struct dir_t *thedir) -{ - int rv; - ULONG entries = 1; - - if (thedir->handle == 0) { - thedir->handle = HDIR_CREATE; - rv = DosFindFirst(ap_pstrcat(thedir->cntxt, thedir->dirname, "/*", NULL), &thedir->handle, - FILE_ARCHIVED|FILE_DIRECTORY|FILE_SYSTEM|FILE_HIDDEN|FILE_READONLY, - &thedir->entry, sizeof(thedir->entry), &entries, FIL_STANDARD); - } else { - rv = DosFindNext(thedir->handle, &thedir->entry, sizeof(thedir->entry), &entries); - } - - if (rv == 0 && entries == 1) { - thedir->validentry = TRUE; - return APR_SUCCESS; - } - - thedir->validentry = FALSE; - - if (rv) - return os2errno(rv); - - return APR_ENOENT; -} - - - -ap_status_t ap_rewinddir(struct dir_t *thedir) -{ - return ap_closedir(thedir); -} - - - -ap_status_t ap_make_dir(ap_context_t *cont, const char *path, ap_fileperms_t perm) -{ - return os2errno(DosCreateDir(path, NULL)); -} - - - -ap_status_t ap_remove_dir(ap_context_t *cont, const char *path) -{ - return os2errno(DosDeleteDir(path)); -} - - - -ap_status_t ap_dir_entry_size(struct dir_t *thedir, ap_ssize_t *size) -{ - if (thedir->validentry) { - *size = thedir->entry.cbFile; - return APR_SUCCESS; - } - - return APR_ENOFILE; -} - - - -ap_status_t ap_dir_entry_mtime(struct dir_t *thedir, time_t *time) -{ - if (thedir->validentry) { - *time = os2date2unix(thedir->entry.fdateLastWrite, thedir->entry.ftimeLastWrite); - return APR_SUCCESS; - } - - return APR_ENOFILE; -} - - - -ap_status_t ap_dir_entry_ftype(struct dir_t *thedir, ap_filetype_e *type) -{ - int rc; - HFILE hFile; - ULONG action, Type, Attr; - ap_filetype_e typemap[8] = { APR_REG, APR_CHR, APR_PIPE }; - - if (thedir->validentry) { - if (thedir->entry.attrFile & FILE_DIRECTORY) { - *type = APR_DIR; - return APR_SUCCESS; - } else { - rc = DosOpen(ap_pstrcat(thedir->cntxt, thedir->dirname, "/", thedir->entry.achName, NULL) , - &hFile, &action, 0, 0, - OPEN_ACTION_FAIL_IF_NEW|OPEN_ACTION_OPEN_IF_EXISTS, OPEN_SHARE_DENYNONE|OPEN_ACCESS_READONLY, - NULL); - - if ( rc == 0 ) { - rc = DosQueryHType( hFile, &Type, &Attr ); - - if ( rc == 0 ) { - *type = typemap[(Type & 0x0007)]; - } - DosClose( hFile ); - } - - return os2errno(rc); - } - } - - return APR_ENOFILE; -} - - - -ap_status_t ap_get_dir_filename(struct dir_t *thedir, char **new) -{ - if (thedir->validentry) { - *new = thedir->entry.achName; - return APR_SUCCESS; - } - - return APR_ENOFILE; -} diff --git a/file_io/os2/fileacc.c b/file_io/os2/fileacc.c deleted file mode 100644 index a31519265..000000000 --- a/file_io/os2/fileacc.c +++ /dev/null @@ -1,188 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <errno.h> -#include <string.h> -#include <sys/types.h> - -/* A file to put ALL of the accessor functions for struct file_t types. */ - -ap_status_t ap_get_filename(struct file_t *thefile, char **new) -{ - if (thefile != NULL) { - *new = ap_pstrdup(thefile->cntxt, thefile->fname); - return APR_SUCCESS; - } else { - *new = NULL; - return APR_ENOFILE; - } -} - - - -ap_status_t ap_get_filesize(struct file_t *file, ap_ssize_t *size) -{ - ap_status_t rv; - - if (file != NULL) { - if (!file->validstatus) { - rv = ap_getfileinfo(file); - - if (rv) - return rv; - } - - *size = file->status.cbFile; - return APR_SUCCESS; - } else { - *size = -1; - return APR_ENOFILE; - } -} - - - -ap_status_t ap_get_fileperms(struct file_t *file, ap_fileperms_t *perm) -{ - ap_status_t rv; - - if (file != NULL) { - if (!file->validstatus) { - rv = ap_getfileinfo(file); - - if (rv) - return rv; - } - - *perm = (file->status.attrFile & FILE_READONLY) ? 0555 : 0777; - return APR_SUCCESS; - } else { - *perm = -1; - return APR_ENOFILE; - } -} - - - -ap_status_t ap_get_fileatime(struct file_t *file, time_t *time) -{ - ap_status_t rv; - - if (file != NULL) { - if (!file->validstatus) { - rv = ap_getfileinfo(file); - - if (rv) - return rv; - } - - *time = os2date2unix( file->status.fdateLastAccess, file->status.ftimeLastAccess ); - return APR_SUCCESS; - } else { - *time = -1; - return APR_ENOFILE; - } -} - - - -ap_status_t ap_get_filectime(struct file_t *file, time_t *time) -{ - ap_status_t rv; - - if (file != NULL) { - if (!file->validstatus) { - rv = ap_getfileinfo(file); - - if (rv) - return rv; - } - - *time = os2date2unix( file->status.fdateCreation, file->status.ftimeCreation ); - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - - - -ap_status_t ap_get_filemtime(struct file_t *file, time_t *time) -{ - ap_status_t rv; - - if (file != NULL) { - if (!file->validstatus) { - rv = ap_getfileinfo(file); - - if (rv) - return rv; - } - - *time = os2date2unix( file->status.fdateLastWrite, file->status.ftimeLastWrite ); - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - diff --git a/file_io/os2/filedup.c b/file_io/os2/filedup.c deleted file mode 100644 index 884c8e67a..000000000 --- a/file_io/os2/filedup.c +++ /dev/null @@ -1,88 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include <string.h> - -#define INCL_DOS -#include <os2.h> - -ap_status_t ap_dupfile(struct file_t *old_file, struct file_t **new_file) -{ - int rv; - struct file_t *dup_file = (struct file_t *)ap_palloc(old_file->cntxt, sizeof(struct file_t)); - - if (new_file == NULL) { - return APR_ENOMEM; - } - - dup_file->filedes = -1; - rv = DosDupHandle(old_file->filedes, &dup_file->filedes); - - if (rv) { - return os2errno(rv); - } - - dup_file->cntxt = old_file->cntxt; - dup_file->fname = ap_pstrdup(dup_file->cntxt, old_file->fname); - dup_file->buffered = old_file->buffered; - dup_file->status = old_file->status; - dup_file->isopen = old_file->isopen; - *new_file = dup_file; - ap_register_cleanup(dup_file->cntxt, dup_file, file_cleanup, NULL); - return APR_SUCCESS; -} diff --git a/file_io/os2/fileio.h b/file_io/os2/fileio.h deleted file mode 100644 index 0d40b4af7..000000000 --- a/file_io/os2/fileio.h +++ /dev/null @@ -1,94 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#ifndef FILE_IO_H -#define FILE_IO_H - -#define INCL_DOS -#include <os2.h> - -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_errno.h" - -struct file_t { - ap_context_t *cntxt; - ULONG filedes; - char * fname; - int isopen; - int buffered; - FILESTATUS3 status; - int validstatus; -}; - -struct dir_t { - ap_context_t *cntxt; - char *dirname; - ULONG handle; - FILEFINDBUF3 entry; - int validentry; -}; - -struct iovec_t { - struct iovec *iovec; -}; - -ap_status_t file_cleanup(void *); -mode_t get_fileperms(ap_fileperms_t); -long os2date2unix( FDATE os2date, FTIME os2time ); -int os2errno( ULONG oserror ); - -#endif /* ! FILE_IO_H */ - diff --git a/file_io/os2/filestat.c b/file_io/os2/filestat.c deleted file mode 100644 index 425215c5c..000000000 --- a/file_io/os2/filestat.c +++ /dev/null @@ -1,112 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include <sys/time.h> - -#define INCL_DOS -#include <os2.h> - - -typedef struct { - USHORT sec2:5; - USHORT min:6; - USHORT hour:5; -} DOSTIME; - -typedef struct { - USHORT day:5; - USHORT month:4; - USHORT year:7; -} DOSDATE; - -long os2date2unix( FDATE os2date, FTIME os2time ) -{ - struct tm tmpdate; - - memset(&tmpdate, 0, sizeof(tmpdate)); - tmpdate.tm_hour = os2time.hours; - tmpdate.tm_min = os2time.minutes; - tmpdate.tm_sec = os2time.twosecs * 2; - - tmpdate.tm_mday = os2date.day; - tmpdate.tm_mon = os2date.month - 1; - tmpdate.tm_year = os2date.year + 80; - tmpdate.tm_isdst = -1; - - return mktime( &tmpdate ); -} - - - -ap_status_t ap_getfileinfo(struct file_t *thefile) -{ - ULONG rc; - - if (thefile->isopen) - rc = DosQueryFileInfo(thefile->filedes, FIL_STANDARD, &thefile->status, sizeof(thefile->status)); - else - rc = DosQueryPathInfo(thefile->fname, FIL_STANDARD, &thefile->status, sizeof(thefile->status)); - - if (rc == 0) { - thefile->validstatus = TRUE; - return APR_SUCCESS; - } - - thefile->validstatus = FALSE; - return os2errno(rc); -} diff --git a/file_io/os2/maperrorcode.c b/file_io/os2/maperrorcode.c deleted file mode 100644 index 0c7fb4fb9..000000000 --- a/file_io/os2/maperrorcode.c +++ /dev/null @@ -1,91 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "apr_file_io.h" -#include <errno.h> -#include <string.h> - -#define INCL_DOSERRORS -#include <os2.h> - -int errormap[][2] = { - { NO_ERROR, APR_SUCCESS }, - { ERROR_FILE_NOT_FOUND, APR_ENOENT }, - { ERROR_PATH_NOT_FOUND, APR_ENOENT }, - { ERROR_TOO_MANY_OPEN_FILES, APR_EMFILE }, - { ERROR_ACCESS_DENIED, APR_EACCES }, - { ERROR_SHARING_VIOLATION, APR_EACCES }, - { ERROR_INVALID_PARAMETER, APR_EINVAL }, - { ERROR_OPEN_FAILED, APR_ENOENT }, - { ERROR_DISK_FULL, APR_ENOSPC }, - { ERROR_FILENAME_EXCED_RANGE, APR_ENAMETOOLONG }, - { ERROR_INVALID_FUNCTION, APR_EINVAL }, - { ERROR_INVALID_HANDLE, APR_EBADF }, - { ERROR_NEGATIVE_SEEK, APR_ESPIPE } -}; - -#define MAPSIZE (sizeof(errormap)/sizeof(errormap[0])) - -int os2errno( ULONG oserror ) -{ - int rv = -1, index; - - for (index=0; index<MAPSIZE && errormap[index][0] != oserror; index++); - - if (index<MAPSIZE) - rv = errormap[index][1]; - - return rv; -} diff --git a/file_io/os2/open.c b/file_io/os2/open.c deleted file mode 100644 index 090d33f62..000000000 --- a/file_io/os2/open.c +++ /dev/null @@ -1,161 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include <string.h> - -#define INCL_DOS -#include <os2.h> - -ap_status_t file_cleanup(void *thefile) -{ - struct file_t *file = thefile; - return ap_close(file); -} - - - -ap_status_t ap_open(ap_context_t *cntxt, char *fname, ap_int32_t flag, ap_fileperms_t perm, struct file_t **new) -{ - int oflags = 0; - int mflags = OPEN_FLAGS_FAIL_ON_ERROR|OPEN_SHARE_DENYNONE; - int rv; - ULONG action; - ap_file_t *dafile = (struct file_t *)ap_palloc(cntxt, sizeof(struct file_t)); - - *new = dafile; - dafile->cntxt = cntxt; - dafile->isopen = FALSE; - dafile->validstatus = FALSE; - - if ((flag & APR_READ) && (flag & APR_WRITE)) { - mflags |= OPEN_ACCESS_READWRITE; - } else if (flag & APR_READ) { - mflags |= OPEN_ACCESS_READONLY; - } else if (flag & APR_WRITE) { - mflags |= OPEN_ACCESS_WRITEONLY; - } else { - dafile->filedes = -1; - return APR_EACCES; - } - - dafile->buffered = (flag & APR_BUFFERED) > 0; - - if (flag & APR_CREATE) { - oflags |= OPEN_ACTION_CREATE_IF_NEW; - if (!(flag & APR_EXCL)) { - if (flag & APR_APPEND) - oflags |= OPEN_ACTION_OPEN_IF_EXISTS; - else - oflags |= OPEN_ACTION_REPLACE_IF_EXISTS; - } - } - - if ((flag & APR_EXCL) && !(flag & APR_CREATE)) - return APR_EACCES; - - if (flag & APR_TRUNCATE) { - oflags |= OPEN_ACTION_REPLACE_IF_EXISTS; - } - - rv = DosOpen(fname, (HFILE *)&(dafile->filedes), &action, 0, 0, oflags, mflags, NULL); - - if (rv == 0 && (flag & APR_APPEND)) { - ULONG newptr; - rv = DosSetFilePtr(dafile->filedes, 0, FILE_END, &newptr ); - - if (rv) - DosClose(dafile->filedes); - } - - if (rv != 0) - return os2errno(rv); - - dafile->isopen = TRUE; - dafile->fname = ap_pstrdup(cntxt, fname); - ap_register_cleanup(dafile->cntxt, dafile, file_cleanup, NULL); - return APR_SUCCESS; -} - - - -ap_status_t ap_close(ap_file_t *file) -{ - ULONG rc; - - if (file && file->isopen) { - rc = DosClose(file->filedes); - - if (rc == 0) { - file->isopen = FALSE; - return APR_SUCCESS; - } else { - return os2errno(rc); - } - } - - return APR_SUCCESS; -} - - - -ap_status_t ap_remove_file(ap_context_t *cntxt, char *path) -{ - ULONG rc = DosDelete(path); - return os2errno(rc); -} - diff --git a/file_io/os2/pipe.c b/file_io/os2/pipe.c deleted file mode 100644 index 50595d700..000000000 --- a/file_io/os2/pipe.c +++ /dev/null @@ -1,98 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <string.h> - -ap_status_t ap_create_pipe(ap_context_t *cont, struct file_t **in, struct file_t **out) -{ - ULONG filedes[2]; - ULONG rc; - - rc = DosCreatePipe(filedes, filedes+1, 4096); - - if (rc) { - return os2errno(rc); - } - - (*in) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - (*in)->cntxt = cont; - (*in)->filedes = filedes[0]; - (*in)->fname = ap_pstrdup(cont, "PIPE"); - (*in)->isopen = TRUE; - ap_register_cleanup(cont, *in, file_cleanup, NULL); - - (*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - (*out)->cntxt = cont; - (*out)->filedes = filedes[1]; - (*out)->fname = ap_pstrdup(cont, "PIPE"); - (*out)->isopen = TRUE; - ap_register_cleanup(cont, *out, file_cleanup, NULL); - - return APR_SUCCESS; -} - - - -ap_status_t ap_create_namedpipe(ap_context_t *cont, char *dirpath, ap_fileperms_t perm, char **new) -{ - /* Not yet implemented, interface not suitable */ - return -1; -} - - diff --git a/file_io/os2/readwrite.c b/file_io/os2/readwrite.c deleted file mode 100644 index b3740b3e9..000000000 --- a/file_io/os2/readwrite.c +++ /dev/null @@ -1,105 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" - -#define INCL_DOS -#include <os2.h> - -ap_status_t ap_read(const struct file_t *thefile, void *buf, ap_ssize_t *nbytes) -{ - ULONG rc; - ULONG bytesread; - - if (!thefile->isopen) { - *nbytes = 0; - return APR_EBADF; - } - - rc = DosRead(thefile->filedes, buf, *nbytes, &bytesread); - - if (rc) { - *nbytes = 0; - return os2errno(rc); - } - - *nbytes = bytesread; - return APR_SUCCESS; -} - - - -ap_status_t ap_write(struct file_t *thefile, void *buf, ap_ssize_t *nbytes) -{ - ULONG rc; - ULONG byteswritten; - - if (!thefile->isopen) { - *nbytes = 0; - return APR_EBADF; - } - - rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten); - - if (rc) { - *nbytes = 0; - return os2errno(rc); - } - - *nbytes = byteswritten; - return APR_SUCCESS; -} diff --git a/file_io/os2/seek.c b/file_io/os2/seek.c deleted file mode 100644 index 847233dac..000000000 --- a/file_io/os2/seek.c +++ /dev/null @@ -1,88 +0,0 @@ -/* ==================================================================== - * 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 - * 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. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include <string.h> -#include <io.h> - -#define INCL_DOS -#include <os2.h> - -int os2errno( ULONG oserror ); - -ap_status_t ap_seek(struct file_t *thefile, ap_seek_where_t where, ap_off_t *offset) -{ - if (!thefile->isopen) { - return APR_EBADF; - } - - switch (where) { - case APR_SET: - where = FILE_BEGIN; - break; - - case APR_CUR: - where = FILE_CURRENT; - break; - - case APR_END: - where = FILE_END; - break; - } - - return os2errno(DosSetFilePtr(thefile->filedes, *offset, where, (ULONG *)&offset)); -} |
