pidfile.c: not used anymore
[oweals/busybox.git] / coreutils / seq.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * seq implementation for busybox
4  *
5  * Copyright (C) 2004, Glenn McGrath
6  *
7  * Licensed under the GPL v2, see the file LICENSE in this tarball.
8  */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include "busybox.h"
13
14 int seq_main(int argc, char **argv);
15 int seq_main(int argc, char **argv)
16 {
17         double last, first, increment, i;
18
19         first = increment = 1;
20         switch (argc) {
21                 case 4:
22                         increment = atof(argv[2]);
23                 case 3:
24                         first = atof(argv[1]);
25                 case 2:
26                         last = atof(argv[argc-1]);
27                         break;
28                 default:
29                         bb_show_usage();
30         }
31
32         /* You should note that this is pos-5.0.91 semantics, -- FK. */
33         for (i = first;
34                 (increment > 0 && i <= last) || (increment < 0 && i >=last);
35                 i += increment)
36         {
37                 printf("%g\n", i);
38         }
39
40         return EXIT_SUCCESS;
41 }