From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 24 Nov 2025 12:24:34 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vNUgM-004N79-0v for lore@lore.pengutronix.de; Mon, 24 Nov 2025 12:24:34 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1vNUgL-0001yr-Ls; Mon, 24 Nov 2025 12:24:33 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vNUgJ-0001yd-Hv; Mon, 24 Nov 2025 12:24:31 +0100 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vNUgJ-002A5b-1C; Mon, 24 Nov 2025 12:24:31 +0100 Received: from rhi by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1vNUgJ-003x1i-0v; Mon, 24 Nov 2025 12:24:31 +0100 Date: Mon, 24 Nov 2025 12:24:31 +0100 From: Roland Hieber To: Jonas Rebmann Message-ID: <1763983436-9dacb7c56871e66433da2102@pty> References: <20250104151725.12843-1-jre@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20250104151725.12843-1-jre@pengutronix.de> Subject: Re: [OSS-Tools] [PATCH microcom] main: error out on positional arguments X-BeenThere: oss-tools@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: Pengutronix Public Open-Source-Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: oss-tools@pengutronix.de Sender: "OSS-Tools" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: oss-tools-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false On Sat, Jan 04, 2025 at 04:17:25PM +0100, Jonas Rebmann wrote: > As microcom makes no use of positional arguments, error out and show > usage if a positional argument is presented. > > Without this patch, invalid usage involving a positional such as > microcom /dev/ttyUSB0 is silently ignored. > > Signed-off-by: Jonas Rebmann For the record, microcom uses GiHub and this has been merged in . > --- > microcom.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/microcom.c b/microcom.c > index 2b3d484..974c0cf 100644 > --- a/microcom.c > +++ b/microcom.c > @@ -183,6 +183,10 @@ int main(int argc, char *argv[]) > } > } > > + if (optind < argc) { > + main_usage(1, "", ""); > + } > + > if (answerback) { > ret = asprintf(&answerback, "%s\n", answerback); > if (ret < 0) > -- > 2.39.5 > > > -- Roland Hieber, Pengutronix e.K. | rhi@pengutronix.de | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |