commit e27abc9c3b2fdcf4301c79f61774c0896ab41935 parent 0670f46ef86becedfccc80bc0c41d39fa9db37fc Author: call-cc <callcc@vxempire.xyz> Date: Tue, 2 Jun 2020 20:43:33 -0400 Improve yes Diffstat:
M | src/yes.c | | | 16 | ++++------------ |
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/yes.c b/src/yes.c @@ -1,19 +1,11 @@ #include <stdio.h> -#include <string.h> 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; }