Back to index

cell-binutils  2.17cvs20070401
bucomm.h
Go to the documentation of this file.
00001 /* bucomm.h -- binutils common include file.
00002    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
00003    2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
00004 
00005    This file is part of GNU Binutils.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #ifndef _BUCOMM_H
00022 #define _BUCOMM_H
00023 
00024 #include "ansidecl.h"
00025 #include <stdio.h>
00026 #include <sys/types.h>
00027 
00028 #include "bfdver.h"
00029 #include "config.h"
00030 
00031 #include <stdarg.h>
00032 
00033 #ifdef USE_BINARY_FOPEN
00034 #include "fopen-bin.h"
00035 #else
00036 #include "fopen-same.h"
00037 #endif
00038 
00039 #include <errno.h>
00040 #ifndef errno
00041 extern int errno;
00042 #endif
00043 
00044 #ifdef HAVE_UNISTD_H
00045 #include <unistd.h>
00046 #endif
00047 
00048 #ifdef HAVE_STRING_H
00049 #include <string.h>
00050 #else
00051 #ifdef HAVE_STRINGS_H
00052 #include <strings.h>
00053 #else
00054 extern char *strchr ();
00055 extern char *strrchr ();
00056 #endif
00057 #endif
00058 
00059 #ifdef HAVE_STDLIB_H
00060 #include <stdlib.h>
00061 #endif
00062 
00063 #ifdef HAVE_FCNTL_H
00064 #include <fcntl.h>
00065 #else
00066 #ifdef HAVE_SYS_FILE_H
00067 #include <sys/file.h>
00068 #endif
00069 #endif
00070 
00071 #if !HAVE_DECL_STPCPY
00072 extern char *stpcpy (char *, const char *);
00073 #endif
00074 
00075 #if !HAVE_DECL_STRSTR
00076 extern char *strstr ();
00077 #endif
00078 
00079 #ifdef HAVE_SBRK
00080 #if !HAVE_DECL_SBRK
00081 extern char *sbrk ();
00082 #endif
00083 #endif
00084 
00085 #if !HAVE_DECL_GETENV
00086 extern char *getenv ();
00087 #endif
00088 
00089 #if !HAVE_DECL_ENVIRON
00090 extern char **environ;
00091 #endif
00092 
00093 #if !HAVE_DECL_FPRINTF
00094 extern int fprintf (FILE *, const char *, ...);
00095 #endif
00096 
00097 #if !HAVE_DECL_SNPRINTF
00098 extern int snprintf(char *, size_t, const char *, ...);
00099 #endif
00100 
00101 #if !HAVE_DECL_VSNPRINTF
00102 extern int vsnprintf(char *, size_t, const char *, va_list);
00103 #endif
00104 
00105 #ifndef O_RDONLY
00106 #define O_RDONLY 0
00107 #endif
00108 
00109 #ifndef O_RDWR
00110 #define O_RDWR 2
00111 #endif
00112 
00113 #ifndef SEEK_SET
00114 #define SEEK_SET 0
00115 #endif
00116 #ifndef SEEK_CUR
00117 #define SEEK_CUR 1
00118 #endif
00119 #ifndef SEEK_END
00120 #define SEEK_END 2
00121 #endif
00122 
00123 #if defined(__GNUC__) && !defined(C_ALLOCA)
00124 # undef alloca
00125 # define alloca __builtin_alloca
00126 #else
00127 # if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
00128 #  include <alloca.h>
00129 # else
00130 #  ifndef alloca /* predefined by HP cc +Olibcalls */
00131 #   if !defined (__STDC__) && !defined (__hpux)
00132 char *alloca ();
00133 #   else
00134 void *alloca ();
00135 #   endif /* __STDC__, __hpux */
00136 #  endif /* alloca */
00137 # endif /* HAVE_ALLOCA_H */
00138 #endif
00139 
00140 
00141 #ifdef HAVE_LOCALE_H
00142 # ifndef ENABLE_NLS
00143    /* The Solaris version of locale.h always includes libintl.h.  If we have
00144       been configured with --disable-nls then ENABLE_NLS will not be defined
00145       and the dummy definitions of bindtextdomain (et al) below will conflict
00146       with the defintions in libintl.h.  So we define these values to prevent
00147       the bogus inclusion of libintl.h.  */
00148 #  define _LIBINTL_H
00149 #  define _LIBGETTEXT_H
00150 # endif
00151 # include <locale.h>
00152 #endif
00153 
00154 #ifdef ENABLE_NLS
00155 # include <libintl.h>
00156 # define _(String) gettext (String)
00157 # ifdef gettext_noop
00158 #  define N_(String) gettext_noop (String)
00159 # else
00160 #  define N_(String) (String)
00161 # endif
00162 #else
00163 # define gettext(Msgid) (Msgid)
00164 # define dgettext(Domainname, Msgid) (Msgid)
00165 # define dcgettext(Domainname, Msgid, Category) (Msgid)
00166 # define textdomain(Domainname) while (0) /* nothing */
00167 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
00168 # define _(String) (String)
00169 # define N_(String) (String)
00170 #endif
00171 
00172 /* Used by ar.c and objcopy.c.  */
00173 #define BUFSIZE 8192
00174 
00175 /* bucomm.c */
00176 
00177 /* Return the filename in a static buffer.  */
00178 const char *bfd_get_archive_filename (bfd *);
00179 
00180 void bfd_nonfatal (const char *);
00181 
00182 void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
00183 
00184 void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
00185 
00186 void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
00187 
00188 void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1;
00189 
00190 void set_default_bfd_target (void);
00191 
00192 void list_matching_formats (char **);
00193 
00194 void list_supported_targets (const char *, FILE *);
00195 
00196 void list_supported_architectures (const char *, FILE *);
00197 
00198 int display_info (void);
00199 
00200 void print_arelt_descr (FILE *, bfd *, bfd_boolean);
00201 
00202 char *make_tempname (char *);
00203 char *make_tempdir (char *);
00204 
00205 bfd_vma parse_vma (const char *, const char *);
00206 
00207 off_t get_file_size (const char *);
00208 
00209 extern char *program_name;
00210 
00211 /* filemode.c */
00212 void mode_string (unsigned long, char *);
00213 
00214 /* version.c */
00215 extern void print_version (const char *);
00216 
00217 /* rename.c */
00218 extern void set_times (const char *, const struct stat *);
00219 
00220 extern int smart_rename (const char *, const char *, int);
00221 
00222 /* libiberty.  */
00223 void *xmalloc (size_t);
00224 
00225 void *xrealloc (void *, size_t);
00226 
00227 #endif /* _BUCOMM_H */