cvs commit: apache-2.0/src/modules/standard mod_log_config.c
rbb 99/12/30 10:31:30 Modified:src/lib/apr/include apr_time.h src/lib/apr/time/unix timestr.c src/main util.c src/modules/standard mod_log_config.c Log: Some changes to the ap_strftime function. We now inform the user of the length of the string written, and we return a status code. I expect the status code to mean a bit more on Windows than it currently does on Unix. Revision ChangesPath 1.7 +1 -1 apache-2.0/src/lib/apr/include/apr_time.h Index: apr_time.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_time.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- apr_time.h1999/12/21 21:16:19 1.6 +++ apr_time.h1999/12/30 18:31:27 1.7 @@ -77,7 +77,7 @@ ap_status_t ap_implode_time(ap_time_t *); ap_status_t ap_timestr(char **date_str, struct atime_t *t, ap_timetype_e type, ap_context_t *p); -ap_status_t ap_strftime(char *s, ap_size_t max, const char *format, ap_time_t *tm); +ap_status_t ap_strftime(char *s, ap_int32_t *retsize, ap_size_t max, const char *format, ap_time_t *tm); /* accessor functions */ ap_status_t ap_get_curtime(ap_time_t *, ap_int64_t *); 1.3 +4 -2 apache-2.0/src/lib/apr/time/unix/timestr.c Index: timestr.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/timestr.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- timestr.c 1999/12/21 16:21:43 1.2 +++ timestr.c 1999/12/30 18:31:28 1.3 @@ -126,8 +126,10 @@ */ } -ap_status_t ap_strftime(char *s, ap_size_t max, const char *format, struct atime_t *tm) +ap_status_t ap_strftime(char *s, ap_int32_t *retsize, ap_size_t max, +const char *format, struct atime_t *tm) { -strftime(s, max, format, tm-explodedtime); +(*retsize) = strftime(s, max, format, tm-explodedtime); +return APR_SUCCESS; } 1.22 +2 -1 apache-2.0/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-2.0/src/main/util.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- util.c1999/12/21 21:41:48 1.21 +++ util.c1999/12/30 18:31:28 1.22 @@ -126,6 +126,7 @@ API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t *t, const char *fmt, int gmt) { +ap_int32_t retcode; char ts[MAX_STRING_LEN]; char tf[MAX_STRING_LEN]; @@ -170,7 +171,7 @@ } /* check return code? */ -ap_strftime(ts, MAX_STRING_LEN, fmt, t); +ap_strftime(ts, retcode, MAX_STRING_LEN, fmt, t); ts[MAX_STRING_LEN - 1] = '\0'; return ap_pstrdup(p, ts); } 1.12 +2 -1 apache-2.0/src/modules/standard/mod_log_config.c Index: mod_log_config.c === RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_log_config.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- mod_log_config.c 1999/12/21 21:41:53 1.11 +++ mod_log_config.c 1999/12/30 18:31:29 1.12 @@ -384,12 +384,13 @@ ap_int32_t mday, year, hour, min, sec, month; ap_time_t *t; char tstr[MAX_STRING_LEN]; +ap_int32_t retcode; ap_make_time(t, r-pool); ap_get_gmtoff(timz, t, r-pool); if (a *a) { /* Custom format */ -ap_strftime(tstr, MAX_STRING_LEN, a, t); +ap_strftime(tstr, retcode, MAX_STRING_LEN, a, t); } else { /* CLF format */ char sign = (timz 0 ? '-' : '+');
cvs commit: apache-2.0/src/modules/standard mod_log_config.c
rbb 99/12/21 13:41:55 Modified:src configure.in src/include httpd.h util_date.h src/main config.h.stub util.c util_date.c src/modules/standard mod_log_config.c Log: Remove a bunch of functions that are being replaced by functions in APR. Also finished porting Apache to use APR in most cases. Revision ChangesPath 1.14 +0 -1 apache-2.0/src/configure.in Index: configure.in === RCS file: /home/cvs/apache-2.0/src/configure.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- configure.in 1999/12/20 05:03:01 1.13 +++ configure.in 1999/12/21 21:41:40 1.14 @@ -83,7 +83,6 @@ strerror \ initgroups \ waitpid \ -difftime \ gettimeofday \ memmove \ bzero \ 1.16 +0 -1 apache-2.0/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- httpd.h 1999/12/20 16:38:32 1.15 +++ httpd.h 1999/12/21 21:41:43 1.16 @@ -914,7 +914,6 @@ */ /* Time */ -API_EXPORT(struct tm *) ap_get_gmtoff(int *tz); API_EXPORT(char *) ap_get_time(void); API_EXPORT(char *) ap_field_noparam(ap_context_t *p, const char *intype); API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t *t, const char *fmt, int gmt); 1.5 +0 -1 apache-2.0/src/include/util_date.h Index: util_date.h === RCS file: /home/cvs/apache-2.0/src/include/util_date.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- util_date.h 1999/12/20 16:38:33 1.4 +++ util_date.h 1999/12/21 21:41:43 1.5 @@ -76,7 +76,6 @@ #define BAD_DATE (time_t)0 API_EXPORT(int) ap_checkmask(const char *data, const char *mask); -API_EXPORT(time_t) ap_tm2sec(const struct tm *t); API_EXPORT(ap_time_t *) ap_parseHTTPdate(const char *date, ap_context_t *cont); #ifdef __cplusplus 1.4 +0 -3 apache-2.0/src/main/Attic/config.h.stub 1.21 +6 -43 apache-2.0/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-2.0/src/main/util.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- util.c1999/12/20 16:38:35 1.20 +++ util.c1999/12/21 21:41:48 1.21 @@ -94,12 +94,13 @@ API_EXPORT(char *) ap_get_time() { -time_t t; -char *time_string; +ap_time_t *t = NULL; +char *time_string = NULL; -t = time(NULL); -time_string = ctime(t); -time_string[strlen(time_string) - 1] = '\0'; +ap_make_time(t, NULL); +ap_current_time(t); + +ap_timestr(time_string, t, APR_LOCALTIME, NULL); return (time_string); } @@ -174,37 +175,6 @@ return ap_pstrdup(p, ts); } -/* What a pain in the ass. */ -#if defined(HAVE_GMTOFF) -API_EXPORT(struct tm *) ap_get_gmtoff(int *tz) -{ -time_t tt = time(NULL); -struct tm *t; - -t = localtime(tt); -*tz = (int) (t-tm_gmtoff / 60); -return t; -} -#else -API_EXPORT(struct tm *) ap_get_gmtoff(int *tz) -{ -time_t tt = time(NULL); -struct tm gmt; -struct tm *t; -int days, hours, minutes; - -/* Assume we are never more than 24 hours away. */ -gmt = *gmtime(tt); /* remember gmtime/localtime return ptr to static */ -t = localtime(tt); /* buffer... so be careful */ -days = t-tm_yday - gmt.tm_yday; -hours = ((days -1 ? 24 : 1 days ? -24 : days * 24) - + t-tm_hour - gmt.tm_hour); -minutes = hours * 60 + t-tm_min - gmt.tm_min; -*tz = minutes; -return t; -} -#endif - /* Roy owes Rob beer. */ /* Rob owes Roy dinner. */ @@ -2044,13 +2014,6 @@ p = sys_errlist[err]; return (p); -} -#endif - -#ifndef HAVE_DIFFTIME -double difftime(time_t time1, time_t time0) -{ -return (time1 - time0); } #endif 1.7 +0 -42 apache-2.0/src/main/util_date.c Index: util_date.c === RCS file: /home/cvs/apache-2.0/src/main/util_date.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- util_date.c 1999/12/20 16:38:35 1.6 +++ util_date.c 1999/12/21 21:41:48 1.7 @@ -126,48 +126,6 @@ } /* - * tm2sec converts a GMT tm structure into the number of seconds since - * 1st January 1970 UT. Note that we ignore tm_wday, tm_yday, and tm_dst. - * - * The