diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-01-23 18:35:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-01-23 18:35:07 +0000 |
commit | 123bfaa5ecbad5fab13797b62d6cf5207e81ab80 (patch) | |
tree | c81a9f44efd11ce2349e7b2062b8b3cb3439e425 /bfd/opncls.c | |
parent | 0c699ac1674fc104db57fe47357121e23c7ca86c (diff) | |
download | gdb-123bfaa5ecbad5fab13797b62d6cf5207e81ab80.zip gdb-123bfaa5ecbad5fab13797b62d6cf5207e81ab80.tar.gz gdb-123bfaa5ecbad5fab13797b62d6cf5207e81ab80.tar.bz2 |
* opncls.c (bfd_openstreamr): Call bfd_cache_init.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r-- | bfd/opncls.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c index 977cd99..b28d6b0 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -254,6 +254,52 @@ bfd_fdopenr (filename, target, fd) return nbfd; } + +/* +FUNCTION + bfd_openstreamr + +SYNOPSIS + bfd *bfd_openstreamr(); + +DESCRIPTION + + Open a BFD for read access on an existing stdio stream. When + the BFD is passed to <<bfd_close>>, the stream will be closed. +*/ + +bfd * +bfd_openstreamr (filename, target, stream) + const char *filename; + const char *target; + FILE *stream; +{ + bfd *nbfd; + const bfd_target *target_vec; + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + target_vec = bfd_find_target (target, nbfd); + if (target_vec == NULL) + { + bfd_set_error (bfd_error_invalid_target); + return NULL; + } + + nbfd->iostream = (char *) stream; + nbfd->filename = filename; + nbfd->direction = read_direction; + + if (! bfd_cache_init (nbfd)) + return NULL; + + return nbfd; +} /** bfd_openw -- open for writing. Returns a pointer to a freshly-allocated BFD on success, or NULL. |