summaryrefslogtreecommitdiffhomepage
path: root/coreutils/cut.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
commit1385899416a4396385ad421ae1f532be7103738a (patch)
treefc4d14a910593d1235318bb36abe5e9f72d2039e /coreutils/cut.c
parent5625415085e68ac5e150f54e685417c866620d76 (diff)
attempt to regularize atoi mess.
Diffstat (limited to 'coreutils/cut.c')
-rw-r--r--coreutils/cut.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 69f28fa8d..7ba947fae 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -163,17 +163,7 @@ static void cut_file(FILE * file)
}
}
-static int getval(char *ntok)
-{
- char *junk;
- int i = strtoul(ntok, &junk, 10);
-
- if (*junk != '\0' || i < 0)
- bb_error_msg_and_die("invalid byte or field list");
- return i;
-}
-
-static const char * const _op_on_field = " only when operating on fields";
+static const char _op_on_field[] = " only when operating on fields";
int cut_main(int argc, char **argv)
{
@@ -231,7 +221,7 @@ int cut_main(int argc, char **argv)
} else if (strlen(ntok) == 0) {
s = BOL;
} else {
- s = getval(ntok);
+ s = xatoi_u(ntok);
/* account for the fact that arrays are zero based, while
* the user expects the first char on the line to be char #1 */
if (s != 0)
@@ -245,7 +235,7 @@ int cut_main(int argc, char **argv)
} else if (strlen(ntok) == 0) {
e = EOL;
} else {
- e = getval(ntok);
+ e = xatoi_u(ntok);
/* if the user specified and end position of 0, that means "til the
* end of the line */
if (e == 0)