source: MondoRescue/branches/2.2.9/mindi-busybox/coreutils/yes.c@ 2729

Last change on this file since 2729 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 976 bytes
RevLine 
[821]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 *
[2725]7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
[821]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
[1765]17#include "libbb.h"
[821]18
[1765]19/* This is a NOFORK applet. Be very careful! */
20
[2725]21//usage:#define yes_trivial_usage
22//usage: "[STRING]"
23//usage:#define yes_full_usage "\n\n"
24//usage: "Repeatedly output a line with STRING, or 'y'"
25
26int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
27int yes_main(int argc UNUSED_PARAM, char **argv)
[821]28{
[2725]29 char **pp;
[821]30
[1765]31 argv[0] = (char*)"y";
[2725]32 if (argv[1])
[821]33 ++argv;
34
35 do {
[2725]36 pp = argv;
[1765]37 while (1) {
[2725]38 fputs(*pp, stdout);
39 if (!*++pp)
[1765]40 break;
41 putchar(' ');
42 }
[821]43 } while (putchar('\n') != EOF);
44
45 bb_perror_nomsg_and_die();
46}
Note: See TracBrowser for help on using the repository browser.