Subversion Repositories Kolibri OS

Rev

Rev 5191 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5191 Rev 6324
Line 1... Line 1...
1
/* Function declarations for libiberty.
1
/* Function declarations for libiberty.
Line 2... Line -...
2
 
-
 
3
   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2
 
Line 4... Line 3...
4
   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
3
   Copyright (C) 1997-2015 Free Software Foundation, Inc.
5
   
4
 
6
   Note - certain prototypes declared in this header file are for
5
   Note - certain prototypes declared in this header file are for
7
   functions whoes implementation copyright does not belong to the
6
   functions whoes implementation copyright does not belong to the
Line 44... Line 43...
44
 
43
 
45
/* Get a definition for size_t.  */
44
/* Get a definition for size_t.  */
46
#include 
45
#include 
47
/* Get a definition for va_list.  */
46
/* Get a definition for va_list.  */
-
 
47
#include 
Line 48... Line 48...
48
#include 
48
#include 
Line 49... Line 49...
49
 
49
 
50
#include 
50
#include 
Line 83... Line 83...
83
 
83
 
Line 84... Line 84...
84
extern char **dupargv (char **) ATTRIBUTE_MALLOC;
84
extern char **dupargv (char **) ATTRIBUTE_MALLOC;
Line 85... Line 85...
85
 
85
 
Line 86... Line 86...
86
/* Expand "@file" arguments in argv.  */
86
/* Expand "@file" arguments in argv.  */
Line 87... Line 87...
87
 
87
 
Line 88... Line 88...
88
extern void expandargv PARAMS ((int *, char ***));
88
extern void expandargv (int *, char ***);
Line 89... Line 89...
89
 
89
 
Line 103... Line 103...
103
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
103
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
104
   undefined, we haven't run the autoconf check so provide the
104
   undefined, we haven't run the autoconf check so provide the
105
   declaration without arguments.  If it is 0, we checked and failed
105
   declaration without arguments.  If it is 0, we checked and failed
106
   to find the declaration so provide a fully prototyped one.  If it
106
   to find the declaration so provide a fully prototyped one.  If it
107
   is 1, we found it so don't provide any declaration at all.  */
107
   is 1, we found it so don't provide any declaration at all.  */
-
 
108
 
108
#if !HAVE_DECL_BASENAME
109
#if !HAVE_DECL_BASENAME
-
 
110
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
-
 
111
 || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
109
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
112
 || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
-
 
113
 || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
110
extern char *basename (const char *);
114
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
111
#else
115
#else
112
/* Do not allow basename to be used if there is no prototype seen.  We
116
/* Do not allow basename to be used if there is no prototype seen.  We
113
   either need to use the above prototype or have one from
117
   either need to use the above prototype or have one from
114
   autoconf which would result in HAVE_DECL_BASENAME being set.  */
118
   autoconf which would result in HAVE_DECL_BASENAME being set.  */
115
#define basename basename_cannot_be_used_without_a_prototype
119
#define basename basename_cannot_be_used_without_a_prototype
116
#endif
120
#endif
117
#endif
121
#endif
Line 118... Line 122...
118
 
122
 
Line 119... Line 123...
119
/* A well-defined basename () that is always compiled in.  */
123
/* A well-defined basename () that is always compiled in.  */
Line 120... Line 124...
120
 
124
 
121
extern const char *lbasename (const char *);
125
extern const char *lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
Line 122... Line 126...
122
 
126
 
Line 123... Line 127...
123
/* Same, but assumes DOS semantics (drive name, backslash is also a
127
/* Same, but assumes DOS semantics (drive name, backslash is also a
124
   dir separator) regardless of host.  */
128
   dir separator) regardless of host.  */
125
 
129
 
Line 126... Line 130...
126
extern const char *dos_lbasename (const char *);
130
extern const char *dos_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
Line 127... Line 131...
127
 
131
 
Line 128... Line 132...
128
/* Same, but assumes Unix semantics (absolute paths always start with
132
/* Same, but assumes Unix semantics (absolute paths always start with
Line 129... Line 133...
129
   a slash, only forward slash is accepted as dir separator)
133
   a slash, only forward slash is accepted as dir separator)
130
   regardless of host.  */
134
   regardless of host.  */
131
 
135
 
Line 132... Line 136...
132
extern const char *unix_lbasename (const char *);
136
extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
Line 133... Line 137...
133
 
137
 
134
/* A well-defined realpath () that is always compiled in.  */
138
/* A well-defined realpath () that is always compiled in.  */
135
 
139
 
136
extern char *lrealpath (const char *);
140
extern char *lrealpath (const char *);
137
 
141
 
138
/* Concatenate an arbitrary number of strings.  You must pass NULL as
142
/* Concatenate an arbitrary number of strings.  You must pass NULL as
Line 139... Line 143...
139
   the last argument of this function, to terminate the list of
143
   the last argument of this function, to terminate the list of
Line 140... Line 144...
140
   strings.  Allocates memory using xmalloc.  */
