diff options
author | dufault <dufault@FreeBSD.org> | 1995-04-17 14:35:07 +0000 |
---|---|---|
committer | dufault <dufault@FreeBSD.org> | 1995-04-17 14:35:07 +0000 |
commit | 040c6848605589d63d0b340e53d522a5e992bfb8 (patch) | |
tree | 0a5b61291c2c43551b4d5893fcef77cfad56efda | |
parent | d147c76902c8bc6ad7d19774fef1d82a96a57e03 (diff) | |
download | FreeBSD-src-040c6848605589d63d0b340e53d522a5e992bfb8.zip FreeBSD-src-040c6848605589d63d0b340e53d522a5e992bfb8.tar.gz |
Add support for arguments in output "-o" string.
-rw-r--r-- | sbin/scsi/scsi.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/sbin/scsi/scsi.c b/sbin/scsi/scsi.c index 7837cac..07807a1 100644 --- a/sbin/scsi/scsi.c +++ b/sbin/scsi/scsi.c @@ -39,7 +39,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi.c,v 1.1.1.1 1995/01/24 12:07:27 dufault Exp $ + * $Id: scsi.c,v 1.2 1995/01/26 23:40:40 dufault Exp $ */ #include <stdio.h> @@ -166,6 +166,9 @@ int iget(void *hook, char *name) arg = atol(h->argv[h->got]); h->got++; + if (verbose && name) + printf("%s: %d\n", name, arg); + return arg; } @@ -184,6 +187,9 @@ char *cget(void *hook, char *name) arg = h->argv[h->got]; h->got++; + if (verbose && name) + printf("cget: %s: %s", name, arg); + return arg; } @@ -228,6 +234,12 @@ void arg_put(void *hook, int letter, void *arg, int count, char *name) putchar('\n'); } +int arg_get (void *hook, char *field_name) +{ + printf("get \"%s\".\n", field_name); + return 0; +} + /* data_phase: SCSI bus data phase: DATA IN, DATA OUT, or no data transfer. */ enum data_phase {none = 0, in, out}; @@ -240,6 +252,7 @@ void do_cmd(int fd, char *fmt, int argc, char **argv) scsireq_t *scsireq = scsireq_new(); enum data_phase data_phase; int output = 0; + char *data_out = 0; h.argc = argc; h.argv = argv; @@ -296,7 +309,7 @@ void do_cmd(int fd, char *fmt, int argc, char **argv) if (data_phase == out) { - if (strcmp(data_fmt, "-") == 0) /* stdin */ + if (strcmp(data_fmt, "-") == 0) /* Read data from stdin */ { if (read(0, scsireq->databuf, count) != count) { @@ -306,9 +319,16 @@ void do_cmd(int fd, char *fmt, int argc, char **argv) } else /* XXX: Not written yet */ { - fprintf(stderr, "Can't set up output data using %s.\n", - data_fmt); - exit(-1); +#if 0 + int scsireq_encode_visit(scsireq_t *scsireq, char + *fmt, + int (*arg_get)(void *hook, char *field_name), + void *gethook) +#endif + + bzero(scsireq->databuf, count); + + scsireq_encode_visit(scsireq, data_fmt, iget, (void *)&h); } } @@ -318,6 +338,9 @@ void do_cmd(int fd, char *fmt, int argc, char **argv) exit(errno); } + if (SCSIREQ_ERROR(scsireq)) + scsi_debug(stderr, 0, scsireq); + if (data_phase == in) { if (strcmp(data_fmt, "-") == 0) /* stdout */ |