Initial revision
[binutils.git] / binutils / bucomm.h
blob36e6a7959e6b3d0d606fcbbf1df393465d75bd40
1 /* bucomm.h -- binutils common include file.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
3 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 #ifdef USE_BINARY_FOPEN
31 #include "fopen-bin.h"
32 #else
33 #include "fopen-same.h"
34 #endif
36 #include <errno.h>
37 #ifndef errno
38 extern int errno;
39 #endif
41 #ifdef HAVE_UNISTD_H
42 #include <unistd.h>
43 #endif
45 #ifdef HAVE_STRING_H
46 #include <string.h>
47 #else
48 #ifdef HAVE_STRINGS_H
49 #include <strings.h>
50 #else
51 extern char *strchr ();
52 extern char *strrchr ();
53 #endif
54 #endif
56 #ifdef HAVE_STDLIB_H
57 #include <stdlib.h>
58 #endif
60 #ifdef HAVE_FCNTL_H
61 #include <fcntl.h>
62 #else
63 #ifdef HAVE_SYS_FILE_H
64 #include <sys/file.h>
65 #endif
66 #endif
68 #ifdef NEED_DECLARATION_STRSTR
69 extern char *strstr ();
70 #endif
72 #ifdef HAVE_SBRK
73 #ifdef NEED_DECLARATION_SBRK
74 extern char *sbrk ();
75 #endif
76 #endif
78 #ifdef NEED_DECLARATION_GETENV
79 extern char *getenv ();
80 #endif
82 #ifdef NEED_DECLARATION_ENVIRON
83 extern char **environ;
84 #endif
86 #ifndef O_RDONLY
87 #define O_RDONLY 0
88 #endif
90 #ifndef O_RDWR
91 #define O_RDWR 2
92 #endif
94 #ifndef SEEK_SET
95 #define SEEK_SET 0
96 #endif
97 #ifndef SEEK_CUR
98 #define SEEK_CUR 1
99 #endif
100 #ifndef SEEK_END
101 #define SEEK_END 2
102 #endif
104 #if defined(__GNUC__) && !defined(C_ALLOCA)
105 # undef alloca
106 # define alloca __builtin_alloca
107 #else
108 # if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
109 # include <alloca.h>
110 # else
111 # ifndef alloca /* predefined by HP cc +Olibcalls */
112 # if !defined (__STDC__) && !defined (__hpux)
113 char *alloca ();
114 # else
115 void *alloca ();
116 # endif /* __STDC__, __hpux */
117 # endif /* alloca */
118 # endif /* HAVE_ALLOCA_H */
119 #endif
121 #ifdef HAVE_LOCALE_H
122 # include <locale.h>
123 #endif
125 #ifdef ENABLE_NLS
126 # include <libintl.h>
127 # define _(String) gettext (String)
128 # ifdef gettext_noop
129 # define N_(String) gettext_noop (String)
130 # else
131 # define N_(String) (String)
132 # endif
133 #else
134 /* Stubs that do something close enough. */
135 # define textdomain(String) (String)
136 # define gettext(String) (String)
137 # define dgettext(Domain,Message) (Message)
138 # define dcgettext(Domain,Message,Type) (Message)
139 # define bindtextdomain(Domain,Directory) (Domain)
140 # define _(String) (String)
141 # define N_(String) (String)
142 #endif
144 /* bucomm.c */
145 void bfd_nonfatal PARAMS ((CONST char *));
147 void bfd_fatal PARAMS ((CONST char *));
149 void fatal PARAMS ((CONST char *, ...));
151 void non_fatal PARAMS ((CONST char *, ...));
153 void set_default_bfd_target PARAMS ((void));
155 void list_matching_formats PARAMS ((char **p));
157 void list_supported_targets PARAMS ((const char *, FILE *));
159 void print_arelt_descr PARAMS ((FILE *file, bfd *abfd, boolean verbose));
161 char *make_tempname PARAMS ((char *));
163 bfd_vma parse_vma PARAMS ((const char *, const char *));
165 extern char *program_name;
167 /* filemode.c */
168 void mode_string PARAMS ((unsigned long mode, char *buf));
170 /* version.c */
171 extern void print_version PARAMS ((const char *));
173 /* rename.c */
174 extern void set_times PARAMS ((const char *, const struct stat *));
176 extern int smart_rename PARAMS ((const char *, const char *, int));
178 /* libiberty */
179 PTR xmalloc PARAMS ((size_t));
181 PTR xrealloc PARAMS ((PTR, size_t));
183 #endif /* _BUCOMM_H */