]> granicus.if.org Git - apache/blob - test/test_parser.c
prefix libapr functions and types with apr_
[apache] / test / test_parser.c
1 /* This program tests the ap_get_list_item routine in ../main/util.c.
2  *
3  * The defines in this sample compile line are specific to Roy's system.
4  * They should match whatever was used to compile Apache first.
5  *
6      gcc -g -O2 -I../os/unix -I../include -o test_parser \
7             -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \
8             ../main/alloc.o ../main/buff.o ../main/util.o \
9             ../ap/libap.a -lsocket -lnsl test_parser.c
10  * 
11  * Roy Fielding, 1999
12  */
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include "httpd.h"
16 #include "apr_general.h"
17
18 /*
19  * Dummy a bunch of stuff just to get a compile
20  */
21 uid_t ap_user_id;
22 gid_t ap_group_id;
23 void *ap_dummy_mutex = &ap_dummy_mutex;
24 char *ap_server_argv0;
25
26 API_EXPORT(void) ap_block_alarms(void)
27 {
28     ;
29 }
30
31 API_EXPORT(void) ap_unblock_alarms(void)
32 {
33     ;
34 }
35
36 API_EXPORT(void) ap_log_error(const char *file, int line, int level,
37                                const request_rec *r, const char *fmt, ...)
38 {
39     ;
40 }
41
42 int main (void)
43 {
44     apr_pool_t *p;
45     const char *field;
46     char *newstr;
47     char instr[512];
48
49     p = apr_init_alloc();
50
51     while (gets(instr)) {
52         printf("  [%s] ==\n", instr);
53         field = instr;
54         while ((newstr = ap_get_list_item(p, &field)) != NULL)
55             printf("  <%s> ..\n", newstr);
56     }
57     
58     exit(0);
59 }