]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - binutils/bucomm.h
top level:
[thirdparty/binutils-gdb.git] / binutils / bucomm.h
1 /* bucomm.h -- binutils common include file.
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
4
5 This file is part of GNU Binutils.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
20 \f
21 #ifndef _BUCOMM_H
22 #define _BUCOMM_H
23
24 #include "ansidecl.h"
25 #include <stdio.h>
26 #include <sys/types.h>
27
28 #include "config.h"
29
30 #include <stdarg.h>
31
32 #ifdef USE_BINARY_FOPEN
33 #include "fopen-bin.h"
34 #else
35 #include "fopen-same.h"
36 #endif
37
38 #include <errno.h>
39 #ifndef errno
40 extern int errno;
41 #endif
42
43 #ifdef HAVE_UNISTD_H
44 #include <unistd.h>
45 #endif
46
47 #ifdef HAVE_STRING_H
48 #include <string.h>
49 #else
50 #ifdef HAVE_STRINGS_H
51 #include <strings.h>
52 #else
53 extern char *strchr ();
54 extern char *strrchr ();
55 #endif
56 #endif
57
58 #ifdef HAVE_STDLIB_H
59 #include <stdlib.h>
60 #endif
61
62 #ifdef HAVE_FCNTL_H
63 #include <fcntl.h>
64 #else
65 #ifdef HAVE_SYS_FILE_H
66 #include <sys/file.h>
67 #endif
68 #endif
69
70 #if !HAVE_DECL_STPCPY
71 extern char *stpcpy (char *, const char *);
72 #endif
73
74 #if !HAVE_DECL_STRSTR
75 extern char *strstr ();
76 #endif
77
78 #ifdef HAVE_SBRK
79 #if !HAVE_DECL_SBRK
80 extern char *sbrk ();
81 #endif
82 #endif
83
84 #if !HAVE_DECL_GETENV
85 extern char *getenv ();
86 #endif
87
88 #if !HAVE_DECL_ENVIRON
89 extern char **environ;
90 #endif
91
92 #if !HAVE_DECL_FPRINTF
93 extern int fprintf (FILE *, const char *, ...);
94 #endif
95
96 #if !HAVE_DECL_SNPRINTF
97 extern int snprintf(char *, size_t, const char *, ...);
98 #endif
99
100 #if !HAVE_DECL_VSNPRINTF
101 extern int vsnprintf(char *, size_t, const char *, va_list);
102 #endif
103
104 #ifndef O_RDONLY
105 #define O_RDONLY 0
106 #endif
107
108 #ifndef O_RDWR
109 #define O_RDWR 2
110 #endif
111
112 #ifndef SEEK_SET
113 #define SEEK_SET 0
114 #endif
115 #ifndef SEEK_CUR
116 #define SEEK_CUR 1
117 #endif
118 #ifndef SEEK_END
119 #define SEEK_END 2
120 #endif
121
122 #if defined(__GNUC__) && !defined(C_ALLOCA)
123 # undef alloca
124 # define alloca __builtin_alloca
125 #else
126 # if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
127 # include <alloca.h>
128 # else
129 # ifndef alloca /* predefined by HP cc +Olibcalls */
130 # if !defined (__STDC__) && !defined (__hpux)
131 char *alloca ();
132 # else
133 void *alloca ();
134 # endif /* __STDC__, __hpux */
135 # endif /* alloca */
136 # endif /* HAVE_ALLOCA_H */
137 #endif
138
139
140 #ifdef HAVE_LOCALE_H
141 # ifndef ENABLE_NLS
142 /* The Solaris version of locale.h always includes libintl.h. If we have
143 been configured with --disable-nls then ENABLE_NLS will not be defined
144 and the dummy definitions of bindtextdomain (et al) below will conflict
145 with the defintions in libintl.h. So we define these values to prevent
146 the bogus inclusion of libintl.h. */
147 # define _LIBINTL_H
148 # define _LIBGETTEXT_H
149 # endif
150 # include <locale.h>
151 #endif
152
153 #ifdef ENABLE_NLS
154 # include <libintl.h>
155 # define _(String) gettext (String)
156 # ifdef gettext_noop
157 # define N_(String) gettext_noop (String)
158 # else
159 # define N_(String) (String)
160 # endif
161 #else
162 # define gettext(Msgid) (Msgid)
163 # define dgettext(Domainname, Msgid) (Msgid)
164 # define dcgettext(Domainname, Msgid, Category) (Msgid)
165 # define textdomain(Domainname) while (0) /* nothing */
166 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
167 # define _(String) (String)
168 # define N_(String) (String)
169 #endif
170
171 /* Used by ar.c and objcopy.c. */
172 #define BUFSIZE 8192
173
174 /* bucomm.c */
175
176 /* Return the filename in a static buffer. */
177 const char *bfd_get_archive_filename (bfd *);
178
179 void bfd_nonfatal (const char *);
180
181 void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
182
183 void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
184
185 void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
186
187 void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1;
188
189 void set_default_bfd_target (void);
190
191 void list_matching_formats (char **);
192
193 void list_supported_targets (const char *, FILE *);
194
195 void list_supported_architectures (const char *, FILE *);
196
197 int display_info (void);
198
199 void print_arelt_descr (FILE *, bfd *, bfd_boolean);
200
201 char *make_tempname (char *);
202 char *make_tempdir (char *);
203
204 bfd_vma parse_vma (const char *, const char *);
205
206 off_t get_file_size (const char *);
207
208 extern char *program_name;
209
210 /* filemode.c */
211 void mode_string (unsigned long, char *);
212
213 /* version.c */
214 extern void print_version (const char *);
215
216 /* rename.c */
217 extern void set_times (const char *, const struct stat *);
218
219 extern int smart_rename (const char *, const char *, int);
220
221 /* libiberty. */
222 void *xmalloc (size_t);
223
224 void *xrealloc (void *, size_t);
225
226 #endif /* _BUCOMM_H */