summaryrefslogtreecommitdiffstats
path: root/partx
diff options
context:
space:
mode:
authorDavidlohr Bueso2011-10-12 05:18:12 +0200
committerKarel Zak2011-10-12 10:01:26 +0200
commita883c6349c21a0cab209e100d936340c50e087d2 (patch)
tree1833599f15263341faf0e614752d7c30b77ecd77 /partx
parentinclude/loopdev.h: add missing function prototype (diff)
downloadkernel-qcow2-util-linux-a883c6349c21a0cab209e100d936340c50e087d2.tar.gz
kernel-qcow2-util-linux-a883c6349c21a0cab209e100d936340c50e087d2.tar.xz
kernel-qcow2-util-linux-a883c6349c21a0cab209e100d936340c50e087d2.zip
lib,strutils: share parse_range()
This function is currently only being used by partx(8), but it's handy and generic enough that we can use it elsewhere as well. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'partx')
-rw-r--r--partx/partx.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/partx/partx.c b/partx/partx.c
index 3a9da9e90..2631d1fdf 100644
--- a/partx/partx.c
+++ b/partx/partx.c
@@ -558,41 +558,6 @@ done:
return rc;
}
-static int parse_range(const char *str, int *lower, int *upper)
-{
- char *end = NULL;
-
- if (!str)
- return 0;
-
- *upper = *lower = 0;
- errno = 0;
-
- if (*str == ':') { /* <:N> */
- str++;
- *upper = strtol(str, &end, 10);
- if (errno || !end || *end || end == str)
- return -1;
- } else {
- *upper = *lower = strtol(str, &end, 10);
- if (errno || !end || end == str)
- return -1;
-
- if (*end == ':' && !*(end + 1)) /* <M:> */
- *upper = 0;
- else if (*end == '-' || *end == ':') { /* <M:N> <M-N> */
- str = end + 1;
- end = NULL;
- errno = 0;
- *upper = strtol(str, &end, 10);
-
- if (errno || !end || *end || end == str)
- return -1;
- }
- }
- return 0;
-}
-
static blkid_partlist get_partlist(blkid_probe pr,
const char *device, char *type)
{