libiberty.h
上传用户:aoeyumen
上传日期:2007-01-06
资源大小:3329k
文件大小:3k
源码类别:

DVD

开发平台:

Unix_Linux

  1. /* Function declarations for libiberty.
  2.    Written by Cygnus Support, 1994.
  3.    The libiberty library provides a number of functions which are
  4.    missing on some operating systems.  We do not declare those here,
  5.    to avoid conflicts with the system header files on operating
  6.    systems that do support those functions.  In this file we only
  7.    declare those functions which are specific to libiberty.  */
  8. #ifndef LIBIBERTY_H
  9. #define LIBIBERTY_H
  10. #include "ansidecl.h"
  11. /* Build an argument vector from a string.  Allocates memory using
  12.    malloc.  Use freeargv to free the vector.  */
  13. extern char **buildargv PARAMS ((char *));
  14. /* Free a vector returned by buildargv.  */
  15. extern void freeargv PARAMS ((char **));
  16. /* Return the last component of a path name.  */
  17. extern char *basename PARAMS ((char *));
  18. /* Concatenate an arbitrary number of strings, up to (char *) NULL.
  19.    Allocates memory using xmalloc.  */
  20. extern char *concat PARAMS ((const char *, ...));
  21. /* Check whether two file descriptors refer to the same file.  */
  22. extern int fdmatch PARAMS ((int fd1, int fd2));
  23. /* Get the amount of time the process has run, in microseconds.  */
  24. extern long get_run_time PARAMS ((void));
  25. /* Allocate memory filled with spaces.  Allocates using malloc.  */
  26. extern const char *spaces PARAMS ((int count));
  27. /* Return the maximum error number for which strerror will return a
  28.    string.  */
  29. extern int errno_max PARAMS ((void));
  30. /* Return the name of an errno value (e.g., strerrno (EINVAL) returns
  31.    "EINVAL").  */
  32. extern const char *strerrno PARAMS ((int));
  33. /* Given the name of an errno value, return the value.  */
  34. extern int strtoerrno PARAMS ((const char *));
  35. /* Return the maximum signal number for which strsignal will return a
  36.    string.  */
  37. extern int signo_max PARAMS ((void));
  38. /* Return a signal message string for a signal number
  39.    (e.g., strsignal (SIGHUP) returns something like "Hangup").  */
  40. /* This is commented out as it can conflict with one in system headers.
  41.    We still document its existence though.  */
  42. /*extern const char *strsignal PARAMS ((int));*/
  43. /* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
  44.    "SIGHUP").  */
  45. extern const char *strsigno PARAMS ((int));
  46. /* Given the name of a signal, return its number.  */
  47. extern int strtosigno PARAMS ((const char *));
  48. /* Register a function to be run by xexit.  Returns 0 on success.  */
  49. extern int xatexit PARAMS ((void (*fn) (void)));
  50. /* Exit, calling all the functions registered with xatexit.  */
  51. #ifndef __GNUC__
  52. extern void xexit PARAMS ((int status));
  53. #else
  54. typedef void libiberty_voidfn PARAMS ((int status));
  55. __volatile__ libiberty_voidfn xexit;
  56. #endif
  57. /* Set the program name used by xmalloc.  */
  58. extern void xmalloc_set_program_name PARAMS ((const char *));
  59. /* Allocate memory without fail.  If malloc fails, this will print a
  60.    message to stderr (using the name set by xmalloc_set_program_name,
  61.    if any) and then call xexit.
  62.    FIXME: We do not declare the parameter type (size_t) in order to
  63.    avoid conflicts with other declarations of xmalloc that exist in
  64.    programs which use libiberty.  */
  65. extern PTR xmalloc ();
  66. /* Reallocate memory without fail.  This works like xmalloc.
  67.    FIXME: We do not declare the parameter types for the same reason as
  68.    xmalloc.  */
  69. extern PTR xrealloc ();
  70. #endif /* ! defined (LIBIBERTY_H) */