int i;
for (i = 0; i < nmem; i++) {
- if (!strcmp(ts[i].str, pattern)) {
+ if (!strcmp(ts[i].str, pattern))
return ts[i].type;
- }
}
return -1;
int fd, ret;
fd = open(path, O_RDWR);
- if (fd < 0) {
+ if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), path);
- }
switch (op) {
case IOC_PR_REGISTER:
}
close(fd);
- if (ret < 0) {
+ if (ret < 0)
err(EXIT_FAILURE, _("pr ioctl failed"));
- } else if (ret > 0) {
+ if (ret > 0)
errx(EXIT_FAILURE, _("error code 0x%x, for more detailed information see specification of device model."), ret);
- }
return ret;
}
break;
case 'o':
operation = parse_pr_operation(optarg);
- if (operation < 0) {
+ if (operation < 0)
err(EXIT_FAILURE, _("unknown operation"));
- }
break;
case 't':
type = parse_pr_type(optarg);
- if (type < 0) {
+ if (type < 0)
err(EXIT_FAILURE, _("unknown type"));
- }
break;
case 'f':
flag = parse_pr_flag(optarg);
- if (flag < 0) {
+ if (flag < 0)
err(EXIT_FAILURE, _("unknown flag"));
- }
break;
case 'h':
}
}
- if (optind == argc) {
+ if (optind == argc)
errx(EXIT_FAILURE, _("no device specified"));
- }
path = argv[optind++];
if (optind != argc) {