You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 1999/05/16 15:29:15 UTC
cvs commit: apache-apr/apr/test testtime.c Makefile.in
rbb 99/05/16 06:29:15
Modified: apr Makefile.in configure.in
apr/test Makefile.in
Added: apr/test testtime.c
Log:
Add the time test program. Modify the autoconf stuff to do the time functions,
and clean all the apr functions. Lastly, I cleaned the autoconf stuff a little
bit.
Revision Changes Path
1.6 +9 -7 apache-apr/apr/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apache-apr/apr/Makefile.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Makefile.in 1999/05/14 12:51:37 1.5
+++ Makefile.in 1999/05/16 13:29:13 1.6
@@ -21,8 +21,9 @@
#
# Macros for target determination
#
-MODULES=lib file_io network_io threadproc locks misc
-SUBDIRS=lib file_io/@OSDIR@ network_io/@OSDIR@ threadproc/@OSDIR@ locks/@OSDIR@ misc/@OSDIR@
+MODULES=lib file_io network_io threadproc locks misc time
+SUBDIRS=lib file_io/@OSDIR@ network_io/@OSDIR@ threadproc/@OSDIR@ \
+ locks/@OSDIR@ misc/@OSDIR@ time/@OSDIR@
#
# Rules for turning inputs into outputs
@@ -37,11 +38,7 @@
all: Makefile $(MODULES) subdirs
@echo APR built.
-lib:
- cd lib \
- make
-
-clean:
+clean: subdirs_clean \
$(RM) -f *.o *.a *.so
distclean: clean
@@ -54,6 +51,11 @@
CC='$(CC)' AUX_CFLAGS='$(AUX_CFLAGS)' RANLIB='$(RANLIB)' ) \
|| exit 1; \
echo "<== $$i"; \
+ done;
+
+subdirs_clean:
+ @for i in $(SUBDIRS); do \
+ ( cd $$i && $(MAKE) $(MFLAGS_STATIC) ) \
done;
# DO NOT REMOVE
1.10 +4 -2 apache-apr/apr/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/apache-apr/apr/configure.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- configure.in 1999/05/14 12:51:37 1.9
+++ configure.in 1999/05/16 13:29:13 1.10
@@ -134,5 +134,7 @@
AC_SUBST(RANLIB)
AC_SUBST(PLATFORM)
AC_SUBST(OSDIR)
-AC_OUTPUT(Makefile lib/Makefile file_io/$OSDIR/Makefile network_io/$OSDIR/Makefile
-threadproc/$OSDIR/Makefile locks/$OSDIR/Makefile misc/$OSDIR/Makefile test/Makefile)
+AC_OUTPUT(Makefile lib/Makefile file_io/$OSDIR/Makefile
+ network_io/$OSDIR/Makefile threadproc/$OSDIR/Makefile
+ locks/$OSDIR/Makefile misc/$OSDIR/Makefile
+ time/$OSDIR/Makefile test/Makefile)
1.3 +9 -4 apache-apr/apr/test/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/Makefile.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.in 1999/05/13 13:06:51 1.2
+++ Makefile.in 1999/05/16 13:29:14 1.3
@@ -6,7 +6,7 @@
CC=gcc
RANLIB=ranlib
CFLAGS=-DLINUX=20 -g -O2
-LDLIBS= -ldl -lm -L../network_io -lnetwork -L../threadproc -lthreadproc -L../file_io -lfile -L../misc -lmisc -L../lib -lapr
+LDLIBS= -ldl -lm -L../network_io -lnetwork -L../threadproc -lthreadproc -L../file_io -lfile -L../misc -lmisc -L../lib -lapr -L../time -ltime
LDFLAGS= $(LDLIBS)
INCDIR=../../include
INCDIR1=../../../include
@@ -14,11 +14,13 @@
TARGETS= testfile \
testproc \
- testsock
+ testsock \
+ testtime
OBJS= testfile.o \
- testproc.o \
- testsock.o
+ testproc.o \
+ testsock.o \
+ testtime.o
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $<
@@ -35,6 +37,9 @@
$(CC) $(CFLAGS) testsock.o -o testsock $(LDFLAGS)
$(CC) $(CFLAGS) server.o -o server $(LDFLAGS)
$(CC) $(CFLAGS) client.o -o client $(LDFLAGS)
+
+testtime: testtime.o
+ $(CC) $(CFLAGS) testtime.o -o testtime $(LDFLAGS)
clean:
$(RM) -f *.o *.a *.so $(TARGETS)
1.1 apache-apr/apr/test/testtime.c
Index: testtime.c
===================================================================
/* ====================================================================
* Copyright (c) 1999 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* 4. The names "Apache Server" and "Apache Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Group.
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*
*/
#include "apr_time.h"
#include "apr_errno.h"
#include "apr_general.h"
#include "errno.h"
#include <stdio.h>
#ifdef BEOS
#include <unistd.h>
#endif
int main()
{
ap_context_t *context;
ap_time_t *time;
ap_time_t *time2;
ap_int32_t rv = 0;
ap_int64_t t1, t2;
context = ap_initialize(NULL);
fprintf(stdout, "Testing Time functions.\n");
fprintf(stdout, "\tMaking new time variable.......");
time = ap_make_time(context);
if (time == NULL) {
fprintf(stderr, "Couldn't allocate memory\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "\tGetting current time.......");
if (ap_current_time(context, time) == APR_FAILURE) {
fprintf(stderr, "Couldn't get the time\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "\tExploding Current time.......");
if (ap_explode_time(context, time, APR_UTCTIME) == APR_FAILURE) {
fprintf(stderr, "Couldn't explode the time\n");
exit(-1);
}
fprintf(stdout, "OK\n");
time2 = ap_make_time(context);
fprintf(stdout, "\tGetting the number of seconds.......");
rv = ap_get_sec(context, time);
if (rv < 0) {
fprintf(stderr, "Couldn't get the seconds\n");
exit(-1);
}
ap_set_sec(context, time2, rv);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tGetting the number of minutes.......");
rv = ap_get_min(context, time);
if (rv < 0) {
fprintf(stderr, "Couldn't get the minutes\n");
exit(-1);
}
ap_set_min(context, time2, rv);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tGetting the number of hours.......");
rv = ap_get_hour(context, time);
if (rv < 0) {
fprintf(stderr, "Couldn't get the hours\n");
exit(-1);
}
ap_set_hour(context, time2, rv);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tGetting the number of days.......");
rv = ap_get_mday(context, time);
if (rv < 0) {
fprintf(stderr, "Couldn't get the days\n");
exit(-1);
}
ap_set_mday(context, time2, rv);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tGetting the month .......");
rv = ap_get_mon(context, time);
if (rv < 0) {
fprintf(stderr, "Couldn't get the month\n");
exit(-1);
}
ap_set_mon(context, time2, rv);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tGetting the year.......");
rv = ap_get_year(context, time);
if (rv < 0) {
fprintf(stderr, "Couldn't get the year\n");
exit(-1);
}
ap_set_year(context, time2, rv);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tGetting the weekday.......");
rv = ap_get_wday(context, time);
if (rv < 0) {
fprintf(stderr, "Couldn't get the week day\n");
exit(-1);
}
ap_set_wday(context, time2, rv);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tImploding the time.......");
if (ap_implode_time(context, time2) == APR_FAILURE) {
fprintf(stderr, "Couldn't implode time\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "\tComparing two time values.......");
t1 = ap_get_curtime(context, time);
t2 = ap_get_curtime(context, time2);
if ((t1 == -1) || (t2 == -1) || (t1 != t2)) {
fprintf(stderr, "Values don't match\n");
exit(-1);
}
fprintf(stdout, "OK\n");
exit(1);
}