From 2b71181a37f679f42746a3b89777dfd837942ff8 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Fri, 19 Jan 2018 01:03:38 -0500 Subject: [PATCH] r657: check -p (#96) Well, in principle, every option should be checked. Will do when someone raise issues... --- main.c | 2 +- map.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 0292207..6ce6f9e 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "getopt.h" -#define MM_VERSION "2.7-r655-dirty" +#define MM_VERSION "2.7-r657-dirty" #ifdef __linux__ #include diff --git a/map.c b/map.c index 054cd91..eac2600 100644 --- a/map.c +++ b/map.c @@ -117,6 +117,11 @@ int mm_set_opt(const char *preset, mm_idxopt_t *io, mm_mapopt_t *mo) int mm_check_opt(const mm_idxopt_t *io, const mm_mapopt_t *mo) { + if (mo->pri_ratio < 0.0f || mo->pri_ratio > 1.0f) { + if (mm_verbose >= 1) + fprintf(stderr, "[ERROR]\033[1;31m -p must be within 0 and 1 (including 0 and 1)\033[0m\n"); + return -4; + } if ((mo->flag & MM_F_FOR_ONLY) && (mo->flag & MM_F_REV_ONLY)) { if (mm_verbose >= 1) fprintf(stderr, "[ERROR]\033[1;31m --for-only and --rev-only can't be applied at the same time\033[0m\n");