summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/yes.c2
-rwxr-xr-xtests/misc/yes.sh3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/yes.c b/src/yes.c
index e127310f1..a3b25ce08 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -76,7 +76,7 @@ main (int argc, char **argv)
char **operand_lim = argv + argc;
if (optind == argc)
- *operand_lim++ = bad_cast ("-");
+ *operand_lim++ = bad_cast ("y");
/* Buffer data locally once, rather than having the
large overhead of stdio buffering each item. */
diff --git a/tests/misc/yes.sh b/tests/misc/yes.sh
index a3027432b..c8ef65a7f 100755
--- a/tests/misc/yes.sh
+++ b/tests/misc/yes.sh
@@ -19,6 +19,9 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ yes
+# Check basic operation
+test "$(yes | head -n1)" = 'y' || fail=1
+
# Check various single item sizes, with the most important
# size being BUFSIZ used for the local buffer to yes(1).
# Note a \n is added, so actual sizes required internally