diff --git a/src/echo.c b/src/echo.c index 6ed0f74..16e9a5d 100644 --- a/src/echo.c +++ b/src/echo.c @@ -1,13 +1,17 @@ #include +#include int main(int argc, char *argv[]) { + int nflag; + if(strcmp(argv[1], "-n") == 0) + nflag = 1; ++argv; while(*argv) { (void)fputs(*argv, stdout); // Print argv if(*++argv) putchar(' '); // If multiple things in argv, print a space between them. } - putchar('\n'); + if(nflag) putchar('\n'); return 0; }