From nobody Thu Jun 15 19:28:02 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qhsl63l3mz4d98s; Thu, 15 Jun 2023 19:28:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qhsl62xt0z3nXP; Thu, 15 Jun 2023 19:28:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686857282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7WkMoDcLgs3XnPZmzJ4KdUUZio6/Ahy8yYbDGc0QAS4=; b=OfdMF+BieFwX7nnPMzuVgZlx7gVvz1cb2ocZz/tSOLSyaat9+dNLIn/aeUfBYilwAajhzM kvbHei5f1P4IyUALEkRGMd4ih5bjRy6eBvUX1KkTuE0AFdS+2mvBvmwFO2g/VMk1wYp2ze A3Bwi2e1aeBkcfdR2itRRvQjnc1vDvHS8OWEhL0Rrq+AaJ/ecYCncWU1Fci5GwbfbrV6fL ShtvPNYdKGKo5EGp6xEbl7+3uV16T66+ohVDVnG5CCWnYAsz92qPBmm7OPxg3eWWKOqxRu FlyB3ik6LbeYQzuBe6+ySJHY7TVV4MUsAF/By5w4KAcxtLQfnJVQrf7+HCvHeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686857282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7WkMoDcLgs3XnPZmzJ4KdUUZio6/Ahy8yYbDGc0QAS4=; b=ZU8vfDfLTkiqkS9F5s+ZRXaK0d6YrFpHT3q7bu0y+ZnG7up1aAG9lKqGl+SZ7Nvr0Uucqf iqfx7+SbOJM+iF/3WWdIC9EKOxp8ymdF0anbfRUuuf25HkrlHPZHyskiAaRrysT+AldGko 0cGlAUH+D/FLMAXwDUr65xd1VPkPDWw5Vg16JBjIlIUmwy+JZP82N2yY+QIJ6AH3l6uFs/ pf66sPgflvRIzbWdEwLmu03seCB1VPQoXHrh6b/9+l5OB1ZpeuwsplO7GK1wIIwCE45OZB yU2W7rUsbVyeWkxyDANoe128kR8SqHex7NJs0lKGdjT7JhrUiLqpTgc0Kclcag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686857282; a=rsa-sha256; cv=none; b=RAzzC+UrDPYAlbRPHKYT21pTNCkzDxehQyal9aKv6cvA8UlKrVwDkkpVwMcBd270PX0KyJ 50BkN9UFLoxQOrc1OXyY+van5mjNTpP5/d3AOD2CSDNMkBCVCsshIcValZAkp6ZjhqAlU+ aWdGDH03PNbtmu4ed/hk7BvYoBxAbzcv7s47W2DZi2BiFeMiVOuXak2DGTZHl7KUE/l51O O5WTCvoi+uYpq9M1wUlFogWEz9KbgOTeIvumMd6VJ2OPb/chC0l3WdHFNPyR3yOSzo4HwE xtJ+tycjA74gfKsknnFsmLdDM/cjUpJCLpphIH2dIXvACJtUUrosJHe5D2gLug== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qhsl61r4mzy1n; Thu, 15 Jun 2023 19:28:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35FJS2s7065386; Thu, 15 Jun 2023 19:28:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35FJS2JE065385; Thu, 15 Jun 2023 19:28:02 GMT (envelope-from git) Date: Thu, 15 Jun 2023 19:28:02 GMT Message-Id: <202306151928.35FJS2JE065385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: f08f90e69877 - main - asa: Read from stdin if *argv is "-". List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f08f90e6987775f88d25efbd8762c361819f40ba Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f08f90e6987775f88d25efbd8762c361819f40ba commit f08f90e6987775f88d25efbd8762c361819f40ba Author: Dag-Erling Smørgrav AuthorDate: 2023-06-15 19:23:22 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-06-15 19:24:58 +0000 asa: Read from stdin if *argv is "-". MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D40563 --- usr.bin/asa/asa.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/usr.bin/asa/asa.c b/usr.bin/asa/asa.c index 11438b607466..a6c3d7d7c1e5 100644 --- a/usr.bin/asa/asa.c +++ b/usr.bin/asa/asa.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include static void asa(FILE *); @@ -71,13 +72,17 @@ main(int argc, char *argv[]) asa(stdin); else { while ((fn = *argv++) != NULL) { - if ((fp = fopen(fn, "r")) == NULL) { - warn("%s", fn); - exval = 1; - continue; - } - asa(fp); - fclose(fp); + if (strcmp(fn, "-") == 0) { + asa(stdin); + } else { + if ((fp = fopen(fn, "r")) == NULL) { + warn("%s", fn); + exval = 1; + continue; + } + asa(fp); + fclose(fp); + } } }