rbb 99/06/02 12:51:55
Modified: apr/misc/win32 misc.def names.c start.c Log: Changes to allow misc stuff to build after this mornings changes. Revision Changes Path 1.2 +2 -1 apache-apr/apr/misc/win32/misc.def Index: misc.def =================================================================== RCS file: /home/cvs/apache-apr/apr/misc/win32/misc.def,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- misc.def 1999/06/01 19:29:00 1.1 +++ misc.def 1999/06/02 19:51:48 1.2 @@ -11,4 +11,5 @@ ap_set_signal_safe @4 ap_set_cancel_safe @5 ap_destroy_context @6 - WinTimeToUnixTime @7 \ No newline at end of file + WinTimeToUnixTime @7 + ap_get_oslevel @8 1.2 +9 -9 apache-apr/apr/misc/win32/names.c Index: names.c =================================================================== RCS file: /home/cvs/apache-apr/apr/misc/win32/names.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- names.c 1999/06/01 19:29:00 1.1 +++ names.c 1999/06/02 19:51:49 1.2 @@ -84,7 +84,7 @@ * is present on the existing path. This routine also * converts alias names to long names. */ -API_EXPORT(char *) ap_os_systemcase_filename(ap_pool_t *pPool, +API_EXPORT(char *) ap_os_systemcase_filename(struct context_t *pCont, const char *szFile) { char buf[HUGE_STRING_LEN]; @@ -96,10 +96,10 @@ WIN32_FIND_DATA wfd; if (!szFile || strlen(szFile) == 0 || strlen(szFile) >= sizeof(buf)) - return ap_pstrdup(pPool, ""); + return ap_pstrdup(pCont, ""); buf[0] = '\0'; - pInputName = ap_pstrdup(pPool, szFile); + pInputName = ap_pstrdup(pCont, szFile); /* First convert all slashes to \ so Win32 calls work OK */ for (p = pInputName; *p; p++) { @@ -197,13 +197,13 @@ *p = '/'; } - return ap_pstrdup(pPool, buf); + return ap_pstrdup(pCont, buf); } /* Perform canonicalization with the exception that the * input case is preserved. */ -char * canonical_filename(ap_pool_t *pPool, const char *szFile) +char * canonical_filename(struct context_t *pCont, const char *szFile) { char *pNewStr; char *s; @@ -211,9 +211,9 @@ char *q; if (szFile == NULL || strlen(szFile) == 0) - return ap_pstrdup(pPool, ""); + return ap_pstrdup(pCont, ""); - pNewStr = ap_pstrdup(pPool, szFile); + pNewStr = ap_pstrdup(pCont, szFile); /* Change all '\' characters to '/' characters. * While doing this, remove any trailing '.'. @@ -276,7 +276,7 @@ * ap_os_systemcase_filename to examine the filesystem * and possibly extract the long name. */ - pConvertedName = ap_os_systemcase_filename(pPool, pNewStr); + pConvertedName = ap_os_systemcase_filename(pCont, pNewStr); /* Since we want to preserve the incoming case as much * as we can, compare for differences in the string and @@ -311,7 +311,7 @@ } while (p != NULL); - pNewStr = ap_pstrdup(pPool, buf); + pNewStr = ap_pstrdup(pCont, buf); } } return pNewStr; 1.2 +35 -2 apache-apr/apr/misc/win32/start.c Index: start.c =================================================================== RCS file: /home/cvs/apache-apr/apr/misc/win32/start.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- start.c 1999/06/01 19:29:00 1.1 +++ start.c 1999/06/02 19:51:49 1.2 @@ -54,6 +54,7 @@ */ #include "apr_win.h" +#include "misc.h" #include "apr_general.h" #include "apr_errno.h" #include "apr_pools.h" @@ -74,8 +75,14 @@ if (pool == NULL) { return APR_ENOPOOL; - } - new = (ap_context_t *)ap_palloc(pool, sizeof(ap_context_t)); + } + + if (cont) { + new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t)); + } + else { + new = (ap_context_t *)malloc(sizeof(ap_context_t)); + } new->pool = pool; if (data == NULL && cont) { new->prog_data = cont->prog_data; @@ -118,5 +125,31 @@ { ap_destroy_pool(cont->pool); return APR_SUCCESS; +} + +ap_status_t ap_get_oslevel(ap_context_t *cont, ap_oslevel_e *level) +{ + static OSVERSIONINFO oslev; + static BOOL first = TRUE; + + if (first) { + first = FALSE; + GetVersionEx(&oslev); + } + if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT) { + (*level) = APR_WIN_NT; + return APR_SUCCESS; + } + else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { + if (oslev.dwMinorVersion == 0) { + (*level) = APR_WIN_95; + return APR_SUCCESS; + } + else if (oslev.dwMinorVersion > 0) { + (*level) = APR_WIN_98; + return APR_SUCCESS; + } + } + return APR_EEXIST; }