From e27abc9c3b2fdcf4301c79f61774c0896ab41935 Mon Sep 17 00:00:00 2001 From: call-cc Date: Tue, 2 Jun 2020 20:43:33 -0400 Subject: [PATCH] Improve yes --- src/yes.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/yes.c b/src/yes.c index 992c78b..ff195af 100644 --- a/src/yes.c +++ b/src/yes.c @@ -1,19 +1,11 @@ #include -#include int main(int argc, char *argv[]) { - char a = 'y'; - - if(argv[1] != NULL) - { - strcpy(&a,argv[1]); - } - while(1) - { - putchar(a); - putchar('\n'); - } + if(argc > 1) + while(1) puts(argv[1]); + else + while(1) puts("y"); return 0; }