[PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon

Rajkumar Vadhyar posted 2 patches 1 year, 5 months ago
[PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon
Posted by Rajkumar Vadhyar 1 year, 5 months ago
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
Re: [PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon
Posted by Jacek Anaszewski 1 year, 5 months ago
Hi Rajkumar,

You should send it to linux-leds@vger.kernel.org and to LEDs maintainer.

-- 
Best regards,
Jacek Anaszewski

On 8/20/24 09:23, Rajkumar Vadhyar wrote:
> 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;