From d50a3cfe49d6ab7aa1db8380dde1508cafe67b7d Mon Sep 17 00:00:00 2001 From: Kiyoshi Aman Date: Sun, 19 May 2019 07:38:31 -0500 Subject: bin/echo: build against libbsd, make strictly conformant --- bin/echo/echo.1 | 16 ++-------------- bin/echo/echo.c | 29 ++--------------------------- 2 files changed, 4 insertions(+), 41 deletions(-) diff --git a/bin/echo/echo.1 b/bin/echo/echo.1 index a7e374b..81156d5 100644 --- a/bin/echo/echo.1 +++ b/bin/echo/echo.1 @@ -40,8 +40,6 @@ .Nd write arguments to the standard output .Sh SYNOPSIS .Nm -.Op Fl n -.Op Ar string ... .Sh DESCRIPTION The .Nm @@ -50,22 +48,12 @@ characters and followed by a newline (``\en'') character, to the standard output. .Pp The following option is available: -.Bl -tag -width flag -.It Fl n -Do not print the trailing newline character. .El .Sh EXIT STATUS .Ex -std echo .Sh SEE ALSO .Xr printf 1 -.Sh STANDARDS +.Sh CONFORMANCE The .Nm -utility is expected to be -.St -p1003.2 -compatible. -.Sh HISTORY -An -.Nm -utility appeared in -.At v2 . +utility is strictly conformant to POSIX.1-2017. diff --git a/bin/echo/echo.c b/bin/echo/echo.c index 2e59363..73e1fe0 100644 --- a/bin/echo/echo.c +++ b/bin/echo/echo.c @@ -29,50 +29,25 @@ * SUCH DAMAGE. */ -#include -#ifndef lint -__COPYRIGHT( -"@(#) Copyright (c) 1989, 1993\ - The Regents of the University of California. All rights reserved."); -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)echo.c 8.1 (Berkeley) 5/31/93"; -#else -__RCSID("$NetBSD: echo.c,v 1.19 2016/09/05 01:00:07 sevan Exp $"); -#endif -#endif /* not lint */ - #include #include #include +#include #include /* ARGSUSED */ int main(int argc, char *argv[]) { - int nflag; - setprogname(argv[0]); (void)setlocale(LC_ALL, ""); - /* This utility may NOT do getopt(3) option parsing. */ - if (*++argv && !strcmp(*argv, "-n")) { - ++argv; - nflag = 1; - } - else - nflag = 0; - while (*argv) { (void)printf("%s", *argv); if (*++argv) (void)putchar(' '); } - if (nflag == 0) - (void)putchar('\n'); + (void)putchar('\n'); fflush(stdout); if (ferror(stdout)) exit(1); -- cgit v1.2.3-70-g09d2