From ec412294555b1e82407ca903ceaaf1eb2a498c4e Mon Sep 17 00:00:00 2001 From: Phil Greenway Date: Sun, 6 Oct 2002 10:41:32 +0000 Subject: [PATCH] =?UTF-8?q?Coded=20by=20Jonas=20Sundstr=EF=BF=BD=EF=BF=BDm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1399 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bin/yes.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/apps/bin/yes.cpp diff --git a/src/apps/bin/yes.cpp b/src/apps/bin/yes.cpp new file mode 100644 index 0000000000..e937baecd3 --- /dev/null +++ b/src/apps/bin/yes.cpp @@ -0,0 +1,51 @@ +// yes - for OpenBeOS +// +// authors, in order of contribution: +// jonas.sundstrom@kirilla.com +// + +#include +#include +#include + +void PrintUsageInfo (void); + +int main(int32 argc, char **argv) +{ + if (argc > 1) // possible --help + { + BString option = argv[1]; + option.ToLower(); + + if (option == "--help") + { + PrintUsageInfo(); + return (0); + } + } + + while (1) // loop until interrupted + { + if (argc < 2) // no STRING + { + printf("y\n"); + } + else // STRING(s) + { + for (int i = 1; i < argc; i++) + { + printf("%s ", argv[i]); + } + printf("\n"); + } + } + + return (0); +} + +void PrintUsageInfo (void) +{ + printf ("use: yes [STRING] ...\n" + "Repeatedly output a line with all specified STRING(s), or `y'.\n"); +} +