Simple replacement code with hardcoded y/n responses to allow
compilation on systems without rpmatch() such as Cygwin.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
#endif
#include "nls.h"
+#include "rpmatch.h"
#include "blkdev.h"
#include "strutils.h"
#include "common.h"
static int
said_yes(char answer) {
-#ifdef HAVE_RPMATCH
char reply[2];
- int yn;
reply[0] = answer;
reply[1] = 0;
- yn = rpmatch(reply); /* 1: yes, 0: no, -1: ? */
- if (yn >= 0)
- return yn;
-#endif
- return (answer == 'y' || answer == 'Y');
+
+ return (rpmatch(reply) == 1) ? 1 : 0;
}
static void
#include <limits.h>
#include "nls.h"
+#include "rpmatch.h"
#include "blkdev.h"
#include "common.h"
#include "mbsalign.h"
--- /dev/null
+#ifndef UTIL_LINUX_RPMATCH_H
+#define UTIL_LINUX_RPMATCH_H
+
+#ifndef HAVE_RPMATCH
+#define rpmatch(r) \
+ (*r == 'y' || *r == 'Y' ? 1 : *r == 'n' || *r == 'N' ? 0 : -1)
+#endif
+
+#endif /* UTIL_LINUX_RPMATCH_H */