blob: 9d3f675501d5b41f525397532fa459b4432d47e8 [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Erik Andersen31638212000-01-15 22:28:50 +00002/*
Manuel Novoa III cad53642003-03-19 09:13:01 +00003 * yes implementation for busybox
Erik Andersen31638212000-01-15 22:28:50 +00004 *
Manuel Novoa III cad53642003-03-19 09:13:01 +00005 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
Erik Andersen31638212000-01-15 22:28:50 +00006 *
"Robert P. J. Day"801ab142006-07-12 07:56:04 +00007 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Erik Andersen31638212000-01-15 22:28:50 +00008 */
9
Manuel Novoa III cad53642003-03-19 09:13:01 +000010/* 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 */
Eric Andersen8d4c3972001-03-09 21:28:09 +000016
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000017#include "libbb.h"
Erik Andersen31638212000-01-15 22:28:50 +000018
Denis Vlasenko99912ca2007-04-10 15:43:37 +000019/* This is a NOFORK applet. Be very careful! */
20
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000021int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Rob Landleydfba7412006-03-06 20:47:33 +000022int yes_main(int argc, char **argv)
Erik Andersene49d5ec2000-02-08 19:58:47 +000023{
Denis Vlasenko62a90cd2008-03-17 09:07:36 +000024 char **pp;
Erik Andersene49d5ec2000-02-08 19:58:47 +000025
Denis Vlasenko99912ca2007-04-10 15:43:37 +000026 argv[0] = (char*)"y";
Manuel Novoa III cad53642003-03-19 09:13:01 +000027 if (argc != 1) {
28 ++argv;
Erik Andersene5b6c7d2000-04-17 16:16:10 +000029 }
Erik Andersen31638212000-01-15 22:28:50 +000030
Manuel Novoa III cad53642003-03-19 09:13:01 +000031 do {
Denis Vlasenko62a90cd2008-03-17 09:07:36 +000032 pp = argv;
Denis Vlasenko99912ca2007-04-10 15:43:37 +000033 while (1) {
Denis Vlasenko62a90cd2008-03-17 09:07:36 +000034 fputs(*pp, stdout);
35 if (!*++pp)
Denis Vlasenko99912ca2007-04-10 15:43:37 +000036 break;
37 putchar(' ');
38 }
Manuel Novoa III cad53642003-03-19 09:13:01 +000039 } while (putchar('\n') != EOF);
Matt Kraai90f580a2000-09-22 03:45:34 +000040
Manuel Novoa III cad53642003-03-19 09:13:01 +000041 bb_perror_nomsg_and_die();
Erik Andersen31638212000-01-15 22:28:50 +000042}