Contents of /trunk/mkinitrd-magellan/busybox/coreutils/yes.c
Parent Directory | 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: 795 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 795 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 | * yes implementation for busybox |
4 | * |
5 | * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> |
6 | * |
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 | */ |
9 | |
10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ |
11 | |
12 | /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) |
13 | * |
14 | * Size reductions and removed redundant applet name prefix from error messages. |
15 | */ |
16 | |
17 | #include "busybox.h" |
18 | |
19 | int yes_main(int argc, char **argv) |
20 | { |
21 | static const char fmt_str[] = " %s"; |
22 | const char *fmt; |
23 | char **first_arg; |
24 | |
25 | *argv = "y"; |
26 | if (argc != 1) { |
27 | ++argv; |
28 | } |
29 | |
30 | first_arg = argv; |
31 | do { |
32 | fmt = fmt_str + 1; |
33 | do { |
34 | printf(fmt, *argv); |
35 | fmt = fmt_str; |
36 | } while (*++argv); |
37 | argv = first_arg; |
38 | } while (putchar('\n') != EOF); |
39 | |
40 | bb_perror_nomsg_and_die(); |
41 | } |