fprintf(stderr,"bad usage: %s\n"
"usage: parport-ctl <&parport ioctl"
- " [input-type [input-args ...] [output-type]]\n"
+ " [output-type [input-type [input-args ...]]]\n"
"ioctls:", what);
for (ioi= ioctlinfos; ioi->name; ioi++) {
fputc(' ',stderr);
parm.fs.mask= pa_uc(argv);
parm.fs.val= pa_uc(argv);
}
-static void parse_get(const char *const **argv) { }
static void parse_mode(const char *const **argv) {
const char *arg= pa_1arg(argv);
const struct numvalinfo *mi;
}
static void print_none(void) { }
+static void print_set(void) { }
static void print_int(void) { printf("%d\n",parm.i); }
static void print_uc(void) { printf("0x%02x\n",parm.uc); }
static void print_hex(void) {
T(uc)
T(mode)
TI(ppdfs)
- TI(get)
+ TO(set)
TO(hex)
TO(dump)
{ 0 }
if (arg[0] == '-') badusage("no options supported");
FIND(ioi, ioctlinfos, "ioctl name");
- memset(&parm,0,sizeof(parm));
- if ((arg= *argv)) {
- argv++;
- FINDT(iti, "input to ioctl", parse);
- iti->parse(&argv);
- }
if ((arg= *argv)) {
argv++;
FINDT(oti, "type for output from ioctl", print);
} else {
oti= 0;
}
+ memset(&parm,0,sizeof(parm));
+ if ((arg= *argv)) {
+ argv++;
+ FINDT(iti, "input to ioctl", parse);
+ iti->parse(&argv);
+ }
if (*argv) badusage("too many args");
r= ioctl(0, ioi->num, &parm);