* [OSS-Tools] [PATCH microcom] main: error out on positional arguments
@ 2025-01-04 15:17 Jonas Rebmann
2025-11-24 11:24 ` Roland Hieber
0 siblings, 1 reply; 3+ messages in thread
From: Jonas Rebmann @ 2025-01-04 15:17 UTC (permalink / raw)
To: oss-tools; +Cc: Jonas Rebmann
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 <jre@pengutronix.de>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [OSS-Tools] [PATCH microcom] main: error out on positional arguments
2025-01-04 15:17 [OSS-Tools] [PATCH microcom] main: error out on positional arguments Jonas Rebmann
@ 2025-11-24 11:24 ` Roland Hieber
2025-11-24 13:32 ` Jonas Rebmann
0 siblings, 1 reply; 3+ messages in thread
From: Roland Hieber @ 2025-11-24 11:24 UTC (permalink / raw)
To: Jonas Rebmann; +Cc: oss-tools
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 <jre@pengutronix.de>
For the record, microcom uses GiHub and this has been merged in
<https://github.com/pengutronix/microcom/pull/48>.
> ---
> 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 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [OSS-Tools] [PATCH microcom] main: error out on positional arguments
2025-11-24 11:24 ` Roland Hieber
@ 2025-11-24 13:32 ` Jonas Rebmann
0 siblings, 0 replies; 3+ messages in thread
From: Jonas Rebmann @ 2025-11-24 13:32 UTC (permalink / raw)
To: Roland Hieber; +Cc: oss-tools
Thanks Roland,
On 2025-11-24 12:24, Roland Hieber wrote:
> For the record, microcom uses GiHub and this has been merged in
> <https://github.com/pengutronix/microcom/pull/48>.
In the meantime, I joined maintenance of the project and would still
accept patches sent to this list until further notice.
Regards,
Jonas
--
Pengutronix e.K. | Jonas Rebmann |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-24 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-04 15:17 [OSS-Tools] [PATCH microcom] main: error out on positional arguments Jonas Rebmann
2025-11-24 11:24 ` Roland Hieber
2025-11-24 13:32 ` Jonas Rebmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox