sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

echo.c (421B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include <stdio.h>
      3 #include <string.h>
      4 #include "util.h"
      5 
      6 int
      7 main(int argc, char *argv[])
      8 {
      9 	int nflag = 0;
     10 
     11 	argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;
     12 
     13 	if (*argv && !strcmp(*argv, "-n")) {
     14 		nflag = 1;
     15 		argc--, argv++;
     16 	}
     17 
     18 	for (; *argv; argc--, argv++)
     19 		putword(stdout, *argv);
     20 	if (!nflag)
     21 		putchar('\n');
     22 
     23 	return fshut(stdout, "<stdout>");
     24 }