k9core

Coreutils for *nix operating systems [fork]
git clone git://bvnf.space/k9core.git
Log | Files | Refs | LICENSE

echo.c (353B)


      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
#include <stdio.h>
#include <string.h>

int
main(int argc, char *argv[])
{
	int nflag;
	if(!strcmp(*++argv, "-n")) {
		nflag = 1;
		argv++;
	}

	while(*argv) {
		(void)fputs(*argv, stdout); /* Print argv */
		if(*++argv)
			putchar(' '); /* If multiple things in argv, print a space
						  between them. */
	}
	if(!nflag)
		putchar('\n');
	return 0;
}