cvs commit: apache-1.3/src/os/win32 os.h util_win32.c
manoj 98/11/05 11:20:18 Modified:src CHANGES src/include ap_config.h src/os/win32 os.h util_win32.c Log: Work around incomplete implementation of strftime on Win32. Revision ChangesPath 1.1134+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1133 retrieving revision 1.1134 diff -u -u -r1.1133 -r1.1134 --- CHANGES 1998/11/04 22:23:42 1.1133 +++ CHANGES 1998/11/05 19:20:14 1.1134 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Work around incomplete implementation of strftime on Win32. + [Manoj Kasichainula, Ken Parzygnat <[EMAIL PROTECTED]>] + *) Move a typedef to fix compile problems on Linux with 1.x kernels. [Manoj Kasichainula] PR#3177 1.243 +3 -0 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.242 retrieving revision 1.243 diff -u -u -r1.242 -r1.243 --- ap_config.h 1998/11/04 22:23:45 1.242 +++ ap_config.h 1998/11/05 19:20:16 1.243 @@ -938,6 +938,9 @@ #endif /* ndef WIN32 */ #include /* for ctime */ +#ifdef WIN32 +#define strftime(s,max,format,tm) os_strftime(s,max,format,tm) +#endif #include #include #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) 1.25 +2 -0 apache-1.3/src/os/win32/os.h Index: os.h === RCS file: /export/home/cvs/apache-1.3/src/os/win32/os.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -u -r1.24 -r1.25 --- os.h 1998/09/19 12:27:25 1.24 +++ os.h 1998/11/05 19:20:17 1.25 @@ -93,6 +93,8 @@ #define stat(f,ps) os_stat(f,ps) API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat); +API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, const struct tm *tm); + #define _spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv) #define spawnv(mode,cmdname,argv)os_spawnv(mode,cmdname,argv) API_EXPORT(int) os_spawnv(int mode,const char *cmdname,const char *const *argv); 1.27 +69 -0 apache-1.3/src/os/win32/util_win32.c Index: util_win32.c === RCS file: /export/home/cvs/apache-1.3/src/os/win32/util_win32.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -u -r1.26 -r1.27 --- util_win32.c 1998/10/01 04:52:32 1.26 +++ util_win32.c 1998/11/05 19:20:17 1.27 @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include "httpd.h" #include "http_log.h" @@ -415,4 +417,71 @@ va_end(vlist); return _spawnve(mode, szCmd, aszArgs, aszEnv); +} + +#undef strftime + +/* Partial replacement for strftime. This adds certain expandos to the + * Windows version + */ + +API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, +const struct tm *tm) { + /* If the new format string is bigger than max, the result string probably +* won't fit anyway. When %-expandos are added, made sure the padding below +* is enough. +*/ +char *new_format = (char *) _alloca(max + 11); +size_t i, j, format_length = strlen(format); +int return_value; +int length_written; + +for (i = 0, j = 0; (i < format_length && j < max)) { +if (format[i] != '%') { +new_format[j++] = format[i++]; +continue; +} +switch (format[i+1]) { +case 'D': +/* Is this locale dependent? Shouldn't be... + Also note the year 2000 exposure here */ +memcpy(new_format + j, "%m/%d/%y", 8); +i += 2; +j += 8; +break; +case 'r': +memcpy(new_format + j, "%I:%M:%S %p", 11); +i += 2; +j += 11; +break; +case 'T': +memcpy(new_format + j, "%H:%M:%S", 8); +i += 2; +j += 8; +break; +case 'e': +length_written = ap_snprintf(new_format + j, max - j, "%2d", +tm->tm_mday); +j = (length_written == -1) ? max : (j + length_written); +i += 2; +break; +/* Handle "%%" to avoid dying on strftime(out, 600, 1200 "%"'s) */ +case '%': +new_format[j++] = '%'; +
cvs commit: apache-1.3/src/os/win32 os.h util_win32.c
rse 98/04/13 11:05:21 Modified:src/include compat.h httpd.h src/main http_config.c http_core.c http_request.c util.c src/modules/standard mod_alias.c mod_autoindex.c mod_so.c mod_userdir.c src/os/bs2000 os-inline.c os.h src/os/emx os-inline.c os.h src/os/unix os-inline.c os.c os.h src/os/win32 os.h util_win32.c Log: Manually rename some symbols to again get the os-distinction which was lost in the big renaming procedure: ap_canonical_filename ap_os_canonical_filename ap_is_path_absolute ap_os_is_path_absolute ap_escape_path ap_os_escape_path ap_dso_handle_t ap_os_dso_handle_t ap_dso_error --> ap_os_dso_error ap_dso_sym ap_os_dso_sym ap_dso_unload ap_os_dso_unload ap_dso_load ap_os_dso_load Revision ChangesPath 1.3 +7 -7 apache-1.3/src/include/compat.h Index: compat.h === RCS file: /export/home/cvs/apache-1.3/src/include/compat.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- compat.h 1998/04/13 10:32:27 1.2 +++ compat.h 1998/04/13 18:05:09 1.3 @@ -208,9 +208,9 @@ #define open_logs ap_open_logs #define open_mutex ap_open_mutex #define open_piped_log ap_open_piped_log -#define os_canonical_filename ap_canonical_filename -#define os_escape_path ap_escape_path -#define os_is_path_absoluteap_is_path_absolute +#define os_canonical_filename ap_os_canonical_filename +#define os_escape_path ap_os_escape_path +#define os_is_path_absoluteap_os_is_path_absolute #define overlay_tables ap_overlay_tables #define palloc ap_palloc #define parseHTTPdate ap_parseHTTPdate @@ -389,9 +389,9 @@ #define util_uri_init ap_util_uri_init #define uudecode ap_uudecode #define vbprintf ap_vbprintf -#define os_dl_load ap_dso_load -#define os_dl_unload ap_dso_unload -#define os_dl_sym ap_dso_sym -#define os_dl_errorap_dso_error +#define os_dl_load ap_os_dso_load +#define os_dl_unload ap_os_dso_unload +#define os_dl_sym ap_os_dso_sym +#define os_dl_errorap_os_dso_error #endif /* APACHE_COMPAT_H */ 1.203 +4 -4 apache-1.3/src/include/httpd.h Index: httpd.h === RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.202 retrieving revision 1.203 diff -u -r1.202 -r1.203 --- httpd.h 1998/04/11 12:00:22 1.202 +++ httpd.h 1998/04/13 18:05:09 1.203 @@ -843,8 +843,8 @@ API_EXPORT(void) ap_no2slash(char *name); API_EXPORT(void) ap_getparents(char *name); API_EXPORT(char *) ap_escape_path_segment(pool *p, const char *s); -API_EXPORT(char *) ap_escape_path(pool *p, const char *path, int partial); -#define escape_uri(ppool,path) ap_escape_path(ppool,path,1) +API_EXPORT(char *) ap_os_escape_path(pool *p, const char *path, int partial); +#define escape_uri(ppool,path) ap_os_escape_path(ppool,path,1) API_EXPORT(char *) ap_escape_html(pool *p, const char *s); API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname, unsigned port, const request_rec *r); @@ -913,9 +913,9 @@ API_EXPORT(void) ap_chdir_file(const char *file); #ifndef HAVE_CANONICAL_FILENAME -#define ap_canonical_filename(p,f) (f) +#define ap_os_canonical_filename(p,f) (f) #else -API_EXPORT(char *) ap_canonical_filename(pool *p, const char *file); +API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file); #endif char *ap_get_local_host(pool *); 1.114 +2 -2 apache-1.3/src/main/http_config.c Index: http_config.c === RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v retrieving revision 1.113 retrieving revision 1.114 diff -u -r1.113 -r1.114 --- http_config.c 1998/04/11 12:00:28 1.113 +++ http_config.c 1998/04/13 18:05:10 1.114 @@ -983,7 +983,7 @@ so the server can be moved or mirrored with less pain. */ char *p; int offset = (int) (long) cmd->info; -if (ap_is_path_absolute(arg)) +if (ap_os_is_path_absolute(arg)) p = arg; else p = ap_make_full_path(cmd->pool, ap_server_root, arg); @@ -1001,7 +1001,