Rev | Line | |
---|
[821] | 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 |
|
---|
[1765] | 10 | #include "libbb.h"
|
---|
[821] | 11 |
|
---|
[1765] | 12 | /* This is a NOFORK applet. Be very careful! */
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | int seq_main(int argc, char **argv);
|
---|
[821] | 16 | int seq_main(int argc, char **argv)
|
---|
| 17 | {
|
---|
[1765] | 18 | double last, increment, i;
|
---|
| 19 |
|
---|
| 20 | i = increment = 1;
|
---|
[821] | 21 | switch (argc) {
|
---|
| 22 | case 4:
|
---|
[1765] | 23 | increment = atof(argv[2]);
|
---|
[821] | 24 | case 3:
|
---|
[1765] | 25 | i = atof(argv[1]);
|
---|
[821] | 26 | case 2:
|
---|
[1765] | 27 | last = atof(argv[argc-1]);
|
---|
[821] | 28 | break;
|
---|
| 29 | default:
|
---|
| 30 | bb_show_usage();
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | /* You should note that this is pos-5.0.91 semantics, -- FK. */
|
---|
[1765] | 34 | while ((increment > 0 && i <= last) || (increment < 0 && i >= last)) {
|
---|
[821] | 35 | printf("%g\n", i);
|
---|
[1765] | 36 | i += increment;
|
---|
[821] | 37 | }
|
---|
| 38 |
|
---|
[1765] | 39 | return fflush(stdout);
|
---|
[821] | 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.