summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordougm <dougm@13f79535-47bb-0310-9956-ffa450edef68>2001-02-08 07:45:23 +0000
committerdougm <dougm@13f79535-47bb-0310-9956-ffa450edef68>2001-02-08 07:45:23 +0000
commitaba88e6ebce8d24a8ca387c28aabc9f17559a56c (patch)
tree136752321dd3e22c22463c9ab35a700ab0507729 /test
parent482ce86a79d41d751123dcfcfc29f4098135c4b7 (diff)
downloadlibapr-aba88e6ebce8d24a8ca387c28aabc9f17559a56c.tar.gz
renaming various functions for consistency sake
see: http://apr.apache.org/~dougm/apr_rename.pl PR: Obtained from: Submitted by: Reviewed by: git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61194 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/abc.c6
-rw-r--r--test/client.c32
-rw-r--r--test/sendfile.c56
-rw-r--r--test/server.c64
-rw-r--r--test/testargs.c4
-rw-r--r--test/testcontext.c6
-rw-r--r--test/testdso.c2
-rw-r--r--test/testfile.c122
-rw-r--r--test/testflock.c20
-rw-r--r--test/testmd5.c10
-rw-r--r--test/testmmap.c6
-rw-r--r--test/testoc.c16
-rw-r--r--test/testpipe.c12
-rw-r--r--test/testproc.c22
-rw-r--r--test/testshmem.c4
-rw-r--r--test/testsock.c42
-rw-r--r--test/testsockopt.c28
-rw-r--r--test/testthread.c28
-rw-r--r--test/testtime.c4
-rw-r--r--test/testuuid.c16
20 files changed, 250 insertions, 250 deletions
diff --git a/test/abc.c b/test/abc.c
index 894228d85..d0cd82302 100644
--- a/test/abc.c
+++ b/test/abc.c
@@ -11,12 +11,12 @@ int main(int argc, char *argv[])
int status = 0;
apr_pool_t *context;
- apr_create_pool(&context, NULL);
+ apr_pool_create(&context, NULL);
- apr_open(&fd, argv[1], APR_READ, -1, context);
+ apr_file_open(&fd, argv[1], APR_READ, -1, context);
while (!status) {
- status = apr_getc(&ch, fd);
+ status = apr_file_getc(&ch, fd);
if (status == APR_EOF )
fprintf(stdout, "EOF, YEAH!!!!!!!!!\n");
else if (status == APR_SUCCESS)
diff --git a/test/client.c b/test/client.c
index 8ccc555ea..70f269c5e 100644
--- a/test/client.c
+++ b/test/client.c
@@ -98,14 +98,14 @@ int main(int argc, char *argv[])
atexit(closeapr);
fprintf(stdout, "Creating context.......");
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Something went wrong\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout,"\tClient: Making socket address...............");
- if ((stat = apr_getaddrinfo(&remote_sa, dest, APR_UNSPEC, 8021, 0, context))
+ if ((stat = apr_sockaddr_info_get(&remote_sa, dest, APR_UNSPEC, 8021, 0, context))
!= APR_SUCCESS) {
fprintf(stdout, "Failed!\n");
fprintf(stdout, "Address resolution failed for %s: %s\n",
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
fprintf(stdout,"OK\n");
fprintf(stdout, "\tClient: Creating new socket.......");
- if (apr_create_socket(&sock, remote_sa->sa.sin.sin_family, SOCK_STREAM,
+ if (apr_socket_create(&sock, remote_sa->sa.sin.sin_family, SOCK_STREAM,
context) != APR_SUCCESS) {
fprintf(stderr, "Couldn't create socket\n");
exit(-1);
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
stat = apr_connect(sock, remote_sa);
if (stat != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Could not connect: %s (%d)\n",
apr_strerror(stat, msgbuf, sizeof(msgbuf)), stat);
fflush(stderr);
@@ -138,25 +138,25 @@ int main(int argc, char *argv[])
if (read_timeout == -1) {
fprintf(stdout, "\tClient: Setting socket option NONBLOCK.......");
if (apr_setsocketopt(sock, APR_SO_NONBLOCK, 1) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Couldn't set socket option\n");
exit(-1);
}
fprintf(stdout, "OK\n");
}
- apr_get_sockaddr(&remote_sa, APR_REMOTE, sock);
- apr_get_ipaddr(&remote_ipaddr, remote_sa);
- apr_get_port(&remote_port, remote_sa);
- apr_get_sockaddr(&local_sa, APR_LOCAL, sock);
- apr_get_ipaddr(&local_ipaddr, local_sa);
- apr_get_port(&local_port, local_sa);
+ apr_socket_addr_get(&remote_sa, APR_REMOTE, sock);
+ apr_sockaddr_ip_get(&remote_ipaddr, remote_sa);
+ apr_sockaddr_port_get(&remote_port, remote_sa);
+ apr_socket_addr_get(&local_sa, APR_LOCAL, sock);
+ apr_sockaddr_ip_get(&local_ipaddr, local_sa);
+ apr_sockaddr_port_get(&local_port, local_sa);
fprintf(stdout, "\tClient socket: %s:%u -> %s:%u\n", local_ipaddr, local_port, remote_ipaddr, remote_port);
fprintf(stdout, "\tClient: Trying to send data over socket.......");
length = STRLEN;
if (apr_send(sock, datasend, &length) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Problem sending data\n");
exit(-1);
}
@@ -176,13 +176,13 @@ int main(int argc, char *argv[])
fprintf(stdout, "\tClient: Trying to receive data over socket.......");
if ((stat = apr_recv(sock, datarecv, &length)) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Problem receiving data: %s (%d)\n",
apr_strerror(stat, msgbuf, sizeof(msgbuf)), stat);
exit(-1);
}
if (strcmp(datarecv, "Recv data test")) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "I did not receive the correct data %s\n", datarecv);
exit(-1);
}
@@ -190,14 +190,14 @@ int main(int argc, char *argv[])
fprintf(stdout, "\tClient: Shutting down socket.......");
if (apr_shutdown(sock, APR_SHUTDOWN_WRITE) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Could not shutdown socket\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "\tClient: Closing down socket.......");
- if (apr_close_socket(sock) != APR_SUCCESS) {
+ if (apr_socket_close(sock) != APR_SUCCESS) {
fprintf(stderr, "Could not shutdown socket\n");
exit(-1);
}
diff --git a/test/sendfile.c b/test/sendfile.c
index 425b55987..146a05b82 100644
--- a/test/sendfile.c
+++ b/test/sendfile.c
@@ -110,18 +110,18 @@ static void apr_setup(apr_pool_t **p, apr_socket_t **sock, int *family)
atexit(closeapr);
- rv = apr_create_pool(p, NULL);
+ rv = apr_pool_create(p, NULL);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_create_pool()->%d/%s\n",
+ fprintf(stderr, "apr_pool_create()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
}
*sock = NULL;
- rv = apr_create_socket(sock, *family, SOCK_STREAM, *p);
+ rv = apr_socket_create(sock, *family, SOCK_STREAM, *p);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_create_socket()->%d/%s\n",
+ fprintf(stderr, "apr_socket_create()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
@@ -130,9 +130,9 @@ static void apr_setup(apr_pool_t **p, apr_socket_t **sock, int *family)
if (*family == APR_UNSPEC) {
apr_sockaddr_t *localsa;
- rv = apr_get_sockaddr(&localsa, APR_LOCAL, *sock);
+ rv = apr_socket_addr_get(&localsa, APR_LOCAL, *sock);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_get_sockaddr()->%d/%s\n",
+ fprintf(stderr, "apr_socket_addr_get()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
@@ -150,11 +150,11 @@ static void create_testfile(apr_pool_t *p, const char *fname)
apr_finfo_t finfo;
printf("Creating a test file...\n");
- rv = apr_open(&f, fname,
+ rv = apr_file_open(&f, fname,
APR_CREATE | APR_WRITE | APR_TRUNCATE | APR_BUFFERED,
APR_UREAD | APR_UWRITE, p);
if (rv) {
- fprintf(stderr, "apr_open()->%d/%s\n",
+ fprintf(stderr, "apr_file_open()->%d/%s\n",
rv, apr_strerror(rv, buf, sizeof buf));
exit(1);
}
@@ -162,35 +162,35 @@ static void create_testfile(apr_pool_t *p, const char *fname)
buf[0] = FILE_DATA_CHAR;
buf[1] = '\0';
for (i = 0; i < FILE_LENGTH; i++) {
- /* exercise apr_putc() and apr_puts() on buffered files */
+ /* exercise apr_file_putc() and apr_file_puts() on buffered files */
if ((i % 2) == 0) {
- rv = apr_putc(buf[0], f);
+ rv = apr_file_putc(buf[0], f);
if (rv) {
- fprintf(stderr, "apr_putc()->%d/%s\n",
+ fprintf(stderr, "apr_file_putc()->%d/%s\n",
rv, apr_strerror(rv, buf, sizeof buf));
exit(1);
}
}
else {
- rv = apr_puts(buf, f);
+ rv = apr_file_puts(buf, f);
if (rv) {
- fprintf(stderr, "apr_puts()->%d/%s\n",
+ fprintf(stderr, "apr_file_puts()->%d/%s\n",
rv, apr_strerror(rv, buf, sizeof buf));
exit(1);
}
}
}
- rv = apr_close(f);
+ rv = apr_file_close(f);
if (rv) {
- fprintf(stderr, "apr_close()->%d/%s\n",
+ fprintf(stderr, "apr_file_close()->%d/%s\n",
rv, apr_strerror(rv, buf, sizeof buf));
exit(1);
}
rv = apr_stat(&finfo, fname, APR_FINFO_NORM, p);
if (rv) {
- fprintf(stderr, "apr_close()->%d/%s\n",
+ fprintf(stderr, "apr_file_close()->%d/%s\n",
rv, apr_strerror(rv, buf, sizeof buf));
exit(1);
}
@@ -230,17 +230,17 @@ static int client(client_socket_mode_t socket_mode)
apr_setup(&p, &sock, &family);
create_testfile(p, TESTFILE);
- rv = apr_open(&f, TESTFILE, APR_READ, 0, p);
+ rv = apr_file_open(&f, TESTFILE, APR_READ, 0, p);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_open()->%d/%s\n",
+ fprintf(stderr, "apr_file_open()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
}
- rv = apr_getaddrinfo(&destsa, "127.0.0.1", family, TESTSF_PORT, 0, p);
+ rv = apr_sockaddr_info_get(&destsa, "127.0.0.1", family, TESTSF_PORT, 0, p);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_getaddrinfo()->%d/%s\n",
+ fprintf(stderr, "apr_sockaddr_info_get()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
@@ -343,9 +343,9 @@ static int client(client_socket_mode_t socket_mode)
apr_size_t total_bytes_sent;
pfd = NULL;
- rv = apr_setup_poll(&pfd, 1, p);
+ rv = apr_poll_setup(&pfd, 1, p);
assert(!rv);
- rv = apr_add_poll_socket(pfd, sock, APR_POLLOUT);
+ rv = apr_poll_socket_add(pfd, sock, APR_POLLOUT);
assert(!rv);
total_bytes_sent = 0;
@@ -456,9 +456,9 @@ static int client(client_socket_mode_t socket_mode)
}
current_file_offset = 0;
- rv = apr_seek(f, APR_CUR, &current_file_offset);
+ rv = apr_file_seek(f, APR_CUR, &current_file_offset);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_seek()->%d/%s\n",
+ fprintf(stderr, "apr_file_seek()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
@@ -493,9 +493,9 @@ static int client(client_socket_mode_t socket_mode)
printf("client: apr_sendfile() worked as expected!\n");
- rv = apr_remove_file(TESTFILE, p);
+ rv = apr_file_remove(TESTFILE, p);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_remove_file()->%d/%s\n",
+ fprintf(stderr, "apr_file_remove()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
@@ -527,9 +527,9 @@ static int server(void)
exit(1);
}
- rv = apr_getaddrinfo(&localsa, NULL, family, TESTSF_PORT, 0, p);
+ rv = apr_sockaddr_info_get(&localsa, NULL, family, TESTSF_PORT, 0, p);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_getaddrinfo()->%d/%s\n",
+ fprintf(stderr, "apr_sockaddr_info_get()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
diff --git a/test/server.c b/test/server.c
index 32871da19..c47366b28 100644
--- a/test/server.c
+++ b/test/server.c
@@ -95,13 +95,13 @@ int main(int argc, const char * const argv[])
atexit(closeapr);
fprintf(stdout, "Creating context.......");
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Could not create a context\n");
exit(-1);
}
fprintf(stdout, "OK\n");
- if (apr_initopt(&opt, context, argc, argv)) {
+ if (apr_getopt_init(&opt, context, argc, argv)) {
fprintf(stderr, "failed to initialize opts\n");
exit(-1);
}
@@ -125,7 +125,7 @@ int main(int argc, const char * const argv[])
* socket we need. We'll use the returned sockaddr later when
* we bind.
*/
- stat = apr_getaddrinfo(&localsa, bind_to_ipaddr, APR_UNSPEC, 8021, 0,
+ stat = apr_sockaddr_info_get(&localsa, bind_to_ipaddr, APR_UNSPEC, 8021, 0,
context);
if (stat != APR_SUCCESS) {
fprintf(stderr,
@@ -137,7 +137,7 @@ int main(int argc, const char * const argv[])
}
fprintf(stdout, "\tServer: Creating new socket.......");
- if (apr_create_socket(&sock, family, SOCK_STREAM, context) != APR_SUCCESS) {
+ if (apr_socket_create(&sock, family, SOCK_STREAM, context) != APR_SUCCESS) {
fprintf(stderr, "Couldn't create socket\n");
exit(-1);
}
@@ -145,7 +145,7 @@ int main(int argc, const char * const argv[])
fprintf(stdout, "\tServer: Setting socket option NONBLOCK.......");
if (apr_setsocketopt(sock, APR_SO_NONBLOCK, 1) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Couldn't set socket option\n");
exit(-1);
}
@@ -153,20 +153,20 @@ int main(int argc, const char * const argv[])
fprintf(stdout, "\tServer: Setting socket option REUSEADDR.......");
if (apr_setsocketopt(sock, APR_SO_REUSEADDR, 1) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Couldn't set socket option\n");
exit(-1);
}
fprintf(stdout, "OK\n");
if (!localsa) {
- apr_get_sockaddr(&localsa, APR_LOCAL, sock);
- apr_set_port(localsa, 8021);
+ apr_socket_addr_get(&localsa, APR_LOCAL, sock);
+ apr_sockaddr_port_set(localsa, 8021);
}
fprintf(stdout, "\tServer: Binding socket to port.......");
if ((stat = apr_bind(sock, localsa)) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Could not bind: %s\n",
apr_strerror(stat, buf, sizeof buf));
exit(-1);
@@ -175,26 +175,26 @@ int main(int argc, const char * const argv[])
fprintf(stdout, "\tServer: Listening to socket.......");
if (apr_listen(sock, 5) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Could not listen\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "\tServer: Setting up socket for polling.......");
- apr_setup_poll(&sdset, 1, context);
- apr_add_poll_socket(sdset, sock, APR_POLLIN);
+ apr_poll_setup(&sdset, 1, context);
+ apr_poll_socket_add(sdset, sock, APR_POLLIN);
fprintf(stdout, "OK\n");
fprintf(stdout, "\tServer: Beginning to poll for socket.......");
rv = 1;
if (apr_poll(sdset, &rv, -1) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Select caused an error\n");
exit(-1);
}
else if (rv == 0) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "I should not return until rv == 1\n");
exit(-1);
}
@@ -202,31 +202,31 @@ int main(int argc, const char * const argv[])
fprintf(stdout, "\tServer: Accepting a connection.......");
if (apr_accept(&sock2, sock, context) != APR_SUCCESS) {
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr, "Could not accept connection.\n");
exit(-1);
}
fprintf(stdout, "OK\n");
- apr_get_sockaddr(&remotesa, APR_REMOTE, sock2);
- apr_get_ipaddr(&remote_ipaddr, remotesa);
- apr_get_port(&remote_port, remotesa);
- apr_get_sockaddr(&localsa, APR_LOCAL, sock2);
- apr_get_ipaddr(&local_ipaddr, localsa);
- apr_get_port(&local_port, localsa);
+ apr_socket_addr_get(&remotesa, APR_REMOTE, sock2);
+ apr_sockaddr_ip_get(&remote_ipaddr, remotesa);
+ apr_sockaddr_port_get(&remote_port, remotesa);
+ apr_socket_addr_get(&localsa, APR_LOCAL, sock2);
+ apr_sockaddr_ip_get(&local_ipaddr, localsa);
+ apr_sockaddr_port_get(&local_port, localsa);
fprintf(stdout, "\tServer socket: %s:%u -> %s:%u\n", local_ipaddr, local_port, remote_ipaddr, remote_port);
length = STRLEN;
fprintf(stdout, "\tServer: Trying to recv data from socket.......");
if (apr_recv(sock2, datasend, &length) != APR_SUCCESS) {
- apr_close_socket(sock);
- apr_close_socket(sock2);
+ apr_socket_close(sock);
+ apr_socket_close(sock2);
fprintf(stderr, "Problem recving data\n");
exit(-1);
}
if (strcmp(datasend, "Send data test")) {
- apr_close_socket(sock);
- apr_close_socket(sock2);
+ apr_socket_close(sock);
+ apr_socket_close(sock2);
fprintf(stderr, "I did not receive the correct data %s\n", datarecv);
exit(-1);
}
@@ -235,8 +235,8 @@ int main(int argc, const char * const argv[])
length = STRLEN;
fprintf(stdout, "\tServer: Sending data over socket.......");
if (apr_send(sock2, datarecv, &length) != APR_SUCCESS) {
- apr_close_socket(sock);
- apr_close_socket(sock2);
+ apr_socket_close(sock);
+ apr_socket_close(sock2);
fprintf(stderr, "Problem sending data\n");
exit(-1);
}
@@ -244,23 +244,23 @@ int main(int argc, const char * const argv[])
fprintf(stdout, "\tServer: Shutting down accepted socket.......");
if (apr_shutdown(sock2, APR_SHUTDOWN_READ) != APR_SUCCESS) {
- apr_close_socket(sock);
- apr_close_socket(sock2);
+ apr_socket_close(sock);
+ apr_socket_close(sock2);
fprintf(stderr, "Problem shutting down\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "\tServer: closing duplicate socket.......");
- if (apr_close_socket(sock2) != APR_SUCCESS) {
- apr_close_socket(sock);
+ if (apr_socket_close(sock2) != APR_SUCCESS) {
+ apr_socket_close(sock);
fprintf(stderr, "Problem closing down\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "\tServer: closing original socket.......");
- if (apr_close_socket(sock) != APR_SUCCESS) {
+ if (apr_socket_close(sock) != APR_SUCCESS) {
fprintf(stderr, "Problem closing down\n");
exit(-1);
}
diff --git a/test/testargs.c b/test/testargs.c
index aa088e98a..803f3ecca 100644
--- a/test/testargs.c
+++ b/test/testargs.c
@@ -87,9 +87,9 @@ int main(int argc, const char * const argv[])
apr_initialize();
atexit(closeapr);
- apr_create_pool(&context, NULL);
+ apr_pool_create(&context, NULL);
- if (apr_initopt(&opt, context, argc, argv))
+ if (apr_getopt_init(&opt, context, argc, argv))
{
printf("failed to initialize opts");
exit(1);
diff --git a/test/testcontext.c b/test/testcontext.c
index 4755e183e..7267aac0a 100644
--- a/test/testcontext.c
+++ b/test/testcontext.c
@@ -85,16 +85,16 @@ int main(void)
}
atexit(closeapr);
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
testdata = apr_pstrdup(context, "This is a test\n");
- apr_set_userdata(testdata, "TEST", string_cleanup, context);
+ apr_pool_userdata_set(testdata, "TEST", string_cleanup, context);
- apr_get_userdata((void **)&retdata, "TEST", context);
+ apr_pool_userdata_get((void **)&retdata, "TEST", context);
if (!strcmp(testdata, retdata)) {
fprintf(stdout, "User data is working ok\n");
diff --git a/test/testdso.c b/test/testdso.c
index d07148a35..160fad15d 100644
--- a/test/testdso.c
+++ b/test/testdso.c
@@ -35,7 +35,7 @@ int main (int argc, char ** argv)
apr_initialize();
atexit(closeapr);
- if (apr_create_pool(&cont, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&cont, NULL) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
diff --git a/test/testfile.c b/test/testfile.c
index 2a7f4a042..af449742a 100644
--- a/test/testfile.c
+++ b/test/testfile.c
@@ -124,11 +124,11 @@ int main(void)
exit(-1);
}
atexit(closeapr);
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
- if (apr_create_pool(&cont2, context) != APR_SUCCESS) {
+ if (apr_pool_create(&cont2, context) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
@@ -136,7 +136,7 @@ int main(void)
fprintf(stdout, "Testing file functions.\n");
fprintf(stdout, "\tOpening file.......");
- status = apr_open(&thefile, filename, flag, APR_UREAD | APR_UWRITE | APR_GREAD, context);
+ status = apr_file_open(&thefile, filename, flag, APR_UREAD | APR_UWRITE | APR_GREAD, context);
if (status != APR_SUCCESS) {
fprintf(stderr, "Didn't open file: %d/%s\n", status,
apr_strerror(status, errmsg, sizeof errmsg));
@@ -151,7 +151,7 @@ int main(void)
fprintf(stderr, "Bad file des\n");
exit(-1);
}
- apr_get_filename(&str, thefile);
+ apr_file_name_get(&str, thefile);
if (strcmp(str, filename) != 0) {
fprintf(stderr, "wrong filename\n");
exit(-1);
@@ -163,9 +163,9 @@ int main(void)
fprintf(stdout, "\tWriting to file.......");
nbytes = strlen("this is a test");
- status = apr_write(thefile, "this is a test", &nbytes);
+ status = apr_file_write(thefile, "this is a test", &nbytes);
if (status != APR_SUCCESS) {
- fprintf(stderr, "something's wrong; apr_write->%d/%s\n",
+ fprintf(stderr, "something's wrong; apr_file_write->%d/%s\n",
status, apr_strerror(status, errmsg, sizeof errmsg));
exit(-1);
}
@@ -179,7 +179,7 @@ int main(void)
fprintf(stdout, "\tMoving to start of file.......");
zer = 0;
- status = apr_seek(thefile, SEEK_SET, &zer);
+ status = apr_file_seek(thefile, SEEK_SET, &zer);
if (status != APR_SUCCESS) {
fprintf(stderr, "couldn't seek to beginning of file: %d/%s",
status, apr_strerror(status, errmsg, sizeof errmsg));
@@ -201,8 +201,8 @@ int main(void)
fprintf(stdout, "OK\n");
fprintf(stdout, "\t\tChecking for incoming data.......");
- apr_setup_poll(&sdset, 1, context);
- apr_add_poll_socket(sdset, testsock, APR_POLLIN);
+ apr_poll_setup(&sdset, 1, context);
+ apr_poll_socket_add(sdset, testsock, APR_POLLIN);
num = 1;
if (apr_poll(sdset, &num, -1) != APR_SUCCESS) {
fprintf(stderr, "Select caused an error\n");
@@ -218,9 +218,9 @@ int main(void)
fprintf(stdout, "\tReading from the file.......");
nbytes = strlen("this is a test");
buf = (char *)apr_palloc(context, nbytes + 1);
- status = apr_read(thefile, buf, &nbytes);
+ status = apr_file_read(thefile, buf, &nbytes);
if (status != APR_SUCCESS) {
- fprintf(stderr, "apr_read()->%d/%s\n",
+ fprintf(stderr, "apr_file_read()->%d/%s\n",
status, apr_strerror(status, errmsg, sizeof errmsg));
exit(-1);
}
@@ -233,7 +233,7 @@ int main(void)
}
fprintf(stdout, "\tAdding user data to the file.......");
- status = apr_set_filedata(thefile, "This is a test", "test", apr_null_cleanup);
+ status = apr_file_data_set(thefile, "This is a test", "test", apr_pool_cleanup_null);
if (status != APR_SUCCESS) {
fprintf(stderr, "Couldn't add the data\n");
exit(-1);
@@ -243,7 +243,7 @@ int main(void)
}
fprintf(stdout, "\tGetting user data from the file.......");
- status = apr_get_filedata((void **)&teststr, "test", thefile);
+ status = apr_file_data_get((void **)&teststr, "test", thefile);
if (status != APR_SUCCESS || strcmp(teststr, "This is a test")) {
fprintf(stderr, "Couldn't get the data\n");
exit(-1);
@@ -253,7 +253,7 @@ int main(void)
}
fprintf(stdout, "\tGetting fileinfo.......");
- status = apr_getfileinfo(&finfo, APR_FINFO_NORM, thefile);
+ status = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile);
if (status == APR_INCOMPLETE) {
int i;
fprintf(stdout, "INCOMPLETE\n");
@@ -272,7 +272,7 @@ int main(void)
uid = finfo.user;
fprintf(stdout, "\tClosing File.......");
- status = apr_close(thefile);
+ status = apr_file_close(thefile);
if (status != APR_SUCCESS) {
fprintf(stderr, "Couldn't close the file\n");
exit(-1);
@@ -329,7 +329,7 @@ int main(void)
}
fprintf(stdout, "\tDeleting file.......");
- status = apr_remove_file(filename, context);
+ status = apr_file_remove(filename, context);
if (status != APR_SUCCESS) {
fprintf(stderr, "Couldn't delete the file\n");
exit(-1);
@@ -339,7 +339,7 @@ int main(void)
}
fprintf(stdout, "\tMaking sure it's gone.......");
- status = apr_open(&thefile, filename, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, context);
+ status = apr_file_open(&thefile, filename, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, context);
if (status == APR_SUCCESS) {
fprintf(stderr, "I could open the file for some reason?\n");
exit(-1);
@@ -352,7 +352,7 @@ int main(void)
test_filedel(context);
test_read(context);
- apr_destroy_pool(context);
+ apr_pool_destroy(context);
return 1;
}
@@ -362,20 +362,20 @@ int test_filedel(apr_pool_t *context)
apr_int32_t flag = APR_READ | APR_WRITE | APR_CREATE;
apr_status_t stat;
- stat = apr_open(&thefile, "testdel", flag, APR_UREAD | APR_UWRITE | APR_GREAD, context);
+ stat = apr_file_open(&thefile, "testdel", flag, APR_UREAD | APR_UWRITE | APR_GREAD, context);
if (stat != APR_SUCCESS) {
return stat;
}
- if ((stat = apr_close(thefile)) != APR_SUCCESS) {
+ if ((stat = apr_file_close(thefile)) != APR_SUCCESS) {
return stat;
}
- if ((stat = apr_remove_file("testdel", context)) != APR_SUCCESS) {
+ if ((stat = apr_file_remove("testdel", context)) != APR_SUCCESS) {
return stat;
}
- stat = apr_open(&thefile, "testdel", APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, context);
+ stat = apr_file_open(&thefile, "testdel", APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, context);
if (stat == APR_SUCCESS) {
return stat;
}
@@ -393,7 +393,7 @@ int testdirs(apr_pool_t *context)
fprintf(stdout, "Testing Directory functions.\n");
fprintf(stdout, "\tMakeing Directory.......");
- if (apr_make_dir("testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE | APR_GREAD | APR_GWRITE | APR_GEXECUTE | APR_WREAD | APR_WWRITE | APR_WEXECUTE, context) != APR_SUCCESS) {
+ if (apr_dir_make("testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE | APR_GREAD | APR_GWRITE | APR_GEXECUTE | APR_WREAD | APR_WWRITE | APR_WEXECUTE, context) != APR_SUCCESS) {
fprintf(stderr, "Could not create directory\n");
return -1;
}
@@ -401,13 +401,13 @@ int testdirs(apr_pool_t *context)
fprintf(stdout, "OK\n");
}
- if (apr_open(&file, "testdir/testfile", APR_READ | APR_WRITE | APR_CREATE, APR_UREAD | APR_UWRITE | APR_UEXECUTE, context) != APR_SUCCESS) {;
+ if (apr_file_open(&file, "testdir/testfile", APR_READ | APR_WRITE | APR_CREATE, APR_UREAD | APR_UWRITE | APR_UEXECUTE, context) != APR_SUCCESS) {;
return -1;
}
bytes = strlen("Another test!!!");
- apr_write(file, "Another test!!", &bytes);
- apr_close(file);
+ apr_file_write(file, "Another test!!", &bytes);
+ apr_file_close(file);
fprintf(stdout, "\tOpening Directory.......");
if (apr_dir_open(&temp, "testdir", context) != APR_SUCCESS) {
@@ -474,7 +474,7 @@ int testdirs(apr_pool_t *context)
}
fprintf(stdout, "\tRemoving file from directory.......");
- if (apr_remove_file("testdir/testfile", context) != APR_SUCCESS) {
+ if (apr_file_remove("testdir/testfile", context) != APR_SUCCESS) {
fprintf(stderr, "Could not remove file\n");
return -1;
}
@@ -483,7 +483,7 @@ int testdirs(apr_pool_t *context)
}
fprintf(stdout, "\tRemoving Directory.......");
- if (apr_remove_dir("testdir", context) != APR_SUCCESS) {
+ if (apr_dir_remove("testdir", context) != APR_SUCCESS) {
fprintf(stderr, "Could not remove directory\n");
return -1;
}
@@ -506,23 +506,23 @@ static void create_testread(apr_pool_t *p, const char *fname)
/* Create a test file with known content.
*/
- rv = apr_open(&f, fname, APR_CREATE | APR_WRITE | APR_TRUNCATE, APR_UREAD | APR_UWRITE, p);
+ rv = apr_file_open(&f, fname, APR_CREATE | APR_WRITE | APR_TRUNCATE, APR_UREAD | APR_UWRITE, p);
if (rv) {
- fprintf(stderr, "apr_open()->%d/%s\n",
+ fprintf(stderr, "apr_file_open()->%d/%s\n",
rv, apr_strerror(rv, buf, sizeof buf));
exit(1);
}
nbytes = 4;
- rv = apr_write(f, "abc\n", &nbytes);
+ rv = apr_file_write(f, "abc\n", &nbytes);
assert(!rv && nbytes == 4);
memset(buf, 'a', sizeof buf);
nbytes = sizeof buf;
- rv = apr_write(f, buf, &nbytes);
+ rv = apr_file_write(f, buf, &nbytes);
assert(!rv && nbytes == sizeof buf);
nbytes = 2;
- rv = apr_write(f, "\n\n", &nbytes);
+ rv = apr_file_write(f, "\n\n", &nbytes);
assert(!rv && nbytes == 2);
- rv = apr_close(f);
+ rv = apr_file_close(f);
assert(!rv);
}
@@ -537,11 +537,11 @@ static char read_one(apr_file_t *f, int expected)
bytes[0] = bytes[2] = 0x01;
if (counter % 2) {
- rv = apr_getc(bytes + 1, f);
+ rv = apr_file_getc(bytes + 1, f);
}
else {
nbytes = 1;
- rv = apr_read(f, bytes + 1, &nbytes);
+ rv = apr_file_read(f, bytes + 1, &nbytes);
assert(nbytes == 1);
}
assert(!rv);
@@ -560,23 +560,23 @@ static void test_read_guts(apr_pool_t *p, const char *fname, apr_int32_t extra_f
char buf[1024];
int i;
- rv = apr_open(&f, fname, APR_READ | extra_flags, 0, p);
+ rv = apr_file_open(&f, fname, APR_READ | extra_flags, 0, p);
assert(!rv);
read_one(f, 'a');
read_one(f, 'b');
if (extra_flags & APR_BUFFERED) {
fprintf(stdout,
- "\n\t\tskipping apr_ungetc() for APR_BUFFERED... "
+ "\n\t\tskipping apr_file_ungetc() for APR_BUFFERED... "
"doesn't work yet...\n\t\t\t\t ");
}
else {
- rv = apr_ungetc('b', f);
+ rv = apr_file_ungetc('b', f);
assert(!rv);
/* Note: some implementations move the file ptr back;
* others just save up to one char; it isn't
* portable to unget more than once.
*/
- /* Don't do this: rv = apr_ungetc('a', f); */
+ /* Don't do this: rv = apr_file_ungetc('a', f); */
read_one(f, 'b');
}
read_one(f, 'c');
@@ -586,20 +586,20 @@ static void test_read_guts(apr_pool_t *p, const char *fname, apr_int32_t extra_f
}
read_one(f, '\n');
read_one(f, '\n');
- rv = apr_getc(buf, f);
+ rv = apr_file_getc(buf, f);
assert(rv == APR_EOF);
- rv = apr_close(f);
+ rv = apr_file_close(f);
assert(!rv);
f = NULL;
- rv = apr_open(&f, fname, APR_READ | extra_flags, 0, p);
+ rv = apr_file_open(&f, fname, APR_READ | extra_flags, 0, p);
assert(!rv);
- rv = apr_fgets(buf, 10, f);
+ rv = apr_file_gets(buf, 10, f);
assert(!rv);
assert(!strcmp(buf, "abc\n"));
/* read first 800 of TESTREAD_BLKSIZE 'a's
*/
- rv = apr_fgets(buf, 801, f);
+ rv = apr_file_gets(buf, 801, f);
assert(!rv);
assert(strlen(buf) == 800);
for (i = 0; i < 800; i++) {
@@ -607,7 +607,7 @@ static void test_read_guts(apr_pool_t *p, const char *fname, apr_int32_t extra_f
}
/* read rest of the 'a's and the first newline
*/
- rv = apr_fgets(buf, sizeof buf, f);
+ rv = apr_file_gets(buf, sizeof buf, f);
assert(!rv);
assert(strlen(buf) == TESTREAD_BLKSIZE - 800 + 1);
for (i = 0; i < TESTREAD_BLKSIZE - 800; i++) {
@@ -616,23 +616,23 @@ static void test_read_guts(apr_pool_t *p, const char *fname, apr_int32_t extra_f
assert(buf[TESTREAD_BLKSIZE - 800] == '\n');
/* read the last newline
*/
- rv = apr_fgets(buf, sizeof buf, f);
+ rv = apr_file_gets(buf, sizeof buf, f);
assert(!rv);
assert(!strcmp(buf, "\n"));
/* get APR_EOF
*/
- rv = apr_fgets(buf, sizeof buf, f);
+ rv = apr_file_gets(buf, sizeof buf, f);
assert(rv == APR_EOF);
- /* get APR_EOF with apr_getc
+ /* get APR_EOF with apr_file_getc
*/
- rv = apr_getc(buf, f);
+ rv = apr_file_getc(buf, f);
assert(rv == APR_EOF);
- /* get APR_EOF with apr_read
+ /* get APR_EOF with apr_file_read
*/
nbytes = sizeof buf;
- rv = apr_read(f, buf, &nbytes);
+ rv = apr_file_read(f, buf, &nbytes);
assert(rv == APR_EOF);
- rv = apr_close(f);
+ rv = apr_file_close(f);
assert(!rv);
}
@@ -645,27 +645,27 @@ static void test_bigread(apr_pool_t *p, const char *fname, apr_int32_t extra_fla
/* Create a test file with known content.
*/
- rv = apr_open(&f, fname, APR_CREATE | APR_WRITE | APR_TRUNCATE, APR_UREAD | APR_UWRITE, p);
+ rv = apr_file_open(&f, fname, APR_CREATE | APR_WRITE | APR_TRUNCATE, APR_UREAD | APR_UWRITE, p);
if (rv) {
- fprintf(stderr, "apr_open()->%d/%s\n",
+ fprintf(stderr, "apr_file_open()->%d/%s\n",
rv, apr_strerror(rv, buf, sizeof buf));
exit(1);
}
nbytes = APR_BUFFERSIZE;
memset(buf, 0xFE, nbytes);
- rv = apr_write(f, buf, &nbytes);
+ rv = apr_file_write(f, buf, &nbytes);
assert(!rv && nbytes == APR_BUFFERSIZE);
- rv = apr_close(f);
+ rv = apr_file_close(f);
assert(!rv);
f = NULL;
- rv = apr_open(&f, fname, APR_READ | extra_flags, 0, p);
+ rv = apr_file_open(&f, fname, APR_READ | extra_flags, 0, p);
assert(!rv);
nbytes = sizeof buf;
- rv = apr_read(f, buf, &nbytes);
+ rv = apr_file_read(f, buf, &nbytes);
assert(!rv);
assert(nbytes == APR_BUFFERSIZE);
- rv = apr_close(f);
+ rv = apr_file_close(f);
assert(!rv);
}
@@ -689,7 +689,7 @@ static void test_read(apr_pool_t *p)
fprintf(stdout, "\tMore unbuffered file tests......");
test_bigread(p, fname, 0);
fprintf(stdout, "OK\n");
- rv = apr_remove_file(fname, p);
+ rv = apr_file_remove(fname, p);
assert(!rv);
fprintf(stdout, "\tAll read tests...........OK\n");
}
diff --git a/test/testflock.c b/test/testflock.c
index 52a8b36df..5ada22ee2 100644
--- a/test/testflock.c
+++ b/test/testflock.c
@@ -89,7 +89,7 @@ static apr_pool_t *pool = NULL;
static void errmsg(const char *msg)
{
if (pool != NULL)
- apr_destroy_pool(pool);
+ apr_pool_destroy(pool);
fprintf(stderr, msg);
exit(1);
}
@@ -99,12 +99,12 @@ static void do_read(void)
apr_file_t *file;
apr_status_t status;
- if (apr_open(&file, TESTFILE, APR_WRITE,
+ if (apr_file_open(&file, TESTFILE, APR_WRITE,
APR_OS_DEFAULT, pool) != APR_SUCCESS)
errmsg("Could not open test file.\n");
printf("Test file opened.\n");
- status = apr_lock_file(file, APR_FLOCK_EXCLUSIVE | APR_FLOCK_NONBLOCK);
+ status = apr_file_lock(file, APR_FLOCK_EXCLUSIVE | APR_FLOCK_NONBLOCK);
if (!APR_STATUS_IS_EAGAIN(status)) {
char msg[200];
errmsg(apr_psprintf(pool, "Expected EAGAIN. Got %d: %s.\n",
@@ -113,11 +113,11 @@ static void do_read(void)
printf("First attempt: we were properly locked out.\nWaiting for lock...");
fflush(stdout);
- if (apr_lock_file(file, APR_FLOCK_EXCLUSIVE) != APR_SUCCESS)
+ if (apr_file_lock(file, APR_FLOCK_EXCLUSIVE) != APR_SUCCESS)
errmsg("Could not establish lock on test file.");
printf(" got it.\n");
- (void) apr_close(file);
+ (void) apr_file_close(file);
printf("Exiting.\n");
}
@@ -125,19 +125,19 @@ static void do_write(void)
{
apr_file_t *file;
- if (apr_open(&file, TESTFILE, APR_WRITE|APR_CREATE, APR_OS_DEFAULT,
+ if (apr_file_open(&file, TESTFILE, APR_WRITE|APR_CREATE, APR_OS_DEFAULT,
pool) != APR_SUCCESS)
errmsg("Could not create file.\n");
printf("Test file created.\n");
- if (apr_lock_file(file, APR_FLOCK_EXCLUSIVE) != APR_SUCCESS)
+ if (apr_file_lock(file, APR_FLOCK_EXCLUSIVE) != APR_SUCCESS)
errmsg("Could not lock the file.\n");
printf("Lock created.\nSleeping...");
fflush(stdout);
apr_sleep(30000000); /* 30 seconds */
- (void) apr_close(file);
+ (void) apr_file_close(file);
printf(" done.\nExiting.\n");
}
@@ -158,10 +158,10 @@ int main(int argc, const char * const *argv)
errmsg("Could not initialize APR.\n");
atexit(closeapr);
- if (apr_create_pool(&pool, NULL) != APR_SUCCESS)
+ if (apr_pool_create(&pool, NULL) != APR_SUCCESS)
errmsg("Could not create global pool.\n");
- if (apr_initopt(&opt, pool, argc, argv) != APR_SUCCESS)
+ if (apr_getopt_init(&opt, pool, argc, argv) != APR_SUCCESS)
errmsg("Could not parse options.\n");
while ((status = apr_getopt(opt, "r", &optchar, &optarg)) == APR_SUCCESS) {
diff --git a/test/testmd5.c b/test/testmd5.c
index cf187e4c6..7dc02adf5 100644
--- a/test/testmd5.c
+++ b/test/testmd5.c
@@ -91,22 +91,22 @@ static void try(const void *buf, size_t bufLen, apr_xlate_t *xlate,
apr_md5_ctx_t context;
unsigned char hash[MD5_DIGESTSIZE];
- rv = apr_MD5Init(&context);
+ rv = apr_md5_init(&context);
assert(!rv);
if (xlate) {
#if APR_HAS_XLATE
- apr_MD5SetXlate(&context, xlate);
+ apr_md5_set_xlate(&context, xlate);
#else
fprintf(stderr,
"A translation handle was unexpected.\n");
#endif
}
- rv = apr_MD5Update(&context, buf, bufLen);
+ rv = apr_md5_update(&context, buf, bufLen);
assert(!rv);
- rv = apr_MD5Final(hash, &context);
+ rv = apr_md5_final(hash, &context);
assert(!rv);
for (i = 0; i < MD5_DIGESTSIZE; i++) {
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
assert(!rv);
atexit(apr_terminate);
- rv = apr_create_pool(&pool, NULL);
+ rv = apr_pool_create(&pool, NULL);
if (src) {
#if APR_HAS_XLATE
diff --git a/test/testmmap.c b/test/testmmap.c
index f89c3cd22..d074a6992 100644
--- a/test/testmmap.c
+++ b/test/testmmap.c
@@ -97,7 +97,7 @@ int main(void)
atexit(closeapr);
fprintf(stdout,"Creating context....................");
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Failed.\n");
exit(-1);
}
@@ -108,7 +108,7 @@ int main(void)
strncat(file1,"/testmmap.c",11);
fprintf(stdout, "Opening file........................");
- rv = apr_open(&thefile, file1, flag, APR_UREAD | APR_GREAD, context);
+ rv = apr_file_open(&thefile, file1, flag, APR_UREAD | APR_GREAD, context);
if (rv != APR_SUCCESS) {
fprintf(stderr,
"couldn't open file `%s': %d/%s\n",
@@ -120,7 +120,7 @@ int main(void)
}
fprintf(stderr, "Getting file size...................");
- rv = apr_getfileinfo(&finfo, APR_FINFO_NORM, thefile);
+ rv = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile);
if (rv != APR_SUCCESS) {
fprintf(stderr,
"Didn't get file information: %d/%s\n",
diff --git a/test/testoc.c b/test/testoc.c
index bb641e330..813694df1 100644
--- a/test/testoc.c
+++ b/test/testoc.c
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
exit(-1);
}
atexit(apr_terminate);
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
@@ -114,18 +114,18 @@ int main(int argc, char *argv[])
fprintf(stdout, "[PARENT] Creating procattr.............");
fflush(stdout);
- if (apr_createprocattr_init(&procattr, context) != APR_SUCCESS) {
+ if (apr_procattr_create(&procattr, context) != APR_SUCCESS) {
fprintf(stderr, "Could not create attr\n");
exit(-1);;
}
else {
- apr_setprocattr_io(procattr, APR_FULL_BLOCK, APR_NO_PIPE, APR_NO_PIPE);
+ apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_NO_PIPE, APR_NO_PIPE);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "[PARENT] Starting other child..........");
fflush(stdout);
- if (apr_create_process(&newproc, "./occhild", args, NULL, procattr, context)
+ if (apr_proc_create(&newproc, "./occhild", args, NULL, procattr, context)
!= APR_SUCCESS) {
fprintf(stderr, "error starting other child\n");
exit(-1);
@@ -134,12 +134,12 @@ int main(int argc, char *argv[])
std = newproc.in;
- apr_register_other_child(&newproc, ocmaint, NULL, std, context);
+ apr_proc_other_child_register(&newproc, ocmaint, NULL, std, context);
fprintf(stdout, "[PARENT] Sending SIGKILL to child......");
fflush(stdout);
apr_sleep(1 * APR_USEC_PER_SEC);
- if (apr_kill(&newproc, SIGKILL) != APR_SUCCESS) {
+ if (apr_proc_kill(&newproc, SIGKILL) != APR_SUCCESS) {
fprintf(stderr,"couldn't send the signal!\n");
exit(-1);
}
@@ -147,10 +147,10 @@ int main(int argc, char *argv[])
/* allow time for things to settle... */
apr_sleep(3 * APR_USEC_PER_SEC);
- apr_probe_writable_fds();
+ apr_proc_probe_writable_fds();
fprintf(stdout, "[PARENT] Checking on children..........\n");
- apr_check_other_child();
+ apr_proc_other_child_check();
#else
fprintf(stdout, "OC failed!\n");
fprintf(stdout, "Other_child is not supported on this platform\n");
diff --git a/test/testpipe.c b/test/testpipe.c
index c3657a10c..4a6a8cfc1 100644
--- a/test/testpipe.c
+++ b/test/testpipe.c
@@ -82,7 +82,7 @@ int main(void)
exit(-1);
}
atexit(closeapr);
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
@@ -90,8 +90,8 @@ int main(void)
fprintf(stdout, "Testing pipe functions.\n");
fprintf(stdout, "\tCreating pipes.......");
- if ((rv = apr_create_pipe(&readp, &writep, context)) != APR_SUCCESS) {
- fprintf(stderr, "apr_create_pipe()->%d/%s\n",
+ if ((rv = apr_file_pipe_create(&readp, &writep, context)) != APR_SUCCESS) {
+ fprintf(stderr, "apr_file_pipe_create()->%d/%s\n",
rv, apr_strerror(rv, msgbuf, sizeof msgbuf));
exit(-1);
}
@@ -100,8 +100,8 @@ int main(void)
}
fprintf(stdout, "\tSetting pipe timeout.......");
- if ((rv = apr_set_pipe_timeout(readp, 1 * APR_USEC_PER_SEC)) != APR_SUCCESS) {
- fprintf(stderr, "apr_set_pipe_timeout()->%d/%s\n",
+ if ((rv = apr_file_pipe_timeout_set(readp, 1 * APR_USEC_PER_SEC)) != APR_SUCCESS) {
+ fprintf(stderr, "apr_file_pipe_timeout_set()->%d/%s\n",
rv, apr_strerror(rv, msgbuf, sizeof msgbuf));
exit(-1);
} else {
@@ -111,7 +111,7 @@ int main(void)
fprintf(stdout, "\tReading from the pipe.......");
nbytes = strlen("this is a test");
buf = (char *)apr_palloc(context, nbytes + 1);
- if (apr_read(readp, buf, &nbytes) == APR_TIMEUP) {
+ if (apr_file_read(readp, buf, &nbytes) == APR_TIMEUP) {
fprintf(stdout, "OK\n");
}
else {
diff --git a/test/testproc.c b/test/testproc.c
index 5b66edd82..f4e9e771b 100644
--- a/test/testproc.c
+++ b/test/testproc.c
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
exit(-1);
}
atexit(closeapr);
- apr_create_pool(&context, NULL);
+ apr_pool_create(&context, NULL);
if (argc > 1) {
@@ -102,21 +102,21 @@ int main(int argc, char *argv[])
teststr = apr_pstrdup(context, "Whooo Hoooo\0");
fprintf(stdout, "Creating directory for later use.......");
- if (apr_make_dir("proctest", APR_UREAD | APR_UWRITE | APR_UEXECUTE, context) != APR_SUCCESS) {
+ if (apr_dir_make("proctest", APR_UREAD | APR_UWRITE | APR_UEXECUTE, context) != APR_SUCCESS) {
fprintf(stderr, "Could not create dir\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "Creating procattr.......");
- if (apr_createprocattr_init(&attr, context) != APR_SUCCESS) {
+ if (apr_procattr_create(&attr, context) != APR_SUCCESS) {
fprintf(stderr, "Could not create attr\n");
exit(-1);;
}
fprintf(stdout, "OK.\n");
fprintf(stdout, "Setting attr pipes, all three.......");
- if (apr_setprocattr_io(attr, APR_FULL_BLOCK,
+ if (apr_procattr_io_set(attr, APR_FULL_BLOCK,
APR_CHILD_BLOCK, APR_NO_PIPE) != APR_SUCCESS) {
fprintf(stderr, "Could not set pipes attr\n");
exit(-1);
@@ -124,14 +124,14 @@ int main(int argc, char *argv[])
fprintf(stdout, "OK.\n");
fprintf(stdout, "Setting attr dir.......");
- if (apr_setprocattr_dir(attr, "proctest") != APR_SUCCESS) {
+ if (apr_procattr_dir_set(attr, "proctest") != APR_SUCCESS) {
fprintf(stderr, "Could not set directory attr\n");
exit(-1);
}
fprintf(stdout, "OK.\n");
fprintf(stdout, "Setting attr cmd type.......");
- if (apr_setprocattr_cmdtype(attr, APR_PROGRAM) != APR_SUCCESS) {
+ if (apr_procattr_cmdtype_set(attr, APR_PROGRAM) != APR_SUCCESS) {
fprintf(stderr, "Could not set cmd type attr\n");
exit(-1);
}
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
args[2] = NULL;
fprintf(stdout, "Creating a new process.......");
- if (apr_create_process(&newproc, "../testproc", args, NULL, attr, context) != APR_SUCCESS) {
+ if (apr_proc_create(&newproc, "../testproc", args, NULL, attr, context) != APR_SUCCESS) {
fprintf(stderr, "Could not create the new process\n");
exit(-1);
}
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
length = 256;
fprintf(stdout, "Writing the data to child.......");
- if (apr_write(testfile, teststr, &length) == APR_SUCCESS) {
+ if (apr_file_write(testfile, teststr, &length) == APR_SUCCESS) {
fprintf(stdout,"OK\n");
}
else fprintf(stderr, "Write failed.\n");
@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
length = 256;
fprintf(stdout, "Checking the data read from pipe to child.......");
buf = apr_pcalloc(context, length);
- if (apr_read(testfile, buf, &length) == APR_SUCCESS) {
+ if (apr_file_read(testfile, buf, &length) == APR_SUCCESS) {
if (!strcmp(buf, teststr))
fprintf(stdout,"OK\n");
else fprintf(stderr, "Uh-Oh\n");
@@ -174,14 +174,14 @@ int main(int argc, char *argv[])
else fprintf(stderr, "Read failed.\n");
fprintf(stdout, "Waiting for child to die.......");
- if (apr_wait_proc(&newproc, APR_WAIT) != APR_CHILD_DONE) {
+ if (apr_proc_wait(&newproc, APR_WAIT) != APR_CHILD_DONE) {
fprintf(stderr, "Wait for child failed\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "Removing directory.......");
- if (apr_remove_dir("proctest", context) != APR_SUCCESS) {
+ if (apr_dir_remove("proctest", context) != APR_SUCCESS) {
fprintf(stderr, "Could not remove directory.\n");
exit(-1);
}
diff --git a/test/testshmem.c b/test/testshmem.c
index f88062ad9..8e9bb37be 100644
--- a/test/testshmem.c
+++ b/test/testshmem.c
@@ -102,7 +102,7 @@ int main(void)
apr_initialize();
fprintf(stdout, "Initializing the context.......");
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "could not initialize\n");
exit(-1);
}
@@ -128,7 +128,7 @@ int main(void)
pid = fork();
if (pid == 0) {
apr_sleep(1);
- if (apr_open_shmem(shm) == APR_SUCCESS) {
+ if (apr_shm_open(shm) == APR_SUCCESS) {
msgwait(1);
msgput(0, "Msg received\n");
} else {
diff --git a/test/testsock.c b/test/testsock.c
index d672185e1..c9af113b0 100644
--- a/test/testsock.c
+++ b/test/testsock.c
@@ -74,8 +74,8 @@ static int run_basic_test(apr_pool_t *context)
const char *args[2];
fprintf(stdout, "Creating children to run network tests.......\n");
- s1 = apr_createprocattr_init(&attr1, context);
- s2 = apr_createprocattr_init(&attr2, context);
+ s1 = apr_procattr_create(&attr1, context);
+ s2 = apr_procattr_create(&attr2, context);
if (s1 != APR_SUCCESS || s2 != APR_SUCCESS) {
fprintf(stderr, "Problem creating proc attrs\n");
@@ -84,30 +84,30 @@ static int run_basic_test(apr_pool_t *context)
args[0] = apr_pstrdup(context, "server");
args[1] = NULL;
- s1 = apr_create_process(&proc1, "./server", args, NULL, attr1, context);
+ s1 = apr_proc_create(&proc1, "./server", args, NULL, attr1, context);
/* Sleep for 5 seconds to ensure the server is setup before we begin */
apr_sleep(5000000);
args[0] = apr_pstrdup(context, "client");
- s2 = apr_create_process(&proc2, "./client", args, NULL, attr2, context);
+ s2 = apr_proc_create(&proc2, "./client", args, NULL, attr2, context);
if (s1 != APR_SUCCESS || s2 != APR_SUCCESS) {
fprintf(stderr, "Problem spawning new process\n");
exit(-1);
}
- while ((s1 = apr_wait_proc(&proc1, APR_NOWAIT)) == APR_CHILD_NOTDONE &&
- (s2 = apr_wait_proc(&proc2, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
+ while ((s1 = apr_proc_wait(&proc1, APR_NOWAIT)) == APR_CHILD_NOTDONE &&
+ (s2 = apr_proc_wait(&proc2, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
continue;
}
if (s1 == APR_SUCCESS) {
- apr_kill(&proc2, SIGTERM);
- while (apr_wait_proc(&proc2, APR_WAIT) == APR_CHILD_NOTDONE);
+ apr_proc_kill(&proc2, SIGTERM);
+ while (apr_proc_wait(&proc2, APR_WAIT) == APR_CHILD_NOTDONE);
}
else {
- apr_kill(&proc1, SIGTERM);
- while (apr_wait_proc(&proc1, APR_WAIT) == APR_CHILD_NOTDONE);
+ apr_proc_kill(&proc1, SIGTERM);
+ while (apr_proc_wait(&proc1, APR_WAIT) == APR_CHILD_NOTDONE);
}
fprintf(stdout, "Network test completed.\n");
@@ -125,8 +125,8 @@ static int run_sendfile(apr_pool_t *context, int number)
const char *args[3];
fprintf(stdout, "Creating children to run network tests.......\n");
- s1 = apr_createprocattr_init(&attr1, context);
- s2 = apr_createprocattr_init(&attr2, context);
+ s1 = apr_procattr_create(&attr1, context);
+ s2 = apr_procattr_create(&attr2, context);
if (s1 != APR_SUCCESS || s2 != APR_SUCCESS) {
fprintf(stderr, "Problem creating proc attrs\n");
@@ -136,7 +136,7 @@ static int run_sendfile(apr_pool_t *context, int number)
args[0] = apr_pstrdup(context, "sendfile");
args[1] = apr_pstrdup(context, "server");
args[2] = NULL;
- s1 = apr_create_process(&proc1, "./sendfile", args, NULL, attr1, context);
+ s1 = apr_proc_create(&proc1, "./sendfile", args, NULL, attr1, context);
/* Sleep for 5 seconds to ensure the server is setup before we begin */
apr_sleep(5000000);
@@ -155,25 +155,25 @@ static int run_sendfile(apr_pool_t *context, int number)
break;
}
}
- s2 = apr_create_process(&proc2, "./sendfile", args, NULL, attr2, context);
+ s2 = apr_proc_create(&proc2, "./sendfile", args, NULL, attr2, context);
if (s1 != APR_SUCCESS || s2 != APR_SUCCESS) {
fprintf(stderr, "Problem spawning new process\n");
exit(-1);
}
- while ((s1 = apr_wait_proc(&proc1, APR_NOWAIT)) == APR_CHILD_NOTDONE &&
- (s2 = apr_wait_proc(&proc2, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
+ while ((s1 = apr_proc_wait(&proc1, APR_NOWAIT)) == APR_CHILD_NOTDONE &&
+ (s2 = apr_proc_wait(&proc2, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
continue;
}
if (s1 == APR_SUCCESS) {
- apr_kill(&proc2, SIGTERM);
- while (apr_wait_proc(&proc2, APR_WAIT) == APR_CHILD_NOTDONE);
+ apr_proc_kill(&proc2, SIGTERM);
+ while (apr_proc_wait(&proc2, APR_WAIT) == APR_CHILD_NOTDONE);
}
else {
- apr_kill(&proc1, SIGTERM);
- while (apr_wait_proc(&proc1, APR_WAIT) == APR_CHILD_NOTDONE);
+ apr_proc_kill(&proc1, SIGTERM);
+ while (apr_proc_wait(&proc1, APR_WAIT) == APR_CHILD_NOTDONE);
}
fprintf(stdout, "Network test completed.\n");
@@ -198,7 +198,7 @@ int main(int argc, char *argv[])
atexit(closeapr);
fprintf(stdout, "Creating context.......");
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Could not create context\n");
exit(-1);
}
diff --git a/test/testsockopt.c b/test/testsockopt.c
index 6c9403d68..3759f5e3f 100644
--- a/test/testsockopt.c
+++ b/test/testsockopt.c
@@ -66,14 +66,14 @@
static void failure(apr_socket_t *sock)
{
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("Failed!\n");
exit(-1);
}
static void failureno(apr_socket_t *sock)
{
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("No!\n");
exit(-1);
}
@@ -96,11 +96,11 @@ int main(void)
exit(-1);
}
atexit(closeapr);
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
- if (apr_create_pool(&cont2, context) != APR_SUCCESS) {
+ if (apr_pool_create(&cont2, context) != APR_SUCCESS) {
fprintf(stderr, "Couldn't allocate context.");
exit(-1);
}
@@ -108,7 +108,7 @@ int main(void)
printf("Testing socket option functions.\n");
printf("\tCreating socket..........................");
- if ((stat = apr_create_socket(&sock, APR_INET, SOCK_STREAM, context))
+ if ((stat = apr_socket_create(&sock, APR_INET, SOCK_STREAM, context))
!= APR_SUCCESS){
printf("Failed to create a socket!\n");
exit(-1);
@@ -117,7 +117,7 @@ int main(void)
printf ("\tTrying to set APR_SO_KEEPALIVE...........");
if (apr_setsocketopt(sock, APR_SO_KEEPALIVE, 1) != APR_SUCCESS){
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("Failed!\n");
exit (-1);
}
@@ -125,12 +125,12 @@ int main(void)
printf("\tChecking if we recorded it...............");
if (apr_getsocketopt(sock, APR_SO_KEEPALIVE, &ck) != APR_SUCCESS){
- apr_close_socket(sock);
+ apr_socket_close(sock);
fprintf(stderr,"Failed\n");
exit(-1);
}
if (ck != 1){
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("No (%d)\n", ck);
exit(-1);
}
@@ -138,7 +138,7 @@ int main(void)
printf("\tTrying to set APR_SO_DEBUG...............");
if (apr_setsocketopt(sock, APR_SO_DEBUG, 1) != APR_SUCCESS){
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("Failed\n");
exit (-1);
}
@@ -146,20 +146,20 @@ int main(void)
printf("\tChecking if we recorded it...............");
if (apr_getsocketopt(sock, APR_SO_DEBUG, &ck) != APR_SUCCESS){
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("Failed!\n");
exit (-1);
}
if (ck != 1){
printf ("No (%d)\n", ck);
- apr_close_socket(sock);
+ apr_socket_close(sock);
exit (-1);
}
printf ("Yes\n");
printf ("\tTrying to remove APR_SO_KEEPALIVE........");
if (apr_setsocketopt(sock, APR_SO_KEEPALIVE, 0) != APR_SUCCESS){
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("Failed!\n");
exit (-1);
}
@@ -167,7 +167,7 @@ int main(void)
printf ("\tDid we record the removal................");
if (apr_getsocketopt(sock, APR_SO_KEEPALIVE, &ck) != APR_SUCCESS){
- apr_close_socket(sock);
+ apr_socket_close(sock);
printf("Didn't get value!\n");
exit(-1);
}
@@ -215,7 +215,7 @@ int main(void)
#endif
printf("\tTrying to close the socket...............");
- if ((stat = apr_close_socket(sock)) != APR_SUCCESS){
+ if ((stat = apr_socket_close(sock)) != APR_SUCCESS){
printf("Failed to close the socket!\n");
exit(-1);
}
diff --git a/test/testthread.c b/test/testthread.c
index 3e572433d..3ed5bcd21 100644
--- a/test/testthread.c
+++ b/test/testthread.c
@@ -77,9 +77,9 @@ void * APR_THREAD_FUNC thread_func1(void *data)
{
int i;
for (i = 0; i < 10000; i++) {
- apr_lock(thread_lock);
+ apr_lock_aquire(thread_lock);
x++;
- apr_unlock(thread_lock);
+ apr_lock_release(thread_lock);
}
return NULL;
}
@@ -88,9 +88,9 @@ void * APR_THREAD_FUNC thread_func2(void *data)
{
int i;
for (i = 0; i < 10000; i++) {
- apr_lock(thread_lock);
+ apr_lock_aquire(thread_lock);
x++;
- apr_unlock(thread_lock);
+ apr_lock_release(thread_lock);
}
return NULL;
}
@@ -99,9 +99,9 @@ void * APR_THREAD_FUNC thread_func3(void *data)
{
int i;
for (i = 0; i < 10000; i++) {
- apr_lock(thread_lock);
+ apr_lock_aquire(thread_lock);
x++;
- apr_unlock(thread_lock);
+ apr_lock_release(thread_lock);
}
return NULL;
}
@@ -110,9 +110,9 @@ void * APR_THREAD_FUNC thread_func4(void *data)
{
int i;
for (i = 0; i < 10000; i++) {
- apr_lock(thread_lock);
+ apr_lock_aquire(thread_lock);
x++;
- apr_unlock(thread_lock);
+ apr_lock_release(thread_lock);
}
return NULL;
}
@@ -132,14 +132,14 @@ int main(void)
apr_initialize();
fprintf(stdout, "Initializing the context.......");
- if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
fprintf(stderr, "could not initialize\n");
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "Initializing the lock.......");
- s1 = apr_create_lock(&thread_lock, APR_MUTEX, APR_INTRAPROCESS, "lock.file", context);
+ s1 = apr_lock_create(&thread_lock, APR_MUTEX, APR_INTRAPROCESS, "lock.file", context);
if (s1 != APR_SUCCESS) {
fprintf(stderr, "Could not create lock\n");
exit(-1);
@@ -147,10 +147,10 @@ int main(void)
fprintf(stdout, "OK\n");
fprintf(stdout, "Starting all the threads.......");
- s1 = apr_create_thread(&t1, NULL, thread_func1, NULL, context);
- s2 = apr_create_thread(&t2, NULL, thread_func2, NULL, context);
- s3 = apr_create_thread(&t3, NULL, thread_func3, NULL, context);
- s4 = apr_create_thread(&t4, NULL, thread_func4, NULL, context);
+ s1 = apr_thread_create(&t1, NULL, thread_func1, NULL, context);
+ s2 = apr_thread_create(&t2, NULL, thread_func2, NULL, context);
+ s3 = apr_thread_create(&t3, NULL, thread_func3, NULL, context);
+ s4 = apr_thread_create(&t4, NULL, thread_func4, NULL, context);
if (s1 != APR_SUCCESS || s2 != APR_SUCCESS ||
s3 != APR_SUCCESS || s4 != APR_SUCCESS) {
fprintf(stderr, "Error starting thread\n");
diff --git a/test/testtime.c b/test/testtime.c
index a246ac3b5..20f315cf1 100644
--- a/test/testtime.c
+++ b/test/testtime.c
@@ -69,8 +69,8 @@ int main(void)
fprintf(stdout, "Testing Time functions.\n");
- fprintf(stdout, "\tapr_now.......");
- now = apr_now();
+ fprintf(stdout, "\tapr_time_now.......");
+ now = apr_time_now();
fprintf(stdout, "OK\n");
fprintf(stdout, "\tapr_explode_localtime.......");
diff --git a/test/testuuid.c b/test/testuuid.c
index 6330f6c41..1d4c7e9d4 100644
--- a/test/testuuid.c
+++ b/test/testuuid.c
@@ -64,11 +64,11 @@ int main(int argc, char **argv)
char buf[APR_UUID_FORMATTED_LENGTH + 1];
int retcode = 0;
- apr_get_uuid(&uuid);
- apr_format_uuid(buf, &uuid);
+ apr_uuid_get(&uuid);
+ apr_uuid_format(buf, &uuid);
printf("UUID: %s\n", buf);
- apr_parse_uuid(&uuid2, buf);
+ apr_uuid_parse(&uuid2, buf);
if (memcmp(&uuid, &uuid2, sizeof(uuid)) == 0)
printf("Parse appears to work.\n");
else {
@@ -76,15 +76,15 @@ int main(int argc, char **argv)
retcode = 1;
}
- apr_format_uuid(buf, &uuid2);
+ apr_uuid_format(buf, &uuid2);
printf("parsed/reformatted UUID: %s\n", buf);
/* generate two of them quickly */
- apr_get_uuid(&uuid);
- apr_get_uuid(&uuid2);
- apr_format_uuid(buf, &uuid);
+ apr_uuid_get(&uuid);
+ apr_uuid_get(&uuid2);
+ apr_uuid_format(buf, &uuid);
printf("UUID 1: %s\n", buf);
- apr_format_uuid(buf, &uuid2);
+ apr_uuid_format(buf, &uuid2);
printf("UUID 2: %s\n", buf);
return retcode;