Blame test/test_parser.c

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