144
   strings.  Allocates memory using xmalloc.  */
141
 
145
 
142
extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
146
extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL;
Line 159... Line 163...
159
/* Concatenate an arbitrary number of strings into a SUPPLIED area of
163
/* Concatenate an arbitrary number of strings into a SUPPLIED area of
160
   memory.  You must pass NULL as the last argument of this function,
164
   memory.  You must pass NULL as the last argument of this function,
161
   to terminate the list of strings.  The supplied memory is assumed
165
   to terminate the list of strings.  The supplied memory is assumed
162
   to be large enough.  */
166
   to be large enough.  */
Line 163... Line 167...
163
 
167
 
Line 164... Line 168...
164
extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL;
168
extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
165
 
169
 
166
/* Concatenate an arbitrary number of strings into a GLOBAL area of
170
/* Concatenate an arbitrary number of strings into a GLOBAL area of
167
   memory.  You must pass NULL as the last argument of this function,
171
   memory.  You must pass NULL as the last argument of this function,
Line 168... Line 172...
168
   to terminate the list of strings.  The supplied memory is assumed
172
   to terminate the list of strings.  The supplied memory is assumed
Line 169... Line 173...
169
   to be large enough.  */
173
   to be large enough.  */
Line 170... Line 174...
170
 
174
 
Line 222... Line 226...
222
   return value using malloc.  */
226
   return value using malloc.  */
Line 223... Line 227...
223
 
227
 
224
extern char *make_relative_prefix_ignore_links (const char *, const char *,
228
extern char *make_relative_prefix_ignore_links (const char *, const char *,
Line -... Line 229...
-
 
229
						const char *) ATTRIBUTE_MALLOC;
-
 
230
 
-
 
231
/* Returns a pointer to a directory path suitable for creating temporary
-
 
232
   files in.  */
-
 
233
 
225
						const char *) ATTRIBUTE_MALLOC;
234
extern const char *choose_tmpdir (void) ATTRIBUTE_RETURNS_NONNULL;
Line 226... Line 235...
226
 
235
 
Line 227... Line 236...
227
/* Choose a temporary directory to use for scratch files.  */
236
/* Choose a temporary directory to use for scratch files.  */
Line 228... Line 237...
228
 
237
 
Line 254... Line 263...
254
 
263
 
Line 255... Line 264...
255
extern int strtoerrno (const char *);
264
extern int strtoerrno (const char *);
Line 256... Line 265...
256
 
265
 
Line 257... Line 266...
257
/* ANSI's strerror(), but more robust.  */
266
/* ANSI's strerror(), but more robust.  */
258
 
267
 
Line 259... Line 268...
259
extern char *xstrerror (int);
268
extern char *xstrerror (int) ATTRIBUTE_RETURNS_NONNULL;
Line 296... Line 305...
296
 
305
 
297
/* Allocate memory without fail.  If malloc fails, this will print a
306
/* Allocate memory without fail.  If malloc fails, this will print a
298
   message to stderr (using the name set by xmalloc_set_program_name,
307
   message to stderr (using the name set by xmalloc_set_program_name,
Line 299... Line 308...
299
   if any) and then call xexit.  */
308
   if any) and then call xexit.  */
Line 300... Line 309...
300
 
309
 
301
extern void *xmalloc (size_t) ATTRIBUTE_MALLOC;
310
extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
302
 
311
 
Line 303... Line 312...
303
/* Reallocate memory without fail.  This works like xmalloc.  Note,
312
/* Reallocate memory without fail.  This works like xmalloc.  Note,
Line 304... Line 313...
304
   realloc type functions are not suitable for attribute malloc since
313
   realloc type functions are not suitable for attribute malloc since
305
   they may return the same address across multiple calls. */
314
   they may return the same address across multiple calls. */
Line 306... Line 315...
306
 
315
 
Line 307... Line 316...
307
extern void *xrealloc (void *, size_t);
316
extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL;
Line 308... Line 317...
308
 
317
 
Line 309... Line 318...
309
/* Allocate memory without fail and set it to zero.  This works like
318
/* Allocate memory without fail and set it to zero.  This works like
Line 310... Line 319...
310
   xmalloc.  */
319
   xmalloc.  */
Line 311... Line 320...
311
 
320
 
Line 312... Line 321...
312
extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC;
321
extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
Line 313... Line 322...
313
 
322
 
314
/* Copy a string into a memory buffer without fail.  */
323
/* Copy a string into a memory buffer without fail.  */
315
 
324
 
Line 397... Line 406...
397
   TEMPBASE	A base name to use for temporary files; may be NULL to
406
   TEMPBASE	A base name to use for temporary files; may be NULL to
398
   		use a random name.
407
   		use a random name.
399
   Returns NULL on error.  */
