This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / include / libiberty.h
CommitLineData
e51437f1
ILT
1/* Function declarations for libiberty.
2 Written by Cygnus Support, 1994.
3
4 The libiberty library provides a number of functions which are
5 missing on some operating systems. We do not declare those here,
6 to avoid conflicts with the system header files on operating
7 systems that do support those functions. In this file we only
8 declare those functions which are specific to libiberty. */
9
10#ifndef LIBIBERTY_H
11#define LIBIBERTY_H
12
4e28f19f
JL
13#ifdef __cplusplus
14extern "C" {
15#endif
16
e51437f1
ILT
17#include "ansidecl.h"
18
19/* Build an argument vector from a string. Allocates memory using
20 malloc. Use freeargv to free the vector. */
21
22extern char **buildargv PARAMS ((char *));
23
24/* Free a vector returned by buildargv. */
25
26extern void freeargv PARAMS ((char **));
27
4e28f19f
JL
28/* Duplicate an argument vector. Allocates memory using malloc. Use
29 freeargv to free the vector. */
30
31extern char **dupargv PARAMS ((char **));
32
33
77f7bfd8
FF
34/* Return the last component of a path name. Note that we can't use a
35 prototype here because the parameter is declared inconsistently
36 across different systems, sometimes as "char *" and sometimes as
37 "const char *" */
e51437f1 38
4e28f19f
JL
39#if defined(__GNU_LIBRARY__ ) || defined (__linux__)
40extern char *basename PARAMS ((const char *));
41#else
77f7bfd8 42extern char *basename ();
4e28f19f 43#endif
e51437f1
ILT
44
45/* Concatenate an arbitrary number of strings, up to (char *) NULL.
46 Allocates memory using xmalloc. */
47
48extern char *concat PARAMS ((const char *, ...));
49
50/* Check whether two file descriptors refer to the same file. */
51
52extern int fdmatch PARAMS ((int fd1, int fd2));
53
54/* Get the amount of time the process has run, in microseconds. */
55
56extern long get_run_time PARAMS ((void));
57
77f7bfd8
FF
58/* Choose a temporary directory to use for scratch files. */
59
60extern char *choose_temp_base PARAMS ((void));
61
e51437f1
ILT
62/* Allocate memory filled with spaces. Allocates using malloc. */
63
64extern const char *spaces PARAMS ((int count));
65
66/* Return the maximum error number for which strerror will return a
67 string. */
68
69extern int errno_max PARAMS ((void));
70
71/* Return the name of an errno value (e.g., strerrno (EINVAL) returns
72 "EINVAL"). */
73
74extern const char *strerrno PARAMS ((int));
75
76/* Given the name of an errno value, return the value. */
77
78extern int strtoerrno PARAMS ((const char *));
79
77f7bfd8
FF
80/* ANSI's strerror(), but more robust. */
81
82extern char *xstrerror PARAMS ((int));
83
e51437f1
ILT
84/* Return the maximum signal number for which strsignal will return a
85 string. */
86
87extern int signo_max PARAMS ((void));
88
ba1c97e7
KR
89/* Return a signal message string for a signal number
90 (e.g., strsignal (SIGHUP) returns something like "Hangup"). */
91/* This is commented out as it can conflict with one in system headers.
92 We still document its existence though. */
e51437f1 93
ba1c97e7 94/*extern const char *strsignal PARAMS ((int));*/
e51437f1
ILT
95
96/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
97 "SIGHUP"). */
98
99extern const char *strsigno PARAMS ((int));
100
101/* Given the name of a signal, return its number. */
102
103extern int strtosigno PARAMS ((const char *));
104
105/* Register a function to be run by xexit. Returns 0 on success. */
106
107extern int xatexit PARAMS ((void (*fn) (void)));
108
109/* Exit, calling all the functions registered with xatexit. */
110
111#ifndef __GNUC__
112extern void xexit PARAMS ((int status));
113#else
4e28f19f 114void xexit PARAMS ((int status)) __attribute__ ((noreturn));
e51437f1
ILT
115#endif
116
117/* Set the program name used by xmalloc. */
118
119extern void xmalloc_set_program_name PARAMS ((const char *));
120
121/* Allocate memory without fail. If malloc fails, this will print a
122 message to stderr (using the name set by xmalloc_set_program_name,
4e28f19f 123 if any) and then call xexit. */
e51437f1 124
4e28f19f
JL
125#ifdef ANSI_PROTOTYPES
126/* Get a definition for size_t. */
127#include <stddef.h>
128#endif
129extern PTR xmalloc PARAMS ((size_t));
e51437f1
ILT
130
131/* Reallocate memory without fail. This works like xmalloc.
132
133 FIXME: We do not declare the parameter types for the same reason as
134 xmalloc. */
135
4e28f19f 136extern PTR xrealloc PARAMS ((PTR, size_t));
e51437f1 137
77f7bfd8
FF
138/* Copy a string into a memory buffer without fail. */
139
140extern char *xstrdup PARAMS ((const char *));
141
ba1c97e7
KR
142/* hex character manipulation routines */
143
144#define _hex_array_size 256
145#define _hex_bad 99
146extern char _hex_value[_hex_array_size];
147extern void hex_init PARAMS ((void));
df8d5082 148#define hex_p(c) (hex_value (c) != _hex_bad)
ba1c97e7
KR
149/* If you change this, note well: Some code relies on side effects in
150 the argument being performed exactly once. */
151#define hex_value(c) (_hex_value[(unsigned char) (c)])
152
4e28f19f
JL
153/* Definitions used by the pexecute routine. */
154
155#define PEXECUTE_FIRST 1
156#define PEXECUTE_LAST 2
157#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
158#define PEXECUTE_SEARCH 4
159#define PEXECUTE_VERBOSE 8
160
161/* Execute a program. */
162
163extern int pexecute PARAMS ((const char *, char * const *, const char *,
164 const char *, char **, char **, int));
165
166/* Wait for pexecute to finish. */
167
168extern int pwait PARAMS ((int, int *, int));
169
170#ifdef __cplusplus
171}
172#endif
173
174
e51437f1 175#endif /* ! defined (LIBIBERTY_H) */
This page took 0.190341 seconds and 4 git commands to generate.