GME  13
apr_strings.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 /* Portions of this file are covered by */
00018 /* -*- mode: c; c-file-style: "k&r" -*-
00019 
00020   strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
00021   Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
00022 
00023   This software is provided 'as-is', without any express or implied
00024   warranty.  In no event will the authors be held liable for any damages
00025   arising from the use of this software.
00026 
00027   Permission is granted to anyone to use this software for any purpose,
00028   including commercial applications, and to alter it and redistribute it
00029   freely, subject to the following restrictions:
00030 
00031   1. The origin of this software must not be misrepresented; you must not
00032      claim that you wrote the original software. If you use this software
00033      in a product, an acknowledgment in the product documentation would be
00034      appreciated but is not required.
00035   2. Altered source versions must be plainly marked as such, and must not be
00036      misrepresented as being the original software.
00037   3. This notice may not be removed or altered from any source distribution.
00038 */
00039 
00040 #ifndef APR_STRINGS_H
00041 #define APR_STRINGS_H
00042 
00048 #include "apr.h"
00049 #include "apr_errno.h"
00050 #include "apr_pools.h"
00051 #define APR_WANT_IOVEC
00052 #include "apr_want.h"
00053 
00054 #if APR_HAVE_STDARG_H
00055 #include <stdarg.h>
00056 #endif
00057 
00058 #ifdef __cplusplus
00059 extern "C" {
00060 #endif /* __cplusplus */
00061 
00076 APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b);
00077 
00087 APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b);
00088 
00095 APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
00096 
00109 APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n)
00110 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
00111     __attribute__((alloc_size(3)))
00112 #endif
00113     ;
00114 
00125 APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n);
00126 
00135 APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n)
00136 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
00137     __attribute__((alloc_size(3)))
00138 #endif
00139     ;
00140 
00147 APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...)
00148 #if defined(__GNUC__) && __GNUC__ >= 4
00149     __attribute__((sentinel))
00150 #endif
00151     ;
00152 
00161 APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
00162                                  apr_size_t nvec, apr_size_t *nbytes);
00163 
00172 APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
00173 
00182 APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...)
00183         __attribute__((format(printf,2,3)));
00184 
00207 APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src,
00208                                 apr_size_t dst_size);
00209 
00217 APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src);
00218 
00226 APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
00227                                                char ***argv_out,
00228                                                apr_pool_t *token_context);
00229 
00241 APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last);
00242 
00273 APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
00274                                      const char *format, ...)
00275         __attribute__((format(printf,3,4)));
00276 
00285 APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
00286                                va_list ap);
00295 APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n);
00296 
00303 APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n);
00304 
00311 APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n);
00312 
00329 APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf, 
00330                                       char **end, int base);
00331 
00347 APR_DECLARE(apr_int64_t) apr_strtoi64(const char *buf, char **end, int base);
00348 
00356 APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf);
00357 
00366 APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf);
00367 
00370 #ifdef __cplusplus
00371 }
00372 #endif
00373 
00374 #endif  /* !APR_STRINGS_H */