From d1214fe1e858f03c29ab0eee597e36e45f26ea21 Mon Sep 17 00:00:00 2001 From: dufault Date: Fri, 28 Apr 1995 19:23:51 +0000 Subject: Fix a few problems with the debugging output. Add a new "visit" function. --- lib/libscsi/scsi.c | 13 ++++++++++--- lib/libscsi/scsi.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/libscsi') diff --git a/lib/libscsi/scsi.c b/lib/libscsi/scsi.c index e597bb4..051970a 100644 --- a/lib/libscsi/scsi.c +++ b/lib/libscsi/scsi.c @@ -30,7 +30,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * $Id: scsi.c,v 1.2 1995/01/25 00:33:50 dufault Exp $ + * $Id: scsi.c,v 1.3 1995/01/26 23:48:41 dufault Exp $ */ #include #include @@ -371,6 +371,13 @@ int scsireq_buff_decode(u_char *buff, size_t len, char *fmt, ...) return do_buff_decode(buff, len, 0, 0, fmt, ap); } +int scsireq_buff_decode_visit(u_char *buff, size_t len, char *fmt, +void (*arg_put)(void *, int, void *, int, char *), void *puthook) +{ + va_list ap = (va_list)0; + return do_buff_decode(buff, len, arg_put, puthook, fmt, ap); +} + /* next_field: Return the next field in a command specifier. This * builds up a SCSI command using this trivial grammar: * @@ -860,7 +867,7 @@ void scsi_dump(FILE *f, char *text, u_char *p, int req, int got, int dump_print) fprintf(f, "%s (%d of %d):\n", text, got, req); - if (behave.db_level == 0 && (behave.db_trunc != -1 && got > behave.db_trunc)) + if (behave.db_trunc != -1 && got > behave.db_trunc) { trunc = 1; got = behave.db_trunc; @@ -1063,7 +1070,7 @@ int scsi_debug(FILE *f, int ret, scsireq_t *scsireq) fputc('\n', f); - if (ret == 0 && (scsireq->status || scsireq->retsts)) + if (ret == 0 && (scsireq->status || scsireq->retsts || behave.db_level)) { scsi_retsts_dump(f, scsireq); diff --git a/lib/libscsi/scsi.h b/lib/libscsi/scsi.h index c9aa0f3..4555d7f 100644 --- a/lib/libscsi/scsi.h +++ b/lib/libscsi/scsi.h @@ -52,6 +52,8 @@ scsireq_t *scsireq_reset __P((scsireq_t *)); scsireq_t *scsireq_new __P((void)); int scsireq_buff_decode __P((u_char *, size_t, char *, ...)); +int scsireq_buff_decode_visit __P((u_char *, size_t, char *, +void (*a)(void *, int, void *, int, char *), void *)); int scsireq_decode __P((scsireq_t *, char *, ...)); int scsireq_decode_visit __P((scsireq_t *, char *, -- cgit v1.1