bjh 99/10/13 02:25:11
Modified: src/lib/apr/time/os2 Makefile.in access.c time.c Log: Ditch the OS/2 specific time code as it's identical to the unix code (except for being out of date wrt parameter reordering). Revision Changes Path 1.4 +8 -6 apache-2.0/src/lib/apr/time/os2/Makefile.in Index: Makefile.in =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/time/os2/Makefile.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile.in 1999/08/28 08:57:14 1.3 +++ Makefile.in 1999/10/13 09:25:08 1.4 @@ -51,11 +51,13 @@ && rm Makefile.new # DO NOT REMOVE -access.o: access.c atime.h $(INCDIR1)/apr_time.h \ +access.o: access.c ../unix/access.c ../unix/atime.h \ + $(INCDIR1)/apr_time.h $(INCDIR1)/apr_general.h \ + $(INCDIR1)/apr_config.h $(INCDIR1)/apr_errno.h \ + $(INCDIR1)/apr_lib.h $(INCDIR1)/apr_file_io.h +time.o: time.c ../unix/time.c ../unix/atime.h $(INCDIR1)/apr_time.h \ $(INCDIR1)/apr_general.h $(INCDIR1)/apr_config.h \ $(INCDIR1)/apr_errno.h $(INCDIR1)/apr_lib.h \ - $(INCDIR1)/apr_file_io.h $(INCDIR1)/hsregex.h -time.o: time.c atime.h $(INCDIR1)/apr_time.h \ - $(INCDIR1)/apr_general.h $(INCDIR1)/apr_config.h \ - $(INCDIR1)/apr_errno.h $(INCDIR1)/apr_lib.h \ - $(INCDIR1)/apr_file_io.h $(INCDIR1)/hsregex.h + $(INCDIR1)/apr_file_io.h $(INCDIR1)/apr_portable.h \ + $(INCDIR1)/apr_thread_proc.h $(INCDIR1)/apr_win.h \ + $(INCDIR1)/apr_network_io.h $(INCDIR1)/apr_lock.h 1.2 +1 -192 apache-2.0/src/lib/apr/time/os2/access.c Index: access.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/time/os2/access.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- access.c 1999/08/17 15:59:53 1.1 +++ access.c 1999/10/13 09:25:08 1.2 @@ -53,195 +53,4 @@ * */ -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <errno.h> -#include <string.h> - -ap_status_t ap_get_curtime(struct atime_t *time, ap_int64_t *rv) -{ - if (time) { - (*rv) = time->currtime; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_sec(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_sec; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_min(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_min; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_hour(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_hour; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mon(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mon; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_year(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_year; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_wday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_wday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_set_sec(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_sec = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_min(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_min = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_hour(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_hour = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mday = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mon(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mon = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_year(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_year = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_wday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_wday = value; - return APR_SUCCESS; -} - - +#include "../unix/access.c" 1.3 +1 -79 apache-2.0/src/lib/apr/time/os2/time.c Index: time.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/time/os2/time.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- time.c 1999/10/04 16:37:45 1.2 +++ time.c 1999/10/13 09:25:09 1.3 @@ -53,82 +53,4 @@ * */ -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <time.h> -#include <errno.h> -#include <string.h> - -ap_status_t ap_make_time(struct atime_t **new, ap_context_t *cont) -{ - (*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->explodedtime = NULL; - return APR_SUCCESS; -} - -ap_status_t ap_current_time(struct atime_t *new) -{ - if (time(&new->currtime) == -1) { - return errno; - } - return APR_SUCCESS; -} - -ap_status_t ap_explode_time(struct atime_t *time, ap_timetype_e type) -{ - switch (type) { - case APR_LOCALTIME: { - time->explodedtime = localtime(&time->currtime); - break; - } - case APR_UTCTIME: { - time->explodedtime = gmtime(&time->currtime); - break; - } - } - return APR_SUCCESS; -} - -ap_status_t ap_implode_time(struct atime_t *time) -{ - int year; - time_t days; - static const int dayoffset[12] = - {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; - - year = time->explodedtime->tm_year; - - if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) { - return APR_EBADDATE; - } - - /* shift new year to 1st March in order to make leap year calc easy */ - - if (time->explodedtime->tm_mon < 2) - year--; - - /* Find number of days since 1st March 1900 (in the Gregorian calendar). */ - - days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4; - days += dayoffset[time->explodedtime->tm_mon] + - time->explodedtime->tm_mday - 1; - days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */ - - days = ((days * 24 + time->explodedtime->tm_hour) * 60 + - time->explodedtime->tm_min) * 60 + time->explodedtime->tm_sec; - - if (days < 0) { - return APR_EBADDATE; - } - time->currtime = days; /* must be a valid time */ - return APR_SUCCESS; -} - +#include "../unix/time.c"