GME  13
apr_getopt.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_GETOPT_H
00018 #define APR_GETOPT_H
00019 
00025 #include "apr_pools.h"
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif /* __cplusplus */
00030 
00042 typedef void (apr_getopt_err_fn_t)(void *arg, const char *err, ...);
00043 
00045 typedef struct apr_getopt_t apr_getopt_t;
00046 
00050 struct apr_getopt_t {
00052     apr_pool_t *cont;
00054     apr_getopt_err_fn_t *errfn;
00056     void *errarg;
00058     int ind;
00060     int opt;
00062     int reset;
00064     int argc;
00066     const char **argv;
00068     char const* place;
00070     int interleave;
00072     int skip_start;
00074     int skip_end;
00075 };
00076 
00078 typedef struct apr_getopt_option_t apr_getopt_option_t;
00079 
00083 struct apr_getopt_option_t {
00085     const char *name;
00087     int optch;
00089     int has_arg;
00091     const char *description;
00092 };
00093 
00103 APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont,
00104                                       int argc, const char * const *argv);
00105 
00122 APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, 
00123                                      char *option_ch, const char **option_arg);
00124 
00150 APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os,
00151                                           const apr_getopt_option_t *opts,
00152                                           int *option_ch,
00153                                           const char **option_arg);
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159 
00160 #endif  /* ! APR_GETOPT_H */