blob: 97b4fe54c451b173bd44f2eb7700d800cc732a2e [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
Erik Andersen31638212000-01-15 22:28:50 +000017#include <stdio.h>
Eric Andersened3ef502001-01-27 08:24:39 +000018#include <stdlib.h>
Eric Andersencbe31da2001-02-20 06:14:08 +000019#include "busybox.h"
Erik Andersen31638212000-01-15 22:28:50 +000020
Rob Landleydfba7412006-03-06 20:47:33 +000021int yes_main(int argc, char **argv)
Erik Andersene49d5ec2000-02-08 19:58:47 +000022{
Manuel Novoa III cad53642003-03-19 09:13:01 +000023 static const char fmt_str[] = " %s";
24 const char *fmt;
25 char **first_arg;
Erik Andersene49d5ec2000-02-08 19:58:47 +000026
Manuel Novoa III cad53642003-03-19 09:13:01 +000027 *argv = "y";
28 if (argc != 1) {
29 ++argv;
Erik Andersene5b6c7d2000-04-17 16:16:10 +000030 }
Erik Andersen31638212000-01-15 22:28:50 +000031
Manuel Novoa III cad53642003-03-19 09:13:01 +000032 first_arg = argv;
33 do {
34 fmt = fmt_str + 1;
35 do {
36 bb_printf(fmt, *argv);
37 fmt = fmt_str;
38 } while (*++argv);
39 argv = first_arg;
40 } while (putchar('\n') != EOF);
Matt Kraai90f580a2000-09-22 03:45:34 +000041
Manuel Novoa III cad53642003-03-19 09:13:01 +000042 bb_perror_nomsg_and_die();
Erik Andersen31638212000-01-15 22:28:50 +000043}