1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
/* openbsd's bin/echo/echo.c
*
* Copyright (c) 1989, 1993
* The Regents of the University of California.
* All rights reserved.
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
/* ARGSUSED */
int
main(int argc, char *argv[])
{
int nflag;
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
/* This utility may NOT do getopt(3) option parsing. */
if (*++argv && !strcmp(*argv, "-n")) {
++argv;
nflag = 1;
}
else
nflag = 0;
while (*argv) {
(void)fputs(*argv, stdout);
if (*++argv)
putchar(' ');
}
if (!nflag)
putchar('\n');
return 0;
}
|