diff options
Diffstat (limited to 'file_io/win32')
-rw-r--r-- | file_io/win32/.test.swp | bin | 12288 -> 0 bytes | |||
-rw-r--r-- | file_io/win32/dir.c | 233 | ||||
-rw-r--r-- | file_io/win32/file_io.def | 40 | ||||
-rw-r--r-- | file_io/win32/file_io.dsp | 130 | ||||
-rw-r--r-- | file_io/win32/fileacc.c | 186 | ||||
-rw-r--r-- | file_io/win32/filedup.c | 87 | ||||
-rw-r--r-- | file_io/win32/fileio.h | 121 | ||||
-rw-r--r-- | file_io/win32/filestat.c | 78 | ||||
-rw-r--r-- | file_io/win32/open.c | 195 | ||||
-rw-r--r-- | file_io/win32/pipe.c | 101 | ||||
-rw-r--r-- | file_io/win32/readdir.c | 80 | ||||
-rw-r--r-- | file_io/win32/readdir.h | 36 | ||||
-rw-r--r-- | file_io/win32/readwrite.c | 181 | ||||
-rw-r--r-- | file_io/win32/seek.c | 90 |
14 files changed, 0 insertions, 1558 deletions
diff --git a/file_io/win32/.test.swp b/file_io/win32/.test.swp Binary files differdeleted file mode 100644 index 8cb1a36d9..000000000 --- a/file_io/win32/.test.swp +++ /dev/null diff --git a/file_io/win32/dir.c b/file_io/win32/dir.c deleted file mode 100644 index 1c4741147..000000000 --- a/file_io/win32/dir.c +++ /dev/null @@ -1,233 +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/>. - * - */ -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_DIRENT_H -#include <dirent.h> -#endif -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif -#ifdef WIN32 -#include "apr_win.h" -#include <windows.h> -#endif -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include "apr_portable.h" - -ap_status_t dir_cleanup(void *thedir) -{ - struct dir_t *dir = thedir; - if (CloseHandle(dir->dirhand) == 0) { - return APR_SUCCESS; - } - else { - return errno; - } -} - -ap_status_t ap_opendir(ap_context_t *cont, const char *dirname, struct dir_t **new) -{ - char * temp; - (*new) = ap_palloc(cont, sizeof(struct dir_t)); - (*new)->cntxt = cont; - (*new)->entry = NULL; - temp = canonical_filename((*new)->cntxt, dirname); - if (temp[strlen(temp)] == '/') { - (*new)->dirname = ap_pstrcat(cont, dirname, "*", NULL); - } - else { - (*new)->dirname = ap_pstrcat(cont, dirname, "/*", NULL); - } - (*new)->dirhand = INVALID_HANDLE_VALUE; - ap_register_cleanup((*new)->cntxt, (void *)(*new), dir_cleanup, NULL); - return APR_SUCCESS; -} - -ap_status_t ap_closedir(struct dir_t *thedir) -{ - if (FindClose(thedir->dirhand)) { - ap_kill_cleanup(thedir->cntxt, thedir, dir_cleanup); - return APR_SUCCESS; - } - return APR_EEXIST; -} - -ap_status_t ap_readdir(struct dir_t *thedir) -{ - if (thedir->dirhand == INVALID_HANDLE_VALUE) { - thedir->entry = ap_palloc(thedir->cntxt, sizeof(WIN32_FIND_DATA)); - thedir->dirhand = FindFirstFile(thedir->dirname, thedir->entry); - if (thedir->dirhand == INVALID_HANDLE_VALUE) { - return APR_EEXIST; - } - return APR_SUCCESS; - } - if (FindNextFile(thedir->dirhand, thedir->entry)) { - return APR_SUCCESS; - } - return APR_EEXIST; -} - -ap_status_t ap_rewinddir(struct dir_t *thedir) -{ - ap_status_t stat; - ap_context_t *cont = thedir->cntxt; - char *temp = strdup(thedir->dirname); - temp[strlen(temp) - 2] = '\0'; /*remove the \* at the end */ - if (thedir->dirhand == INVALID_HANDLE_VALUE) { - return APR_SUCCESS; - } - if ((stat = ap_closedir(thedir)) == APR_SUCCESS) { - if ((stat = ap_opendir(cont, temp, &thedir)) == APR_SUCCESS) { - ap_readdir(thedir); - return APR_SUCCESS; - } - } - return stat; -} - -ap_status_t ap_make_dir(ap_context_t *cont, const char *path, ap_fileperms_t perm) -{ - if (CreateDirectory(path, NULL)) { - return APR_SUCCESS; - } - return APR_EEXIST; -} - -ap_status_t ap_remove_dir(ap_context_t *cont, const char *path) -{ -DWORD huh; - char *temp = canonical_filename(cont, path); - if (RemoveDirectory(temp)) { - return APR_SUCCESS; - } - huh = GetLastError(); - return APR_EEXIST; -} - -ap_status_t ap_dir_entry_size(struct dir_t *thedir, ap_ssize_t *size) -{ - if (thedir == NULL || thedir->entry == NULL) { - return APR_ENODIR; - } - (*size) = (thedir->entry->nFileSizeHigh * MAXDWORD) + - thedir->entry->nFileSizeLow; - return APR_SUCCESS; -} - -ap_status_t ap_dir_entry_mtime(struct dir_t *thedir, time_t *time) -{ - if (thedir == NULL || thedir->entry == NULL) { - return APR_ENODIR; - } - - *time = WinTimeToUnixTime(&thedir->entry->ftLastWriteTime); - - return APR_SUCCESS; -} - -ap_status_t ap_dir_entry_ftype(struct dir_t *thedir, ap_filetype_e *type) -{ - switch(thedir->entry->dwFileAttributes) { - case FILE_ATTRIBUTE_DIRECTORY: { - (*type) = APR_DIR; - return APR_SUCCESS; - } - case FILE_ATTRIBUTE_NORMAL: { - (*type) = APR_REG; - return APR_SUCCESS; - } - default: { - (*type) = APR_REG; /* As valid as anything else.*/ - return APR_SUCCESS; - } - } -} - -ap_status_t ap_get_dir_filename(struct dir_t *thedir, char **new) -{ - (*new) = ap_pstrdup(thedir->cntxt, thedir->entry->cFileName); - return APR_SUCCESS; -} - -ap_status_t ap_get_os_dir(struct dir_t *dir, ap_os_dir_t *thedir) -{ - if (dir == NULL) { - return APR_ENODIR; - } - thedir = dir->dirhand; - return APR_SUCCESS; -} - -ap_status_t ap_put_os_dir(ap_context_t *cont, struct dir_t **dir, - ap_os_dir_t *thedir) -{ - if (cont == NULL) { - return APR_ENOCONT; - } - if ((*dir) == NULL) { - (*dir) = (struct dir_t *)ap_palloc(cont, sizeof(struct dir_t)); - (*dir)->cntxt = cont; - } - (*dir)->dirhand = thedir; - return APR_SUCCESS; -} diff --git a/file_io/win32/file_io.def b/file_io/win32/file_io.def deleted file mode 100644 index 58e099fc2..000000000 --- a/file_io/win32/file_io.def +++ /dev/null @@ -1,40 +0,0 @@ -; file_io.def : - -LIBRARY file_io -DESCRIPTION '' - -EXPORTS - ; Add new API calls to the end of this list. - ap_opendir @1 - ap_closedir @2 - ap_readdir @3 - ap_rewinddir @4 - ap_make_dir @5 - ap_remove_dir @6 - ap_dir_entry_size @7 - ap_dir_entry_mtime @8 - ap_dir_entry_ftype @9 - ap_get_dir_filename @10 - ap_get_filename @11 - ap_get_filesize @12 - ap_get_fileatime @13 - ap_get_filectime @14 - ap_get_filemtime @15 - ap_dupfile @16 - ap_getfileinfo @17 - ap_open @18 - ap_close @19 - ap_remove_file @20 - ap_create_pipe @21 - ap_read @22 - ap_write @23 - ap_seek @24 - ap_get_filedata @25 - ap_set_filedata @26 - ap_get_os_file @27 - ap_get_os_dir @28 - ap_putc @29 - ap_getc @30 - ap_fprintf @31 - ap_eof @32 -
\ No newline at end of file diff --git a/file_io/win32/file_io.dsp b/file_io/win32/file_io.dsp deleted file mode 100644 index 6ebaca734..000000000 --- a/file_io/win32/file_io.dsp +++ /dev/null @@ -1,130 +0,0 @@ -# Microsoft Developer Studio Project File - Name="file_io" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=file_io - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "file_io.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "file_io.mak" CFG="file_io - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "file_io - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "file_io - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "file_io - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include ..\..\inc" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "file_io - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /I "..\..\include" /I "..\..\inc" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\misc\win32\Debug\misc.lib ..\..\lib\Debug\lib.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "file_io - Win32 Release" -# Name "file_io - Win32 Debug" -# Begin Source File - -SOURCE=.\dir.c -# End Source File -# Begin Source File - -SOURCE=.\file_io.def -# End Source File -# Begin Source File - -SOURCE=.\fileacc.c -# End Source File -# Begin Source File - -SOURCE=.\filedup.c -# End Source File -# Begin Source File - -SOURCE=.\fileio.h -# End Source File -# Begin Source File - -SOURCE=.\filestat.c -# End Source File -# Begin Source File - -SOURCE=.\open.c -# End Source File -# Begin Source File - -SOURCE=.\pipe.c -# End Source File -# Begin Source File - -SOURCE=.\readwrite.c -# End Source File -# Begin Source File - -SOURCE=.\seek.c -# End Source File -# End Target -# End Project diff --git a/file_io/win32/fileacc.c b/file_io/win32/fileacc.c deleted file mode 100644 index 270b397c5..000000000 --- a/file_io/win32/fileacc.c +++ /dev/null @@ -1,186 +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; - } -} - -/*mode_t get_fileperms(ap_fileperms_t mode) -{ - mode_t rv = 0; - - if (mode & APR_UREAD) - rv |= S_IRUSR; - if (mode & APR_UWRITE) - rv |= S_IWUSR; - if (mode & APR_UEXECUTE) - rv |= S_IXUSR; - - if (mode & APR_GREAD) - rv |= S_IRGRP; - if (mode & APR_GWRITE) - rv |= S_IWGRP; - if (mode & APR_GEXECUTE) - rv |= S_IXGRP; - - if (mode & APR_WREAD) - rv |= S_IROTH; - if (mode & APR_WWRITE) - rv |= S_IWOTH; - if (mode & APR_WEXECUTE) - rv |= S_IXOTH; - - return rv; -}*/ - -ap_status_t ap_get_filesize(struct file_t *file, ap_ssize_t *size) -{ - if (file != NULL) { - *size = file->size; - return APR_SUCCESS; - } - else { - *size = -1; - return APR_ENOFILE; - } -} -/* -ap_status_t ap_get_fileperms(struct file_t *file, ap_fileperms_t *perm) -{ - if (file != NULL) { - *perm = file->protection; - return APR_SUCCESS; - } - else { - *perm = -1; - return APR_ENOFILE; - } -} -*/ -ap_status_t ap_get_fileatime(struct file_t *file, time_t *time) -{ - if (file != NULL) { - *time = file->atime; - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - -ap_status_t ap_get_filectime(struct file_t *file, time_t *time) -{ - if (file != NULL) { - *time = file->ctime; - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - -ap_status_t ap_get_filemtime(struct file_t *file, time_t *time) -{ - if (file != NULL) { - *time = file->mtime; - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - -ap_status_t ap_get_filedata(struct file_t *file, void *data) -{ - if (file != NULL) { - return ap_get_userdata(file->cntxt, &data); - } - else { - data = NULL; - return APR_ENOFILE; - } -} - -ap_status_t ap_set_filedata(struct file_t *file, void *data) -{ - if (file != NULL) { - return ap_set_userdata(file->cntxt, data); - } - else { - data = NULL; - return APR_ENOFILE; - } -} diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c deleted file mode 100644 index 2d3135a3b..000000000 --- a/file_io/win32/filedup.c +++ /dev/null @@ -1,87 +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_dupfile(struct file_t *old_file, struct file_t **new_file) -{ - (*new_file) = (struct file_t *)ap_palloc(old_file->cntxt, - sizeof(struct file_t)); - - if ((*new_file) == NULL) { - return APR_ENOMEM; - } - (*new_file)->cntxt = old_file->cntxt; - (*new_file)->filehand = old_file->filehand; - (*new_file)->fname = ap_pstrdup(old_file->cntxt, old_file->fname); - (*new_file)->demonfname = ap_pstrdup(old_file->cntxt, old_file->demonfname); - (*new_file)->lowerdemonfname = ap_pstrdup(old_file->cntxt, old_file->lowerdemonfname); - (*new_file)->buffered = old_file->buffered; - (*new_file)->append = old_file->append; - /* (*new_file)->protection = old_file->protection; - (*new_file)->user = old_file->user; - (*new_file)->group = old_file->group;*/ - (*new_file)->size = old_file->size; - (*new_file)->atime = old_file->atime; - (*new_file)->mtime = old_file->mtime; - (*new_file)->ctime = old_file->ctime; - ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), file_cleanup, NULL); - return APR_SUCCESS; -} - diff --git a/file_io/win32/fileio.h b/file_io/win32/fileio.h deleted file mode 100644 index 5bb8f9a6e..000000000 --- a/file_io/win32/fileio.h +++ /dev/null @@ -1,121 +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 - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_SYS_FCNTL_H -#include <fcntl.h> -#endif -#ifdef HAVE_TIME_H -#include <time.h> -#endif -#ifdef HAVE_DIRENT_H -#include <dirent.h> -#endif -#ifdef HAVE_UIO_H -#include <sys/uio.h> -#endif -#include "apr_win.h" -#include "apr_pools.h" -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_errno.h" - -struct file_t { - ap_context_t *cntxt; - HANDLE filehand; - char *fname; - char *demonfname; - char *lowerdemonfname; - int buffered; - int append; - int eof_hit; -/* mode_t protection; - uid_t user; - gid_t group;*/ - off_t size; - time_t atime; - time_t mtime; - time_t ctime; -}; - -struct dir_t { - ap_context_t *cntxt; - char *dirname; - HANDLE dirhand; - WIN32_FIND_DATA *entry; -}; - -struct iovec_t { - ap_context_t *cntxt; - struct iovec *iovec; -}; - -ap_status_t file_cleanup(void *); -/*mode_t get_fileperms(ap_fileperms_t); -*/ -API_EXPORT(char *) ap_os_systemcase_filename(struct context_t *pCont, - const char *szFile); -char * canonical_filename(struct context_t *pCont, const char *szFile); - -#endif /* ! FILE_IO_H */ - diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c deleted file mode 100644 index d11449de7..000000000 --- a/file_io/win32/filestat.c +++ /dev/null @@ -1,78 +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_win.h" -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_errno.h" - -ap_status_t ap_getfileinfo(struct file_t *thefile) -{ - FILETIME atime, ctime, mtime; - -/* thefile->protection = info.st_mode; - thefile->user = info.st_uid; - thefile->group = info.st_gid;*/ - thefile->size = GetFileSize(thefile->filehand, NULL); - GetFileTime(thefile->filehand, &ctime, &atime, &mtime); - thefile->atime = WinTimeToUnixTime(&atime); - thefile->mtime = WinTimeToUnixTime(&mtime); - thefile->ctime = WinTimeToUnixTime(&ctime); - return APR_SUCCESS; -} - - - diff --git a/file_io/win32/open.c b/file_io/win32/open.c deleted file mode 100644 index a539ee190..000000000 --- a/file_io/win32/open.c +++ /dev/null @@ -1,195 +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/>. - * - */ -#ifdef WIN32 -#include "apr_win.h" -#endif -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include <errno.h> -#include <string.h> -#include <sys/stat.h> - -ap_status_t file_cleanup(void *thefile) -{ - struct file_t *file = thefile; - if (CloseHandle(file->filehand)) { - file->filehand = INVALID_HANDLE_VALUE; - return APR_SUCCESS; - } - else { - return APR_EEXIST; - /* Are there any error conditions other than EINTR or EBADF? */ - } -} - -ap_status_t ap_open(ap_context_t *cont, char *fname, ap_int32_t flag, ap_fileperms_t perm, - struct file_t **dafile) -{ - DWORD oflags = 0; - DWORD createflags = 0; - DWORD theerror; - /*mode_t mode = get_fileperms(perm);*/ - - (*dafile) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - - (*dafile)->cntxt = cont; - - if (flag & APR_READ) { - oflags |= GENERIC_READ; - } - if (flag & APR_WRITE) { - oflags |= GENERIC_WRITE; - } - if (!(flag & APR_READ) && !(flag & APR_WRITE)) { - (*dafile)->filehand = INVALID_HANDLE_VALUE; - return APR_EACCES; - } - - if (flag & APR_BUFFERED) { - (*dafile)->buffered = FALSE; - } - (*dafile)->fname = strdup(fname); - - (*dafile)->demonfname = canonical_filename((*dafile)->cntxt, fname); - (*dafile)->lowerdemonfname = strlwr((*dafile)->demonfname); - - createflags = OPEN_ALWAYS; - if (flag & APR_CREATE) { - if (flag & APR_EXCL) { - createflags = CREATE_NEW; - } - } - if ((flag & APR_EXCL) && !(flag & APR_CREATE)) { - (*dafile)->filehand = INVALID_HANDLE_VALUE; - return APR_EACCES; - } - - if (flag & APR_APPEND) { - (*dafile)->append = 1; - } - else { - (*dafile)->append = 0; - } - - if (flag & APR_TRUNCATE) { - createflags = TRUNCATE_EXISTING; - } - - (*dafile)->filehand = CreateFile(fname, oflags, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - NULL, createflags, FILE_ATTRIBUTE_NORMAL, 0); - - if ((*dafile)->filehand == INVALID_HANDLE_VALUE) { - theerror = GetLastError(); - return APR_EEXIST; - } - (*dafile)->eof_hit = 0; - return APR_SUCCESS; -} - -ap_status_t ap_close(struct file_t *file) -{ - ap_status_t stat; - if ((stat = file_cleanup(file)) == APR_SUCCESS) { - ap_kill_cleanup(file->cntxt, file, file_cleanup); - return APR_SUCCESS; - } - return stat; -} - -ap_status_t ap_remove_file(ap_context_t *cont, char *path) -{ - char *temp = canonical_filename(cont, path); - - if (DeleteFile(temp)) { - return APR_SUCCESS; - } - else { - return APR_EEXIST; - } -} - -ap_status_t ap_get_os_file(struct file_t *file, ap_os_file_t *thefile) -{ - if (file == NULL) { - return APR_ENOFILE; - } - thefile = &(file->filehand); - return APR_SUCCESS; -} - -ap_status_t ap_put_os_file(ap_context_t *cont, struct file_t **file, - ap_os_file_t *thefile) -{ - if (cont == NULL) { - return APR_ENOCONT; - } - if ((*file) == NULL) { - (*file) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - (*file)->cntxt = cont; - } - (*file)->filehand = *thefile; - return APR_SUCCESS; -} - -ap_status_t ap_eof(ap_file_t *fptr) -{ - if (fptr->eof_hit == 1) { - return APR_EOF; - } - APR_SUCCESS; -} diff --git a/file_io/win32/pipe.c b/file_io/win32/pipe.c deleted file mode 100644 index 9db2ab8d1..000000000 --- a/file_io/win32/pipe.c +++ /dev/null @@ -1,101 +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 <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> - -ap_status_t ap_create_pipe(ap_context_t *cont, struct file_t **in, struct file_t **out) -{ - SECURITY_ATTRIBUTES sa; - - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - sa.lpSecurityDescriptor = NULL; - - (*in) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - (*in)->cntxt = cont; - (*in)->fname = ap_pstrdup(cont, "PIPE"); - - (*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - (*out)->cntxt = cont; - (*out)->fname = ap_pstrdup(cont, "PIPE"); - - if (CreatePipe(&(*in)->filehand, &(*out)->filehand, &sa, 0) == -1) { - return errno; - } - - return APR_SUCCESS; -} - -/* -ap_status_t ap_create_namedpipe(ap_context_t *cont, char *dirpath, ap_fileperms_t perm, char **new) -{ - mode_t mode = get_fileperms(perm); - - *new = tempnam(dirpath, NULL); - if (mkfifo((*new), mode) == -1) { - return errno; - } - return APR_SUCCESS; -} -*/ - diff --git a/file_io/win32/readdir.c b/file_io/win32/readdir.c deleted file mode 100644 index c03c90d99..000000000 --- a/file_io/win32/readdir.c +++ /dev/null @@ -1,80 +0,0 @@ -#include <malloc.h> -#include <string.h> -#include <errno.h> - -#include "readdir.h" - -/********************************************************************** - * Implement dirent-style opendir/readdir/closedir on Window 95/NT - * - * Functions defined are opendir(), readdir() and closedir() with the - * same prototypes as the normal dirent.h implementation. - * - * Does not implement telldir(), seekdir(), rewinddir() or scandir(). - * The dirent struct is compatible with Unix, except that d_ino is - * always 1 and d_off is made up as we go along. - * - * The DIR typedef is not compatible with Unix. - **********************************************************************/ - -API_EXPORT(DIR *) opendir(const char *dir) -{ - DIR *dp; - char *filespec; - long handle; - int index; - - filespec = malloc(strlen(dir) + 2 + 1); - strcpy(filespec, dir); - index = strlen(filespec) - 1; - if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) - filespec[index] = '\0'; - strcat(filespec, "/*"); - - dp = (DIR *)malloc(sizeof(DIR)); - dp->offset = 0; - dp->finished = 0; - dp->dir = strdup(dir); - - if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) { - if (errno == ENOENT) - dp->finished = 1; - else - return NULL; - } - - dp->handle = handle; - free(filespec); - - return dp; -} - -API_EXPORT(struct dirent *) readdir(DIR *dp) -{ - if (!dp || dp->finished) return NULL; - - if (dp->offset != 0) { - if (_findnext(dp->handle, &(dp->fileinfo)) < 0) { - dp->finished = 1; - return NULL; - } - } - dp->offset++; - - strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME); - dp->dent.d_ino = 1; - dp->dent.d_reclen = strlen(dp->dent.d_name); - dp->dent.d_off = dp->offset; - - return &(dp->dent); -} - -API_EXPORT(int) closedir(DIR *dp) -{ - if (!dp) return 0; - _findclose(dp->handle); - if (dp->dir) free(dp->dir); - if (dp) free(dp); - - return 0; -} diff --git a/file_io/win32/readdir.h b/file_io/win32/readdir.h deleted file mode 100644 index d87fd1987..000000000 --- a/file_io/win32/readdir.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Structures and types used to implement opendir/readdir/closedir - * on Windows 95/NT. - */ - -#include <io.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> - -#ifndef API_EXPORT -# define API_EXPORT(type) __declspec(dllexport) type __stdcall -#endif - -/* struct dirent - same as Unix */ -struct dirent { - long d_ino; /* inode (always 1 in WIN32) */ - off_t d_off; /* offset to this dirent */ - unsigned short d_reclen; /* length of d_name */ - char d_name[_MAX_FNAME+1]; /* filename (null terminated) */ -}; - -/* typedef DIR - not the same as Unix */ -typedef struct { - long handle; /* _findfirst/_findnext handle */ - short offset; /* offset into directory */ - short finished; /* 1 if there are not more files */ - struct _finddata_t fileinfo; /* from _findfirst/_findnext */ - char *dir; /* the dir we are reading */ - struct dirent dent; /* the dirent to return */ -} DIR; - -/* Function prototypes */ -API_EXPORT(DIR *) opendir(const char *); -API_EXPORT(struct dirent *) readdir(DIR *); -API_EXPORT(int) closedir(DIR *); diff --git a/file_io/win32/readwrite.c b/file_io/win32/readwrite.c deleted file mode 100644 index 3e8c05a8b..000000000 --- a/file_io/win32/readwrite.c +++ /dev/null @@ -1,181 +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 "apr_errno.h" -#include <windows.h> - -ap_status_t ap_read(struct file_t *thefile, void *buf, ap_ssize_t *nbytes) -{ - DWORD bread; - int lasterror; - - if (thefile->filehand == INVALID_HANDLE_VALUE) { - *nbytes = -1; - return APR_EBADF; - } - - if (ReadFile(thefile->filehand, buf, *nbytes, &bread, NULL)) { - *nbytes = bread; - return APR_SUCCESS; - } - *nbytes = -1; - lasterror = GetLastError(); - return APR_EEXIST; -} - -ap_status_t ap_write(struct file_t *thefile, void *buf, ap_ssize_t *nbytes) -{ - DWORD bwrote; - FILETIME atime, mtime, ctime; - - if (thefile->filehand == INVALID_HANDLE_VALUE) { - *nbytes = -1; - return APR_EBADF; - } - - if (WriteFile(thefile->filehand, buf, *nbytes, &bwrote, NULL)) { - if (strcmp(thefile->fname, "PIPE")) { - FlushFileBuffers(thefile->filehand); - thefile->size = GetFileSize(thefile->filehand, NULL); - GetFileTime(thefile->filehand, &ctime, &atime, &mtime); - thefile->atime = WinTimeToUnixTime(&atime); - thefile->mtime = WinTimeToUnixTime(&mtime); - thefile->ctime = WinTimeToUnixTime(&ctime); - } - *nbytes = bwrote; - return APR_SUCCESS; - } - (*nbytes) = -1; - return APR_EEXIST; -} -/* -ap_status_t ap_writev(struct file_t *thefile, const struct iovec_t *vec, ap_ssize_t *iocnt) -{ - int bytes; - if ((bytes = writev(thefile->filedes, vec->iovec, *iocnt)) < 0) { - *iocnt = bytes; - return errno; - 12} - else { - *iocnt = bytes; - return APR_SUCCESS; - } -} -*/ - -ap_status_t ap_putc(ap_file_t *thefile, char ch) -{ - DWORD bwrote; - - if (WriteFile(thefile->filehand, &ch, 1, &bwrote, NULL)) { - return APR_EEXIST; - } - return APR_SUCCESS; -} - -ap_status_t ap_getc(ap_file_t *thefile, char *ch) -{ - DWORD bread; - if (!ReadFile(thefile->filehand, ch, 1, &bread, NULL)) { - return APR_EEXIST; - } - if (bread == 0) { - thefile->eof_hit = TRUE; - return APR_EOF; - } - return APR_SUCCESS; -} - -static int printf_flush(ap_vformatter_buff_t *vbuff) -{ - /* I would love to print this stuff out to the file, but I will - * get that working later. :) For now, just return. - */ - return -1; -} - -API_EXPORT(int) ap_fprintf(struct file_t *fptr, const char *format, ...) -{ - int cc; - va_list ap; - ap_vformatter_buff_t vbuff; - char *buf; - int len; - - buf = malloc(HUGE_STRING_LEN); - if (buf == NULL) { - return 0; - } - /* save one byte for nul terminator */ - vbuff.curpos = buf; - vbuff.endpos = buf + len - 1; - va_start(ap, format); -#if 0 - cc = ap_vformatter(printf_flush, &vbuff, format, ap); - va_end(ap); - *vbuff.curpos = '\0'; -#endif - vsprintf(buf, format, ap); - len = strlen(buf); - cc = ap_write(fptr, buf, &len); - va_end(ap); - return (cc == -1) ? len : cc; -} - - diff --git a/file_io/win32/seek.c b/file_io/win32/seek.c deleted file mode 100644 index fe1439c32..000000000 --- a/file_io/win32/seek.c +++ /dev/null @@ -1,90 +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 <errno.h> -#include <string.h> - -ap_status_t ap_seek(struct file_t *thefile, ap_seek_where_t where, ap_off_t *offset) -{ - DWORD howmove; - DWORD rv; - - switch(where) { - case APR_SET: { - howmove = FILE_BEGIN; - break; - } - case APR_CUR: { - howmove = FILE_CURRENT; - break; - } - case APR_END: { - howmove = FILE_END; - break; - } - } - - rv = SetFilePointer(thefile->filehand, *offset,NULL, howmove); - if (rv == -1) { - *offset = -1; - return APR_EEXIST; - } - else { - *offset = rv; - return APR_SUCCESS; - } -} |