Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/coreutils/seq.c


Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/coreutils/seq.c

    r821 r1765  
    88 */
    99
    10 #include <stdio.h>
    11 #include <stdlib.h>
    12 #include "busybox.h"
     10#include "libbb.h"
    1311
     12/* This is a NOFORK applet. Be very careful! */
     13
     14
     15int seq_main(int argc, char **argv);
    1416int seq_main(int argc, char **argv)
    1517{
    16     double last, first, increment, i;
    17    
    18     first = increment = 1;
     18    double last, increment, i;
     19
     20    i = increment = 1;
    1921    switch (argc) {
    2022        case 4:
    21             increment=atof(argv[2]);
     23            increment = atof(argv[2]);
    2224        case 3:
    23             first=atof(argv[1]);
     25            i = atof(argv[1]);
    2426        case 2:
    25             last=atof(argv[argc -1]);
     27            last = atof(argv[argc-1]);
    2628            break;
    2729        default:
     
    3032
    3133    /* You should note that this is pos-5.0.91 semantics, -- FK. */
    32     for (i = first;
    33          (increment > 0 && i <= last) || (increment < 0 && i >=last);
    34          i += increment)
    35     {
     34    while ((increment > 0 && i <= last) || (increment < 0 && i >= last)) {
    3635        printf("%g\n", i);
     36        i += increment;
    3737    }
    3838
    39     return EXIT_SUCCESS;
     39    return fflush(stdout);
    4040}
Note: See TracChangeset for help on using the changeset viewer.