1 /* Function declarations for libiberty.
2 Written by Cygnus Support, 1994.
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. */
15 /* Build an argument vector from a string. Allocates memory using
16 malloc. Use freeargv to free the vector. */
18 extern char **buildargv PARAMS ((char *));
20 /* Free a vector returned by buildargv. */
22 extern void freeargv PARAMS ((char **));
24 /* Return the last component of a path name. */
26 extern char *basename PARAMS ((char *));
28 /* Concatenate an arbitrary number of strings, up to (char *) NULL.
29 Allocates memory using xmalloc. */
31 extern char *concat PARAMS ((const char *, ...));
33 /* Check whether two file descriptors refer to the same file. */
35 extern int fdmatch PARAMS ((int fd1, int fd2));
37 /* Get the amount of time the process has run, in microseconds. */
39 extern long get_run_time PARAMS ((void));
41 /* Allocate memory filled with spaces. Allocates using malloc. */
43 extern const char *spaces PARAMS ((int count));
45 /* Return the maximum error number for which strerror will return a
48 extern int errno_max PARAMS ((void));
50 /* Return the name of an errno value (e.g., strerrno (EINVAL) returns
53 extern const char *strerrno PARAMS ((int));
55 /* Given the name of an errno value, return the value. */
57 extern int strtoerrno PARAMS ((const char *));
59 /* Return the maximum signal number for which strsignal will return a
62 extern int signo_max PARAMS ((void));
64 /* Return a signal message string for a signal number (e.g., strsignal
65 (SIGHUP) returns something like "Hangup"). */
67 extern const char *strsignal PARAMS ((int));
69 /* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
72 extern const char *strsigno PARAMS ((int));
74 /* Given the name of a signal, return its number. */
76 extern int strtosigno PARAMS ((const char *));
78 /* Register a function to be run by xexit. Returns 0 on success. */
80 extern int xatexit PARAMS ((void (*fn) (void)));
82 /* Exit, calling all the functions registered with xatexit. */
85 extern void xexit PARAMS ((int status));
87 typedef void libiberty_voidfn PARAMS ((int status));
88 volatile libiberty_voidfn xexit;
91 /* Set the program name used by xmalloc. */
93 extern void xmalloc_set_program_name PARAMS ((const char *));
95 /* Allocate memory without fail. If malloc fails, this will print a
96 message to stderr (using the name set by xmalloc_set_program_name,
97 if any) and then call xexit.
99 FIXME: We do not declare the parameter type (size_t) in order to
100 avoid conflicts with other declarations of xmalloc that exist in
101 programs which use libiberty. */
103 extern PTR xmalloc ();
105 /* Reallocate memory without fail. This works like xmalloc.
107 FIXME: We do not declare the parameter types for the same reason as
110 extern PTR xrealloc ();
112 #endif /* ! defined (LIBIBERTY_H) */