Do not interpret -- in echo(1)

Retain -n as it is marginally useful and common.
This commit is contained in:
sin 2015-04-03 10:29:11 +01:00
parent bbd2b4d243
commit 9611e92303

17
echo.c
View File

@ -1,26 +1,17 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "util.h" #include "util.h"
static void
usage(void)
{
eprintf("usage: %s [-n] [string ...]\n", argv0);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int nflag = 0; int nflag = 0;
ARGBEGIN { if (*++argv && !strcmp(*argv, "-n")) {
case 'n':
nflag = 1; nflag = 1;
break; argc--, argv++;
default: }
usage();
} ARGEND;
for (; *argv; argc--, argv++) for (; *argv; argc--, argv++)
putword(*argv); putword(*argv);