Magellan Linux

Contents of /trunk/mkinitrd-magellan/busybox/coreutils/seq.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 730 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

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 {
16 double last, first, increment, i;
17
18 first = increment = 1;
19 switch (argc) {
20 case 4:
21 increment = atof(argv[2]);
22 case 3:
23 first = atof(argv[1]);
24 case 2:
25 last = atof(argv[argc-1]);
26 break;
27 default:
28 bb_show_usage();
29 }
30
31 /* 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 {
36 printf("%g\n", i);
37 }
38
39 return EXIT_SUCCESS;
40 }