test_parser.c revision 842ae4bd224140319ae7feec1872b93dfd491143
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd/* Licensed to the Apache Software Foundation (ASF) under one or more
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * contributor license agreements. See the NOTICE file distributed with
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * this work for additional information regarding copyright ownership.
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * The ASF licenses this file to You under the Apache License, Version 2.0
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * (the "License"); you may not use this file except in compliance with
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * the License. You may obtain a copy of the License at
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd *
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * http://www.apache.org/licenses/LICENSE-2.0
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd *
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * Unless required by applicable law or agreed to in writing, software
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * distributed under the License is distributed on an "AS IS" BASIS,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * See the License for the specific language governing permissions and
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * limitations under the License.
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd */
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd/* This program tests the ap_get_list_item routine in ../main/util.c.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd *
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * The defines in this sample compile line are specific to Roy's system.
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * They should match whatever was used to compile Apache first.
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd *
3f08db06526d6901aa08c110b5bc7dde6bc39905nd gcc -g -O2 -I../os/unix -I../include -o test_parser \
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \
9472e4d3c410be3b3f1addbf3b1db1769f64e765nd ../main/alloc.o ../main/buff.o ../main/util.o \
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd ../ap/libap.a -lsocket -lnsl test_parser.c
1c8f2418892d98febb00a06b9a4f45f8bcfd80a3nd *
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd * Roy Fielding, 1999
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd */
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen#include <stdio.h>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen#include <stdlib.h>
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd#include "httpd.h"
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem#include "apr_general.h"
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem/*
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem * Dummy a bunch of stuff just to get a compile
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd */
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nduid_t ap_user_id;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34ndgid_t ap_group_id;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34ndvoid *ap_dummy_mutex = &ap_dummy_mutex;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34ndchar *ap_server_argv0;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34ndAP_DECLARE(void) ap_block_alarms(void)
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd{
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd ;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd}
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
4b5981e276e93df97c34e4da05ca5cf8bbd937dandAP_DECLARE(void) ap_unblock_alarms(void)
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd{
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd ;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd}
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34ndAP_DECLARE(void) ap_log_error(const char *file, int line, int level,
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd const request_rec *r, const char *fmt, ...)
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd{
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd ;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd}
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34ndint main (void)
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd{
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd apr_pool_t *p;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd const char *field;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd char *newstr;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd char instr[512];
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd p = apr_pool_alloc_init();
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd while (gets(instr)) {
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd printf(" [%s] ==\n", instr);
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd field = instr;
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd while ((newstr = ap_get_list_item(p, &field)) != NULL)
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd printf(" <%s> ..\n", newstr);
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd }
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd exit(0);
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd}
97a3ecc40b65d5f8e865bbe0b1c9325d8c016e34nd