]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - binutils/bucomm.h
top level:
[thirdparty/binutils-gdb.git] / binutils / bucomm.h
CommitLineData
252b5132 1/* bucomm.h -- binutils common include file.
b34976b6 2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
92f01d61 3 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
252b5132 4
06d86cf7 5 This file is part of GNU Binutils.
252b5132 6
06d86cf7
NC
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.
252b5132 11
06d86cf7
NC
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.
252b5132 16
06d86cf7
NC
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
b43b5d5f 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
252b5132
RH
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
37cc8ec1 30#include <stdarg.h>
37cc8ec1 31
252b5132
RH
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
40extern 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
53extern char *strchr ();
54extern 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
3e321448
L
70#if !HAVE_DECL_STPCPY
71extern char *stpcpy (char *, const char *);
72#endif
73
398ee8f1 74#if !HAVE_DECL_STRSTR
252b5132
RH
75extern char *strstr ();
76#endif
77
78#ifdef HAVE_SBRK
398ee8f1 79#if !HAVE_DECL_SBRK
252b5132
RH
80extern char *sbrk ();
81#endif
82#endif
83
398ee8f1 84#if !HAVE_DECL_GETENV
252b5132
RH
85extern char *getenv ();
86#endif
87
398ee8f1 88#if !HAVE_DECL_ENVIRON
252b5132
RH
89extern char **environ;
90#endif
91
db50c840
EB
92#if !HAVE_DECL_FPRINTF
93extern int fprintf (FILE *, const char *, ...);
94#endif
95
96#if !HAVE_DECL_SNPRINTF
97extern int snprintf(char *, size_t, const char *, ...);
98#endif
99
100#if !HAVE_DECL_VSNPRINTF
101extern int vsnprintf(char *, size_t, const char *, va_list);
102#endif
103
252b5132
RH
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)
131char *alloca ();
132# else
133void *alloca ();
134# endif /* __STDC__, __hpux */
135# endif /* alloca */
136# endif /* HAVE_ALLOCA_H */
137#endif
138
a70c2403 139
252b5132 140#ifdef HAVE_LOCALE_H
a70c2403
NC
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
252b5132
RH
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
897083bd
AM
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 */
252b5132
RH
167# define _(String) (String)
168# define N_(String) (String)
169#endif
170
77f762d6
L
171/* Used by ar.c and objcopy.c. */
172#define BUFSIZE 8192
173
252b5132 174/* bucomm.c */
77f762d6
L
175
176/* Return the filename in a static buffer. */
177const char *bfd_get_archive_filename (bfd *);
178
2da42df6 179void bfd_nonfatal (const char *);
37cc8ec1 180
2da42df6 181void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
252b5132 182
0fd3a477 183void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
cba12006 184
2da42df6 185void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
252b5132 186
2da42df6 187void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1;
252b5132 188
2da42df6 189void set_default_bfd_target (void);
252b5132 190
2da42df6 191void list_matching_formats (char **);
252b5132 192
2da42df6 193void list_supported_targets (const char *, FILE *);
252b5132 194
2da42df6 195void list_supported_architectures (const char *, FILE *);
2f83960e 196
2da42df6 197int display_info (void);
252b5132 198
2da42df6 199void print_arelt_descr (FILE *, bfd *, bfd_boolean);
252b5132 200
2da42df6 201char *make_tempname (char *);
f9c026a8 202char *make_tempdir (char *);
2da42df6
AJ
203
204bfd_vma parse_vma (const char *, const char *);
252b5132 205
f24ddbdd
NC
206off_t get_file_size (const char *);
207
252b5132
RH
208extern char *program_name;
209
210/* filemode.c */
2da42df6 211void mode_string (unsigned long, char *);
252b5132
RH
212
213/* version.c */
2da42df6 214extern void print_version (const char *);
252b5132
RH
215
216/* rename.c */
2da42df6 217extern void set_times (const char *, const struct stat *);
252b5132 218
2da42df6 219extern int smart_rename (const char *, const char *, int);
252b5132 220
06d86cf7 221/* libiberty. */
2da42df6 222void *xmalloc (size_t);
252b5132 223
2da42df6 224void *xrealloc (void *, size_t);
252b5132
RH
225
226#endif /* _BUCOMM_H */