k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit 1c6f62238f59e40361eeac9d038257b0765d7306
parent 538adcedc3d335daafb49eda01c64b00ae005dbc
Author: call-cc <callcc@vxempire.xyz>
Date:   Sat,  6 Jun 2020 04:52:03 -0400

Improve echo, or fix -n flag

Diffstat:
Msrc/echo.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/echo.c b/src/echo.c @@ -5,9 +5,12 @@ int main(int argc, char *argv[]) { int nflag; - if(!strcmp(argv[1], "-n")) - nflag = 1; - ++argv; + if(!strcmp(*++argv, "-n")) + { + nflag = 1; + argv++; + } + while(*argv) { (void)fputs(*argv, stdout); /* Print argv */