Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/newfs_msdos newfs_msdos allowed suffixes such as 'k', '...



details:   https://anonhg.NetBSD.org/src/rev/08737ff5e353
branches:  trunk
changeset: 337682:08737ff5e353
user:      abs <abs%NetBSD.org@localhost>
date:      Thu Apr 23 13:27:14 2015 +0000

description:
newfs_msdos allowed suffixes such as 'k', 'm' for some parameters,
but amusingly this did not include Block size, or Sectors per cluster.
Allow for all numeric parameters (If I want to specify the number
of drive heads as '1K', then why not?)

diffstat:

 sbin/newfs_msdos/newfs_msdos.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r e1878738a1bb -r 08737ff5e353 sbin/newfs_msdos/newfs_msdos.c
--- a/sbin/newfs_msdos/newfs_msdos.c    Thu Apr 23 11:32:55 2015 +0000
+++ b/sbin/newfs_msdos/newfs_msdos.c    Thu Apr 23 13:27:14 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: newfs_msdos.c,v 1.42 2013/01/23 15:29:15 christos Exp $        */
+/*     $NetBSD: newfs_msdos.c,v 1.43 2015/04/23 13:27:14 abs Exp $     */
 
 /*
  * Copyright (c) 1998 Robert Nordier
@@ -33,7 +33,7 @@
 static const char rcsid[] =
   "$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $";
 #else
-__RCSID("$NetBSD: newfs_msdos.c,v 1.42 2013/01/23 15:29:15 christos Exp $");
+__RCSID("$NetBSD: newfs_msdos.c,v 1.43 2015/04/23 13:27:14 abs Exp $");
 #endif
 #endif /* not lint */
 
@@ -168,14 +168,13 @@
 static u_int
 argtou(const char *arg, u_int lo, u_int hi, const char *msg)
 {
-    char *s;
-    u_long x;
+    off_t x;
 
     errno = 0;
-    x = strtoul(arg, &s, 0);
-    if (errno || !*arg || *s || x < lo || x > hi)
+    x = argtooff(arg, msg);
+    if (x < lo || x > hi)
        errx(1, "%s: bad %s", arg, msg);
-    return x;
+    return (u_int)x;
 }
 
 /*



Home | Main Index | Thread Index | Old Index