aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-01-23 18:35:07 +0000
committerIan Lance Taylor <ian@airs.com>1995-01-23 18:35:07 +0000
commit123bfaa5ecbad5fab13797b62d6cf5207e81ab80 (patch)
treec81a9f44efd11ce2349e7b2062b8b3cb3439e425
parent0c699ac1674fc104db57fe47357121e23c7ca86c (diff)
downloadgdb-123bfaa5ecbad5fab13797b62d6cf5207e81ab80.zip
gdb-123bfaa5ecbad5fab13797b62d6cf5207e81ab80.tar.gz
gdb-123bfaa5ecbad5fab13797b62d6cf5207e81ab80.tar.bz2
* opncls.c (bfd_openstreamr): Call bfd_cache_init.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/opncls.c46
2 files changed, 50 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2eb4f02..ad74cfb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jan 23 13:33:18 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
+
+ * opncls.c (bfd_openstreamr): Call bfd_cache_init.
+
Fri Jan 20 11:44:45 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
* sunos.c (sunos_add_one_symbol): Only set the sunos specific
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.