if (rc)
break;
x = rpmatch(buf);
- if (x == 1 || x == 0) {
+ if (x == RPMATCH_YES || x == RPMATCH_NO) {
fdisk_ask_yesno_set_result(ask, x);
break;
}
ignore_result( fgets(input, YESNO_LENGTH, stdin) );
resp = rpmatch(input);
switch (resp) {
- case -1:
+ case RPMATCH_INVALID:
/* def = def */
break;
- case 0:
- case 1:
+ case RPMATCH_NO:
+ case RPMATCH_YES:
def = resp;
break;
default:
if (rc)
break;
x = rpmatch(buf);
- if (x == 1 || x == 0) {
+ if (x == RPMATCH_YES || x == RPMATCH_NO) {
fdisk_ask_yesno_set_result(ask, x);
break;
}
(*r == 'y' || *r == 'Y' ? 1 : *r == 'n' || *r == 'N' ? 0 : -1)
#endif
+#define RPMATCH_YES 1
+#define RPMATCH_NO 0
+#define RPMATCH_INVALID -1
+
#endif /* UTIL_LINUX_RPMATCH_H */
printf(_("Would you like to edit %s now [y/n]? "), orig_file);
if (fgets(response, sizeof(response), stdin)) {
- if (rpmatch(response) == 1)
+ if (rpmatch(response) == RPMATCH_YES)
edit_file(1);
}
}
}
switch (rpmatch(argv[0])) {
- case 1:
+ case RPMATCH_YES:
#ifdef USE_TTY_GROUP
if (chmod(tty, sb.st_mode | S_IWGRP) < 0)
#else
if (verbose)
puts(_("write access to your terminal is allowed"));
return IS_ALLOWED;
- case 0:
+ case RPMATCH_NO:
if (chmod(tty, sb.st_mode & ~(S_IWGRP|S_IWOTH)) < 0)
err(MESG_EXIT_FAILURE, _("change %s mode failed"), tty);
if (verbose)
puts(_("write access to your terminal is denied"));
return IS_NOT_ALLOWED;
- case -1:
+ case RPMATCH_INVALID:
warnx(_("invalid argument: %s"), argv[0]);
usage(stderr);
default: