Contents of /trunk/coreutils/patches-5.3.0/coreutils-5.3.0-warning-seq.c.patch
Parent Directory | Revision Log
Revision 44 -
(show annotations)
(download)
Thu Oct 13 21:17:16 2005 UTC (18 years, 11 months ago) by niro
File size: 1599 byte(s)
Thu Oct 13 21:17:16 2005 UTC (18 years, 11 months ago) by niro
File size: 1599 byte(s)
patch set for coretutils-5.3.0
1 | diff -urN coreutils-5.2.0.orig/src/seq.c coreutils-5.2.0/src/seq.c |
2 | --- coreutils-5.2.0.orig/src/seq.c 2004-02-07 12:39:17.000000000 -0800 |
3 | +++ coreutils-5.2.0/src/seq.c 2004-03-03 10:10:17.000000000 -0800 |
4 | @@ -56,7 +56,7 @@ |
5 | static double first; |
6 | |
7 | /* The increment. */ |
8 | -static double step = 1.0; |
9 | +static double step; |
10 | |
11 | /* The last number. */ |
12 | static double last; |
13 | @@ -298,6 +298,7 @@ |
14 | main (int argc, char **argv) |
15 | { |
16 | int optc; |
17 | + int step_is_set; |
18 | |
19 | /* The printf(3) format used for output. */ |
20 | char *format_str = NULL; |
21 | @@ -313,6 +314,7 @@ |
22 | equal_width = 0; |
23 | separator = "\n"; |
24 | first = 1.0; |
25 | + step_is_set = 0; |
26 | |
27 | /* Figure out the locale's idea of a decimal point. */ |
28 | #if HAVE_LOCALECONV |
29 | @@ -397,6 +399,7 @@ |
30 | if (optind < argc) |
31 | { |
32 | step = last; |
33 | + step_is_set = 1; |
34 | last = scan_double_arg (argv[optind++]); |
35 | } |
36 | } |
37 | @@ -408,6 +411,13 @@ |
38 | usage (EXIT_FAILURE); |
39 | } |
40 | |
41 | + if (!step_is_set) |
42 | + { |
43 | + step = (first <= last) ? 1.0 : -1.0; |
44 | + if (step < 0) |
45 | + error (0, 0, _("Please specify step of -1 since this behaviour is obsolete and will be removed in the future")); |
46 | + } |
47 | + |
48 | if (format_str == NULL) |
49 | { |
50 | if (equal_width) |
51 | --- coreutils-5.2.1/tests/seq/basic.orig 2005-01-08 04:29:19.869695048 -0500 |
52 | +++ coreutils-5.2.1/tests/seq/basic 2005-01-08 04:29:21.095508696 -0500 |
53 | @@ -24,8 +24,6 @@ |
54 | |
55 | my @Tests = |
56 | ( |
57 | - ['onearg-1', qw(10), {OUT => [(1..10)]}], |
58 | - ['onearg-2', qw(-1)], |
59 | ['neg-1', qw(-10 10 10), {OUT => [qw(-10 0 10)]}], |
60 | ['neg-2', qw(-.1 .1 .1), {OUT => [qw(-0.1 0 0.1)]}], |
61 | ['neg-3', qw(1 -1 0), {OUT => [qw(1 0)]}], |