408
   Returns NULL on error.  */
Line 400... Line 409...
400
 
409
 
401
extern struct pex_obj *pex_init (int flags, const char *pname,
410
extern struct pex_obj *pex_init (int flags, const char *pname,
Line 402... Line 411...
402
				 const char *tempbase);
411
				 const char *tempbase) ATTRIBUTE_RETURNS_NONNULL;
Line 403... Line 412...
403
 
412
 
404
/* Flags for pex_run.  These are bits to be or'ed together.  */
413
/* Flags for pex_run.  These are bits to be or'ed together.  */
Line 440... Line 449...
440
 
449
 
441
/* Capture stderr in binary mode.  This flag is ignored
450
/* Capture stderr in binary mode.  This flag is ignored
442
   on Unix.  */
451
   on Unix.  */
Line -... Line 452...
-
 
452
#define PEX_BINARY_ERROR	0x80
-
 
453
 
-
 
454
/* Append stdout to existing file instead of truncating it.  */
-
 
455
#define PEX_STDOUT_APPEND	0x100
-
 
456
 
Line 443... Line 457...
443
#define PEX_BINARY_ERROR	0x80
457
/* Thes same as PEX_STDOUT_APPEND, but for STDERR.  */
444
 
458
#define PEX_STDERR_APPEND	0x200
445
 
459
 
Line 607... Line 621...
607
 
621
 
Line 608... Line 622...
608
/* Wait for pexecute to finish.  */
622
/* Wait for pexecute to finish.  */
Line 609... Line 623...
609
 
623
 
610
extern int pwait (int, int *, int);
624
extern int pwait (int, int *, int);
611
 
625
 
Line 612... Line 626...
612
#if !HAVE_DECL_ASPRINTF
626
#if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF
613
/* Like sprintf but provides a pointer to malloc'd storage, which must
627
/* Like sprintf but provides a pointer to malloc'd storage, which must
Line -... Line 628...
-
 
628
   be freed by the caller.  */
-
 
629
 
-
 
630
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
-
 
631
#endif
-
 
632
 
614
   be freed by the caller.  */
633
/* Like asprintf but allocates memory without fail. This works like
615
 
634
   xmalloc.  */
616
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
635
 
Line 617... Line 636...
617
#endif
636
extern char *xasprintf (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF_1;
618
 
637
 
Line -... Line 638...
-
 
638
#if !HAVE_DECL_VASPRINTF
-
 
639
/* Like vsprintf but provides a pointer to malloc'd storage, which
-
 
640
   must be freed by the caller.  */
-
 
641
 
-
 
642
extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0);
619
#if !HAVE_DECL_VASPRINTF
643
#endif
620
/* Like vsprintf but provides a pointer to malloc'd storage, which
644
 
621
   must be freed by the caller.  */
645
/* Like vasprintf but allocates memory without fail. This works like
622
 
646
   xmalloc.  */
Line 623... Line 647...
623
extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0);
647
 
624
#endif
648
extern char *xvasprintf (const char *, va_list) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF(1,0);
625
 
649
 
626
#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
650
#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
Line -... Line 651...
-
 
651
/* Like sprintf but prints at most N characters.  */
-
 
652
extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
-
 
653
#endif
-
 
654
 
-
 
655
#if defined(HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
-
 
656
/* Like vsprintf but prints at most N characters.  */
-
 
657
extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0);
-
 
658
#endif
-
 
659
 
-
 
660
#if defined (HAVE_DECL_STRNLEN) && !HAVE_DECL_STRNLEN
-
 
661
extern size_t strnlen (const char *, size_t);
-
 
662
#endif
-
 
663
 
-
 
664
#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
-
 
665
/* Compare version strings.  */
-
 
666
extern int strverscmp (const char *, const char *);
-
 
667
#endif
-
 
668
 
-
 
669
#if defined(HAVE_DECL_STRTOL) && !HAVE_DECL_STRTOL
-
 
670
extern long int strtol (const char *nptr,
-
 
671
                        char **endptr, int base);
-
 
672
#endif
-
 
673
 
-
 
674
#if defined(HAVE_DECL_STRTOUL) && !HAVE_DECL_STRTOUL
-
 
675
extern unsigned long int strtoul (const char *nptr,
-
 
676
                                  char **endptr, int base);
-
 
677
#endif
-
 
678
 
-
 
679
#if defined(HAVE_LONG_LONG) && defined(HAVE_DECL_STRTOLL) && !HAVE_DECL_STRTOLL
-
 
680
__extension__
-
 
681
extern long long int strtoll (const char *nptr,
627
/* Like sprintf but prints at most N characters.  */
682
                              char **endptr, int base);
628
extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
683
#endif
629
#endif
684
 
630
 
685
#if defined(HAVE_LONG_LONG) && defined(HAVE_DECL_STRTOULL) && !HAVE_DECL_STRTOULL