diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2001-09-09 06:03:05 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2001-09-09 06:03:05 +0000 |
commit | ca38c6739721bb5f78005da21bd7ca6499c1e1c7 (patch) | |
tree | 2bfd46d5bb54ee12ff41ac1f18e8794f951f54d5 /file_io | |
parent | 7aa400295c6466171d9154c726e6f9b636877979 (diff) | |
download | apr-ca38c6739721bb5f78005da21bd7ca6499c1e1c7.tar.gz apr-ca38c6739721bb5f78005da21bd7ca6499c1e1c7.zip |
Fix the apr_proc_create for win32. In order to do so, this patch
introduces a flags arg for apr_filepath_get(), like apr_filepath_merge(),
that allows the APR_FILEPATH_NATIVE result format.
This launches win32 processes with the Unicode semantics (although it
runs sbcs apps equally well) and changes the default to 'not detached',
in sync with the unix default.
Finally, assures apr_filepath_get() uses the '/' semantics on OS2 by
default.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62296 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r-- | file_io/netware/filesys.c | 2 | ||||
-rw-r--r-- | file_io/os2/filesys.c | 26 | ||||
-rw-r--r-- | file_io/unix/filepath.c | 5 | ||||
-rw-r--r-- | file_io/win32/filepath.c | 4 | ||||
-rw-r--r-- | file_io/win32/filesys.c | 29 |
5 files changed, 37 insertions, 29 deletions
diff --git a/file_io/netware/filesys.c b/file_io/netware/filesys.c index e3f23ac63..a28d6f3f8 100644 --- a/file_io/netware/filesys.c +++ b/file_io/netware/filesys.c @@ -102,7 +102,7 @@ apr_status_t filepath_compare_drive(char *path1, char *path2, apr_pool_t *p) return -1; } -APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, +APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, apr_pool_t *p) { char path[APR_PATH_MAX]; diff --git a/file_io/os2/filesys.c b/file_io/os2/filesys.c index af55fbe8d..4f99c4867 100644 --- a/file_io/os2/filesys.c +++ b/file_io/os2/filesys.c @@ -100,7 +100,8 @@ apr_status_t filepath_root_test(char *path, apr_pool_t *p) } -apr_status_t filepath_drive_get(char **rootpath, char drive, apr_pool_t *p) +apr_status_t filepath_drive_get(char **rootpath, char drive, + apr_int32_t flags, apr_pool_t *p) { char path[APR_PATH_MAX]; char *pos; @@ -117,12 +118,11 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, apr_pool_t *p) return APR_FROM_OS_ERROR(rc); } - /* ###: We really should consider adding a flag to allow the user - * to have the APR_FILEPATH_NATIVE result - */ - for (pos=path; *pos; pos++) { - if (*pos == '\\') - *pos = '/'; + if (!(flags & APR_FILEPATH_NATIVE)) { + for (pos=path; *pos; pos++) { + if (*pos == '\\') + *pos = '/'; + } } *rootpath = apr_pstrdup(p, path); @@ -142,12 +142,14 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) } -APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, + apr_pool_t *p) { char path[APR_PATH_MAX]; ULONG drive; ULONG drivemap; ULONG rv, pathlen = sizeof(path) - 3; + char *pos; DosQueryCurrentDisk(&drive, &drivemap); path[0] = '@' + drive; @@ -155,6 +157,14 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_pool_t *p) rv = DosQueryCurrentDir(drive, path+3, &pathlen); *defpath = apr_pstrdup(p, path); + + if (!(flags & APR_FILEPATH_NATIVE)) { + for (pos=*defpath; *pos; pos++) { + if (*pos == '\\') + *pos = '/'; + } + } + return APR_SUCCESS; } diff --git a/file_io/unix/filepath.c b/file_io/unix/filepath.c index c7ae8ca5f..be4dd3b19 100644 --- a/file_io/unix/filepath.c +++ b/file_io/unix/filepath.c @@ -71,7 +71,8 @@ /* Any OS that requires/refuses trailing slashes should be dealt with here. */ -APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, + apr_pool_t *p) { char path[APR_PATH_MAX]; if (!getcwd(path, sizeof(path))) { @@ -170,7 +171,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, * passing the address of a char const* for a char** arg. */ char *getpath; - rv = apr_filepath_get(&getpath, p); + rv = apr_filepath_get(&getpath, apr_int32_t flags, p); rootpath = getpath; if (rv != APR_SUCCESS) return errno; diff --git a/file_io/win32/filepath.c b/file_io/win32/filepath.c index cef981ff8..8178757fe 100644 --- a/file_io/win32/filepath.c +++ b/file_io/win32/filepath.c @@ -418,10 +418,10 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, char *getpath; #ifndef NETWARE if (addtype == APR_EINCOMPLETE && addroot[1] == ':') - rv = filepath_drive_get(&getpath, addroot[0], p); + rv = filepath_drive_get(&getpath, addroot[0], flags, p); else #endif - rv = apr_filepath_get(&getpath, p); + rv = apr_filepath_get(&getpath, flags, p); if (rv != APR_SUCCESS) return rv; basepath = getpath; diff --git a/file_io/win32/filesys.c b/file_io/win32/filesys.c index 0c741f7a0..ba3d5b480 100644 --- a/file_io/win32/filesys.c +++ b/file_io/win32/filesys.c @@ -116,7 +116,8 @@ apr_status_t filepath_root_test(char *path, apr_pool_t *p) } -apr_status_t filepath_drive_get(char **rootpath, char drive, apr_pool_t *p) +apr_status_t filepath_drive_get(char **rootpath, char drive, + apr_int32_t flags, apr_pool_t *p) { char path[APR_PATH_MAX]; #if APR_HAS_UNICODE_FS @@ -149,12 +150,11 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, apr_pool_t *p) if (!GetFullPathName(drivestr, sizeof(path), path, &ignored)) return apr_get_os_error(); } - /* ###: We really should consider adding a flag to allow the user - * to have the APR_FILEPATH_NATIVE result - */ - for (*rootpath = path; **rootpath; ++*rootpath) { - if (**rootpath == '\\') - **rootpath = '/'; + if (!(flags & APR_FILEPATH_NATIVE)) { + for (*rootpath = path; **rootpath; ++*rootpath) { + if (**rootpath == '\\') + **rootpath = '/'; + } } *rootpath = apr_pstrdup(p, path); return APR_SUCCESS; @@ -201,7 +201,7 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) } -APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, +APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, apr_pool_t *p) { char path[APR_PATH_MAX]; @@ -222,12 +222,11 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, if (!GetCurrentDirectory(sizeof(path), path)) return apr_get_os_error(); } - /* ###: We really should consider adding a flag to allow the user - * to have the APR_FILEPATH_NATIVE result - */ - for (*rootpath = path; **rootpath; ++*rootpath) { - if (**rootpath == '\\') - **rootpath = '/'; + if (!(flags & APR_FILEPATH_NATIVE)) { + for (*rootpath = path; **rootpath; ++*rootpath) { + if (**rootpath == '\\') + **rootpath = '/'; + } } *rootpath = apr_pstrdup(p, path); return APR_SUCCESS; @@ -257,5 +256,3 @@ APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath, } return APR_SUCCESS; } - - |