aboutsummaryrefslogtreecommitdiff
path: root/yes.c
diff options
context:
space:
mode:
Diffstat (limited to 'yes.c')
-rw-r--r--yes.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/yes.c b/yes.c
new file mode 100644
index 0000000..073cb41
--- /dev/null
+++ b/yes.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-3.0+ */
+/*
+ * Copyright (C) 2022, 2023 Ferass El Hafidi <vitali64pmemail@protonmail.com>
+ * Copyright (C) 2022 Ron Nazarov <ron@noisytoot.org>
+ */
+#include <string.h>
+#include <stdio.h>
+
+#ifdef FASESBOX
+int yes_main(int argc, char *argv[]) {
+#else
+int main(int argc, char *argv[]) {
+#endif
+ setvbuf(stdout, NULL, _IONBF, 0);
+ if (argc > 1) {
+ if (!strcmp(argv[1], "--")) {
+ if (--argc == 1) goto yes;
+ argv = &argv[1];
+ }
+ while(1) {
+ for (int i = 1; i < argc; i++) printf("%s%c", argv[i], i == argc - 1 ? '\n' : ' ');
+ }
+ } else {
+yes:
+ while(1) printf("y\n");
+ }
+ return 0;
+}