| 1 | /* Function declarations for libiberty.
|
|---|
| 2 |
|
|---|
| 3 | Copyright 2001, 2002 Free Software Foundation, Inc.
|
|---|
| 4 |
|
|---|
| 5 | Note - certain prototypes declared in this header file are for
|
|---|
| 6 | functions whoes implementation copyright does not belong to the
|
|---|
| 7 | FSF. Those prototypes are present in this file for reference
|
|---|
| 8 | purposes only and their presence in this file should not construed
|
|---|
| 9 | as an indication of ownership by the FSF of the implementation of
|
|---|
| 10 | those functions in any way or form whatsoever.
|
|---|
| 11 |
|
|---|
| 12 | This program is free software; you can redistribute it and/or modify
|
|---|
| 13 | it under the terms of the GNU General Public License as published by
|
|---|
| 14 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 15 | any later version.
|
|---|
| 16 |
|
|---|
| 17 | This program is distributed in the hope that it will be useful,
|
|---|
| 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 20 | GNU General Public License for more details.
|
|---|
| 21 |
|
|---|
| 22 | You should have received a copy of the GNU General Public License
|
|---|
| 23 | along with this program; if not, write to the Free Software
|
|---|
| 24 | Foundation, Inc., 59 Temple Place - Suite 330,
|
|---|
| 25 | Boston, MA 02111-1307, USA.
|
|---|
| 26 |
|
|---|
| 27 | Written by Cygnus Support, 1994.
|
|---|
| 28 |
|
|---|
| 29 | The libiberty library provides a number of functions which are
|
|---|
| 30 | missing on some operating systems. We do not declare those here,
|
|---|
| 31 | to avoid conflicts with the system header files on operating
|
|---|
| 32 | systems that do support those functions. In this file we only
|
|---|
| 33 | declare those functions which are specific to libiberty. */
|
|---|
| 34 |
|
|---|
| 35 | #ifndef LIBIBERTY_H
|
|---|
| 36 | #define LIBIBERTY_H
|
|---|
| 37 |
|
|---|
| 38 | #ifdef __cplusplus
|
|---|
| 39 | extern "C" {
|
|---|
| 40 | #endif
|
|---|
| 41 |
|
|---|
| 42 | #include "ansidecl.h"
|
|---|
| 43 |
|
|---|
| 44 | #ifdef ANSI_PROTOTYPES
|
|---|
| 45 | /* Get a definition for size_t. */
|
|---|
| 46 | #include <stddef.h>
|
|---|
| 47 | /* Get a definition for va_list. */
|
|---|
| 48 | #include <stdarg.h>
|
|---|
| 49 | #endif
|
|---|
| 50 |
|
|---|
| 51 | /* Build an argument vector from a string. Allocates memory using
|
|---|
| 52 | malloc. Use freeargv to free the vector. */
|
|---|
| 53 |
|
|---|
| 54 | extern char **buildargv PARAMS ((const char *)) ATTRIBUTE_MALLOC;
|
|---|
| 55 |
|
|---|
| 56 | /* Free a vector returned by buildargv. */
|
|---|
| 57 |
|
|---|
| 58 | extern void freeargv PARAMS ((char **));
|
|---|
| 59 |
|
|---|
| 60 | /* Duplicate an argument vector. Allocates memory using malloc. Use
|
|---|
| 61 | freeargv to free the vector. */
|
|---|
| 62 |
|
|---|
| 63 | extern char **dupargv PARAMS ((char **)) ATTRIBUTE_MALLOC;
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | /* Return the last component of a path name. Note that we can't use a
|
|---|
| 67 | prototype here because the parameter is declared inconsistently
|
|---|
| 68 | across different systems, sometimes as "char *" and sometimes as
|
|---|
| 69 | "const char *" */
|
|---|
| 70 |
|
|---|
| 71 | /* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
|
|---|
| 72 | undefined, we haven't run the autoconf check so provide the
|
|---|
| 73 | declaration without arguments. If it is 0, we checked and failed
|
|---|
| 74 | to find the declaration so provide a fully prototyped one. If it
|
|---|
| 75 | is 1, we found it so don't provide any declaration at all. */
|
|---|
| 76 | #if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || (defined (HAVE_DECL_BASENAME) && !HAVE_DECL_BASENAME)
|
|---|
| 77 | extern char *basename PARAMS ((const char *));
|
|---|
| 78 | #else
|
|---|
| 79 | # if !defined (HAVE_DECL_BASENAME)
|
|---|
| 80 | extern char *basename ();
|
|---|
| 81 | # endif
|
|---|
| 82 | #endif
|
|---|
| 83 |
|
|---|
| 84 | /* A well-defined basename () that is always compiled in. */
|
|---|
| 85 |
|
|---|
| 86 | extern const char *lbasename PARAMS ((const char *));
|
|---|
| 87 |
|
|---|
| 88 | /* Concatenate an arbitrary number of strings. You must pass NULL as
|
|---|
| 89 | the last argument of this function, to terminate the list of
|
|---|
| 90 | strings. Allocates memory using xmalloc. */
|
|---|
| 91 |
|
|---|
| 92 | extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC;
|
|---|
| 93 |
|
|---|
| 94 | /* Concatenate an arbitrary number of strings. You must pass NULL as
|
|---|
| 95 | the last argument of this function, to terminate the list of
|
|---|
| 96 | strings. Allocates memory using xmalloc. The first argument is
|
|---|
| 97 | not one of the strings to be concatenated, but if not NULL is a
|
|---|
| 98 | pointer to be freed after the new string is created, similar to the
|
|---|
| 99 | way xrealloc works. */
|
|---|
| 100 |
|
|---|
| 101 | extern char *reconcat PARAMS ((char *, const char *, ...)) ATTRIBUTE_MALLOC;
|
|---|
| 102 |
|
|---|
| 103 | /* Determine the length of concatenating an arbitrary number of
|
|---|
| 104 | strings. You must pass NULL as the last argument of this function,
|
|---|
| 105 | to terminate the list of strings. */
|
|---|
| 106 |
|
|---|
| 107 | extern unsigned long concat_length PARAMS ((const char *, ...));
|
|---|
| 108 |
|
|---|
| 109 | /* Concatenate an arbitrary number of strings into a SUPPLIED area of
|
|---|
| 110 | memory. You must pass NULL as the last argument of this function,
|
|---|
| 111 | to terminate the list of strings. The supplied memory is assumed
|
|---|
| 112 | to be large enough. */
|
|---|
| 113 |
|
|---|
| 114 | extern char *concat_copy PARAMS ((char *, const char *, ...));
|
|---|
| 115 |
|
|---|
| 116 | /* Concatenate an arbitrary number of strings into a GLOBAL area of
|
|---|
| 117 | memory. You must pass NULL as the last argument of this function,
|
|---|
| 118 | to terminate the list of strings. The supplied memory is assumed
|
|---|
| 119 | to be large enough. */
|
|---|
| 120 |
|
|---|
|
|---|