Fix a few problems with the debugging output. Add a new "visit" function.

This commit is contained in:
dufault 1995-04-28 19:23:51 +00:00
parent cd052cdfd3
commit d1214fe1e8
2 changed files with 12 additions and 3 deletions

View File

@ -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 <stdlib.h>
#include <stdio.h>
@ -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);

View File

@ -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 *,