summaryrefslogtreecommitdiff
path: root/test/testpipe.c
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2000-06-19 13:54:49 +0000
committerJeff Trawick <trawick@apache.org>2000-06-19 13:54:49 +0000
commit5190cfc0c899d0793c8bc75eb3177cd43103fa97 (patch)
tree9785221eba9c61e350d5b7a555103d90d6d36b49 /test/testpipe.c
parentb9a433d404e51aae211349cd6feb01cba6b4cf28 (diff)
downloadapr-5190cfc0c899d0793c8bc75eb3177cd43103fa97.tar.gz
win32/pipe.c:
clean up some error handling logic: on Win9x, return APR_ENOTIMPL instead of APR_SUCCESS from ap_set_pipe_timeout() test/testpipe.c: don't use perror() to report an APR error git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60225 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testpipe.c')
-rw-r--r--test/testpipe.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/testpipe.c b/test/testpipe.c
index 1c96ac92a..91ec156a7 100644
--- a/test/testpipe.c
+++ b/test/testpipe.c
@@ -62,16 +62,15 @@
#include <unistd.h>
#endif
-int test_filedel(ap_pool_t *);
-int testdirs(ap_pool_t *);
-
-int main()
+int main(void)
{
ap_pool_t *context;
ap_file_t *readp = NULL;
ap_file_t *writep = NULL;
ap_size_t nbytes;
+ ap_status_t rv;
char *buf;
+ char msgbuf[120];
if (ap_initialize() != APR_SUCCESS) {
fprintf(stderr, "Couldn't initialize.");
@@ -86,8 +85,9 @@ int main()
fprintf(stdout, "Testing pipe functions.\n");
fprintf(stdout, "\tCreating pipes.......");
- if (ap_create_pipe(&readp, &writep, context) != APR_SUCCESS) {
- perror("Didn't create the pipe");
+ if ((rv = ap_create_pipe(&readp, &writep, context)) != APR_SUCCESS) {
+ fprintf(stderr, "ap_create_pipe()->%d/%s\n",
+ rv, ap_strerror(rv, msgbuf, sizeof msgbuf));
exit(-1);
}
else {
@@ -95,14 +95,15 @@ int main()
}
fprintf(stdout, "\tSetting pipe timeout.......");
- if (ap_set_pipe_timeout(readp, 1 * AP_USEC_PER_SEC) != APR_SUCCESS) {
- perror("Couldn't set a timeout");
+ if ((rv = ap_set_pipe_timeout(readp, 1 * AP_USEC_PER_SEC)) != APR_SUCCESS) {
+ fprintf(stderr, "ap_set_pipe_timeout()->%d/%s\n",
+ rv, ap_strerror(rv, msgbuf, sizeof msgbuf));
exit(-1);
} else {
fprintf(stdout, "OK\n");
}
- fprintf(stdout, "\tReading from the file.......");
+ fprintf(stdout, "\tReading from the pipe.......");
nbytes = (ap_ssize_t)strlen("this is a test");
buf = (char *)ap_palloc(context, nbytes + 1);
if (ap_read(readp, buf, &nbytes) == APR_TIMEUP) {