diff options
author | Awal Garg | 2018-07-28 15:20:35 +0200 |
---|---|---|
committer | Karel Zak | 2018-07-31 14:54:12 +0200 |
commit | 757cefbb61dd22254ae8441f7caed39be7c59483 (patch) | |
tree | 419734d3d5afd00ffc9f8ebc6bdca2d2796783d6 /libfdisk/src/ask.c | |
parent | hwclock: remove ntpd from man page (diff) | |
download | kernel-qcow2-util-linux-757cefbb61dd22254ae8441f7caed39be7c59483.tar.gz kernel-qcow2-util-linux-757cefbb61dd22254ae8441f7caed39be7c59483.tar.xz kernel-qcow2-util-linux-757cefbb61dd22254ae8441f7caed39be7c59483.zip |
libfdisk: Accept negative numbers for last sector input
[kzak@redhat.com: - add note to the man page
- add '-' to the dialog query
- cleanup functions names and libfdisk.sym]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/ask.c')
-rw-r--r-- | libfdisk/src/ask.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libfdisk/src/ask.c b/libfdisk/src/ask.c index babe040ad..9fabc99c8 100644 --- a/libfdisk/src/ask.c +++ b/libfdisk/src/ask.c @@ -320,6 +320,24 @@ int fdisk_ask_number_is_relative(struct fdisk_ask *ask) } /** + * fdisk_ask_number_is_wrap_negative: + * @ask: ask instance + * + * The wrap-negative flag allows to accept negative number from user. In this + * case the dialog result is calculated as "high - num" (-N from high limit). + * + * Returns: 1 or 0. + * + * Since: 2.33 + */ +int fdisk_ask_number_is_wrap_negative(struct fdisk_ask *ask) +{ + assert(ask); + assert(is_number_ask(ask)); + return ask->data.num.wrap_negative; +} + +/** * fdisk_ask_number_set_relative * @ask: ask instance * @relative: 0 or 1 @@ -354,6 +372,13 @@ int fdisk_ask_number_inchars(struct fdisk_ask *ask) return ask->data.num.inchars; } +int fdisk_ask_number_set_wrap_negative(struct fdisk_ask *ask, int wrap_negative) +{ + assert(ask); + ask->data.num.wrap_negative = wrap_negative ? 1 : 0; + return 0; +} + /* * Generates string with list ranges (e.g. 1,2,5-8) for the 'cur' */ |