jfb2 writes in Bug 119:
[oweals/busybox.git] / coreutils / fold.c
index f9ae526df55791127a3edd75058ebbe8e325a5fb..68f24e61a6d80901c3e72e07b6e7d6fb36b3f026 100644 (file)
@@ -4,7 +4,7 @@
    Copyright (C) 91, 1995-2002 Free Software Foundation, Inc.
 
    Modified for busybox based on coreutils v 5.0
-   Copyright (C) 2003 Glenn McGrath <bug1@optushome.com.au>
+   Copyright (C) 2003 Glenn McGrath <bug1@iinet.net.au>
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -97,15 +97,7 @@ extern int fold_main(int argc, char **argv)
                                break_spaces = 1;
                                break;
                        case 'w': {     /* Line width. */
-                               long int tmp_long;
-                               char *end_ptr;
-
-                               errno = 0;
-                               tmp_long = strtol(optarg, &end_ptr, 10);
-                               if (!end_ptr || errno || tmp_long < 1) {
-                                       bb_error_msg_and_die("invalid number of columns: `%s'", optarg);
-                               }
-                               width = (int) tmp_long;
+                               width = bb_xgetlarg(optarg, 10, 1, 10000);
                                break;
                        }
                        default: