Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/gpt change the "-b blocknr" parameter to accept a "huma...
details: https://anonhg.NetBSD.org/src/rev/a6418f1ff27a
branches: trunk
changeset: 791522:a6418f1ff27a
user: jnemeth <jnemeth%NetBSD.org@localhost>
date: Fri Nov 22 04:21:02 2013 +0000
description:
change the "-b blocknr" parameter to accept a "human number"
diffstat:
sbin/gpt/add.c | 6 +++---
sbin/gpt/label.c | 7 ++++---
sbin/gpt/remove.c | 7 ++++---
3 files changed, 11 insertions(+), 9 deletions(-)
diffs (88 lines):
diff -r a2f3135091c5 -r a6418f1ff27a sbin/gpt/add.c
--- a/sbin/gpt/add.c Fri Nov 22 03:51:06 2013 +0000
+++ b/sbin/gpt/add.c Fri Nov 22 04:21:02 2013 +0000
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.18 2013/11/22 03:50:05 jnemeth Exp $");
+__RCSID("$NetBSD: add.c,v 1.19 2013/11/22 04:21:02 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -212,9 +212,9 @@
case 'b':
if (block > 0)
usage_add();
- block = strtoll(optarg, &p, 10);
- if (*p != 0 || block < 1)
+ if (dehumanize_number(optarg, &human_num) < 0)
usage_add();
+ block = human_num;
break;
case 'i':
if (entry > 0)
diff -r a2f3135091c5 -r a6418f1ff27a sbin/gpt/label.c
--- a/sbin/gpt/label.c Fri Nov 22 03:51:06 2013 +0000
+++ b/sbin/gpt/label.c Fri Nov 22 04:21:02 2013 +0000
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.11 2013/11/22 03:50:05 jnemeth Exp $");
+__RCSID("$NetBSD: label.c,v 1.12 2013/11/22 04:21:02 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -186,6 +186,7 @@
{
char *p;
int ch, fd;
+ int64_t human_num;
/* Get the label options */
while ((ch = getopt(argc, argv, "ab:f:i:l:s:t:")) != -1) {
@@ -198,9 +199,9 @@
case 'b':
if (block > 0)
usage_label();
- block = strtoll(optarg, &p, 10);
- if (*p != 0 || block < 1)
+ if (dehumanize_number(optarg, &human_num) < 0)
usage_label();
+ block = human_num;
break;
case 'f':
if (name != NULL)
diff -r a2f3135091c5 -r a6418f1ff27a sbin/gpt/remove.c
--- a/sbin/gpt/remove.c Fri Nov 22 03:51:06 2013 +0000
+++ b/sbin/gpt/remove.c Fri Nov 22 04:21:02 2013 +0000
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: remove.c,v 1.9 2013/11/22 03:50:05 jnemeth Exp $");
+__RCSID("$NetBSD: remove.c,v 1.10 2013/11/22 04:21:02 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -158,6 +158,7 @@
{
char *p;
int ch, fd;
+ int64_t human_num;
/* Get the remove options */
while ((ch = getopt(argc, argv, "ab:i:s:t:")) != -1) {
@@ -170,9 +171,9 @@
case 'b':
if (block > 0)
usage_remove();
- block = strtoll(optarg, &p, 10);
- if (*p != 0 || block < 1)
+ if (dehumanize_number(optarg, &human_num) < 0)
usage_remove();
+ block = human_num;
break;
case 'i':
if (entry > 0)
Home |
Main Index |
Thread Index |
Old Index