public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rajkumar Vadhyar <rajkumarvad@gmail.com>
To: jacek.anaszewski@gmail.com, rbmarliere@gmail.com,
	skhan@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, Rajkumar Vadhyar <rajkumarvad@gmail.com>
Subject: [PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon
Date: Tue, 20 Aug 2024 12:53:40 +0530	[thread overview]
Message-ID: <20240820072341.41153-2-rajkumarvad@gmail.com> (raw)
In-Reply-To: <20240820072341.41153-1-rajkumarvad@gmail.com>

Add '-h' and '--help' command line options to uledmon

Signed-off-by: Rajkumar Vadhyar <rajkumarvad@gmail.com> 
---
 tools/leds/uledmon.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/leds/uledmon.c b/tools/leds/uledmon.c
index c15a39c1f271..6609235d80b0 100644
--- a/tools/leds/uledmon.c
+++ b/tools/leds/uledmon.c
@@ -11,6 +11,8 @@
  * CTRL+C will exit.
  */
 
+#define	ULEDMON_USAGE	"Usage: ./uledmon <device-name>\n"
+
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
@@ -19,6 +21,7 @@
 
 #include <linux/uleds.h>
 
+
 int main(int argc, char const *argv[])
 {
 	struct uleds_user_dev uleds_dev;
@@ -30,6 +33,10 @@ int main(int argc, char const *argv[])
 		fprintf(stderr, "Requires <device-name> argument\n");
 		return 1;
 	}
+	if (!(strcmp(argv[1], "-h")) || !(strcmp(argv[1], "--help"))) {
+		fprintf(stderr, ULEDMON_USAGE);
+		return 1;
+	}
 
 	strncpy(uleds_dev.name, argv[1], LED_MAX_NAME_SIZE);
 	uleds_dev.max_brightness = 100;
-- 
2.40.1

  reply	other threads:[~2024-08-20  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  7:23 [PATCH 0/2] tools/leds: Adding '-h' and '--help' command line options to uledmon and led_hw_brightness_mon Rajkumar Vadhyar
2024-08-20  7:23 ` Rajkumar Vadhyar [this message]
2024-08-25 11:55   ` [PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon Jacek Anaszewski
     [not found]     ` <CAPTF_YM5CS5-5sdceU598uY16LaGy1hJMKwVmr75Cqsemjs38g@mail.gmail.com>
2024-09-20 21:01       ` Jacek Anaszewski
2024-08-20  7:23 ` [PATCH 2/2] tools/leds: Add '-h' & '--help' cmd options to led_hw_brightness_mon Rajkumar Vadhyar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240820072341.41153-2-rajkumarvad@gmail.com \
    --to=rajkumarvad@gmail.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rbmarliere@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox