* m32r.opc: Formatting.
[binutils.git] / binutils / bucomm.h
blob0be6ac036565f2667dd3f9d259b7edf25bbebed6
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.
5 This file is part of GNU Binutils.
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.
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.
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. */
21 #ifndef _BUCOMM_H
22 #define _BUCOMM_H
24 #include "ansidecl.h"
25 #include <stdio.h>
26 #include <sys/types.h>
28 #include "config.h"
30 #include <stdarg.h>
32 #ifdef USE_BINARY_FOPEN
33 #include "fopen-bin.h"
34 #else
35 #include "fopen-same.h"
36 #endif
38 #include <errno.h>
39 #ifndef errno
40 extern int errno;
41 #endif
43 #ifdef HAVE_UNISTD_H
44 #include <unistd.h>
45 #endif
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
58 #ifdef HAVE_STDLIB_H
59 #include <stdlib.h>
60 #endif
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
70 #if !HAVE_DECL_STPCPY
71 extern char *stpcpy (char *, const char *);
72 #endif
74 #if !HAVE_DECL_STRSTR
75 extern char *strstr ();
76 #endif
78 #ifdef HAVE_SBRK
79 #if !HAVE_DECL_SBRK
80 extern char *sbrk ();
81 #endif
82 #endif
84 #if !HAVE_DECL_GETENV
85 extern char *getenv ();
86 #endif
88 #if !HAVE_DECL_ENVIRON
89 extern char **environ;
90 #endif
92 #if !HAVE_DECL_FPRINTF
93 extern int fprintf (FILE *, const char *, ...);
94 #endif
96 #if !HAVE_DECL_SNPRINTF
97 extern int snprintf(char *, size_t, const char *, ...);
98 #endif
100 #if !HAVE_DECL_VSNPRINTF
101 extern int vsnprintf(char *, size_t, const char *, va_list);
102 #endif
104 #ifndef O_RDONLY
105 #define O_RDONLY 0
106 #endif
108 #ifndef O_RDWR
109 #define O_RDWR 2
110 #endif
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
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
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
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
171 /* Used by ar.c and objcopy.c. */
172 #define BUFSIZE 8192
174 /* bucomm.c */
176 /* Return the filename in a static buffer. */
177 const char *bfd_get_archive_filename (bfd *);
179 void bfd_nonfatal (const char *);
181 void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
183 void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
185 void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
187 void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1;
189 void set_default_bfd_target (void);
191 void list_matching_formats (char **);
193 void list_supported_targets (const char *, FILE *);
195 void list_supported_architectures (const char *, FILE *);
197 int display_info (void);
199 void print_arelt_descr (FILE *, bfd *, bfd_boolean);
201 char *make_tempname (char *);
202 char *make_tempdir (char *);
204 bfd_vma parse_vma (const char *, const char *);
206 off_t get_file_size (const char *);
208 extern char *program_name;
210 /* filemode.c */
211 void mode_string (unsigned long, char *);
213 /* version.c */
214 extern void print_version (const char *);
216 /* rename.c */
217 extern void set_times (const char *, const struct stat *);
219 extern int smart_rename (const char *, const char *, int);
221 /* libiberty. */
222 void *xmalloc (size_t);
224 void *xrealloc (void *, size_t);
226 #endif /* _BUCOMM_H */