summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68>2000-04-15 17:48:16 +0000
committerstoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68>2000-04-15 17:48:16 +0000
commiteb4488faaf9b56f2f3c40800b80c5a128dec9ff7 (patch)
tree41938dc1206cc702b53a4a5e630ceb9d1be2e0d8
parent33d4761463a84dcbc2d1d3700a54b0c6474d0219 (diff)
downloadlibapr-eb4488faaf9b56f2f3c40800b80c5a128dec9ff7.tar.gz
Win32:
1. Move the space stripping of physical service names fix up from Apache 1.3. 2. #include'ing "ap_mpm.h" fixes up an unresolved symbol. 3. Add dependency checking to the CreateService call to ensure TCPIP and AFP (winsock) is started before Apache. Submitted by: William Rowe Reviewed by: Bill Stoddard git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59865 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--aprlib.def1
-rw-r--r--include/apr_lib.h2
-rw-r--r--lib/apr_cpystrn.c30
-rw-r--r--libapr.def1
4 files changed, 30 insertions, 4 deletions
diff --git a/aprlib.def b/aprlib.def
index 6803daf2b..bc9d48936 100644
--- a/aprlib.def
+++ b/aprlib.def
@@ -241,3 +241,4 @@ EXPORTS
ap_dso_unload @220
ap_dso_sym @221
ap_dso_init @222
+ ap_collapse_spaces @223 \ No newline at end of file
diff --git a/include/apr_lib.h b/include/apr_lib.h
index b58b6ff44..18bc28484 100644
--- a/include/apr_lib.h
+++ b/include/apr_lib.h
@@ -130,6 +130,8 @@ API_EXPORT(char *) ap_cpystrn(char *d, const char *s, size_t l);
API_EXPORT(int) ap_tokenize_to_argv(ap_pool_t *token_context,
char *arg_str, char ***argv_out);
API_EXPORT(const char *) ap_filename_of_pathname(const char *pathname);
+API_EXPORT(char *) ap_collapse_spaces(char *dest, const char *src);
+
/*API_EXPORT(ap_mutex_t *) ap_create_mutex(void *m);*/
API_EXPORT(int) ap_slack(int l, int h);
API_EXPORT_NONSTD(ap_status_t) ap_execle(const char *c, const char *a, ...);
diff --git a/lib/apr_cpystrn.c b/lib/apr_cpystrn.c
index bfd62ca44..952904a90 100644
--- a/lib/apr_cpystrn.c
+++ b/lib/apr_cpystrn.c
@@ -200,17 +200,39 @@ API_EXPORT(int) ap_tokenize_to_argv(ap_pool_t *token_context,
* "/foo/bar/gum/" -> ""
* "gum" -> "gum"
* "wi\\n32\\stuff" -> "stuff
+ *
+ * Corrected Win32 to accept "a/b\\stuff", "a:stuff"
*/
const char *ap_filename_of_pathname(const char *pathname)
{
-#ifdef WIN32
- const char path_separator = '\\';
-#else
const char path_separator = '/';
-#endif
const char *s = strrchr(pathname, path_separator);
+#ifdef WIN32
+ const char path_separator_win = '\\';
+ const char drive_separator_win = ':';
+ const char *s2 = strrchr(pathname, path_separator_win);
+
+ if (s2 > s) s = s2;
+
+ if (!s) s = strrchr(pathname, drive_separator_win);
+#endif
+
return s ? ++s : pathname;
}
+/* length of dest assumed >= length of src
+ * collapse in place (src == dest) is legal.
+ * returns terminating null ptr to dest string.
+ */
+API_EXPORT(char *) ap_collapse_spaces(char *dest, const char *src)
+{
+ while (*src) {
+ if (!ap_isspace(*src))
+ *dest++ = *src;
+ ++src;
+ }
+ *dest = 0;
+ return (dest);
+}
diff --git a/libapr.def b/libapr.def
index 6803daf2b..bc9d48936 100644
--- a/libapr.def
+++ b/libapr.def
@@ -241,3 +241,4 @@ EXPORTS
ap_dso_unload @220
ap_dso_sym @221
ap_dso_init @222
+ ap_collapse_spaces @223 \ No newline at end of file