Re: scsi(8): reduce usage()

2021-06-22 Thread Mark Kettenis
> Date: Tue, 22 Jun 2021 13:30:11 +0100
> From: Jason McIntyre 
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> hi.
> 
> diff to reduce verbosity in scsi(8) usage. before:
> 
> $ /sbin/scsi -Z
> scsi: unknown option -- Z
> Usage:
> 
>   scsi -f device -d debug_level# To set debug level
>   scsi -f device -m page [-P pc]   # To read mode pages
>   scsi -f device [-v] [-s seconds] -c cmd_fmt [arg0 ... argn] # A command...
>  -o count out_fmt [arg0 ... argn]  #   EITHER (data out)
>  -i count in_fmt   #   OR (data in)
> 
> "out_fmt" can be "-" to read output data from stdin;
> "in_fmt" can be "-" to write input data to stdout;
> 
> If debugging is not compiled in the kernel, "-d" will have no effect
> 
> after:
> 
> $ /usr/obj/sbin/scsi/scsi -Z
> scsi: unknown option -- Z
> usage: scsi -f device -d debug_level
>scsi -f device -m page [-e] [-P pc]
>scsi -f device [-v] [-s seconds] -c cmd_fmt [arg ...] -o count out_fmt
> [arg ...] -i count in_fmt [arg ...]
> 
> ok?

ok kettenis@

> Index: sbin/scsi/scsi.c
> ===
> RCS file: /cvs/src/sbin/scsi/scsi.c,v
> retrieving revision 1.30
> diff -u -p -r1.30 scsi.c
> --- sbin/scsi/scsi.c  7 Jun 2016 01:29:38 -   1.30
> +++ sbin/scsi/scsi.c  22 Jun 2021 12:27:10 -
> @@ -84,20 +84,11 @@ static void
>  usage(void)
>  {
>   fprintf(stderr,
> -"Usage:\n"
> -"\n"
> -"  scsi -f device -d debug_level# To set debug level\n"
> -"  scsi -f device -m page [-P pc]   # To read mode pages\n"
> -"  scsi -f device [-v] [-s seconds] -c cmd_fmt [arg0 ... argn] # A 
> command...\n"
> -" -o count out_fmt [arg0 ... argn]  #   EITHER (data out)\n"
> -" -i count in_fmt   #   OR (data in)\n"
> -"\n"
> -"\"out_fmt\" can be \"-\" to read output data from stdin;\n"
> -"\"in_fmt\" can be \"-\" to write input data to stdout;\n"
> -"\n"
> -"If debugging is not compiled in the kernel, \"-d\" will have no effect\n"
> -
> -);
> +"usage: scsi -f device -d debug_level\n"
> +"   scsi -f device -m page [-e] [-P pc]\n"
> +"   scsi -f device [-v] [-s seconds] -c cmd_fmt [arg ...]"
> +" -o count out_fmt\n"
> +"[arg ...] -i count in_fmt [arg ...]\n");
>  
>   exit (1);
>  }
> 
> 



scsi(8): reduce usage()

2021-06-22 Thread Jason McIntyre
hi.

diff to reduce verbosity in scsi(8) usage. before:

$ /sbin/scsi -Z
scsi: unknown option -- Z
Usage:

  scsi -f device -d debug_level# To set debug level
  scsi -f device -m page [-P pc]   # To read mode pages
  scsi -f device [-v] [-s seconds] -c cmd_fmt [arg0 ... argn] # A command...
 -o count out_fmt [arg0 ... argn]  #   EITHER (data out)
 -i count in_fmt   #   OR (data in)

"out_fmt" can be "-" to read output data from stdin;
"in_fmt" can be "-" to write input data to stdout;

If debugging is not compiled in the kernel, "-d" will have no effect

after:

$ /usr/obj/sbin/scsi/scsi -Z
scsi: unknown option -- Z
usage: scsi -f device -d debug_level
   scsi -f device -m page [-e] [-P pc]
   scsi -f device [-v] [-s seconds] -c cmd_fmt [arg ...] -o count out_fmt
[arg ...] -i count in_fmt [arg ...]

ok?
jmc

Index: sbin/scsi/scsi.c
===
RCS file: /cvs/src/sbin/scsi/scsi.c,v
retrieving revision 1.30
diff -u -p -r1.30 scsi.c
--- sbin/scsi/scsi.c7 Jun 2016 01:29:38 -   1.30
+++ sbin/scsi/scsi.c22 Jun 2021 12:27:10 -
@@ -84,20 +84,11 @@ static void
 usage(void)
 {
fprintf(stderr,
-"Usage:\n"
-"\n"
-"  scsi -f device -d debug_level# To set debug level\n"
-"  scsi -f device -m page [-P pc]   # To read mode pages\n"
-"  scsi -f device [-v] [-s seconds] -c cmd_fmt [arg0 ... argn] # A 
command...\n"
-" -o count out_fmt [arg0 ... argn]  #   EITHER (data out)\n"
-" -i count in_fmt   #   OR (data in)\n"
-"\n"
-"\"out_fmt\" can be \"-\" to read output data from stdin;\n"
-"\"in_fmt\" can be \"-\" to write input data to stdout;\n"
-"\n"
-"If debugging is not compiled in the kernel, \"-d\" will have no effect\n"
-
-);
+"usage: scsi -f device -d debug_level\n"
+"   scsi -f device -m page [-e] [-P pc]\n"
+"   scsi -f device [-v] [-s seconds] -c cmd_fmt [arg ...]"
+" -o count out_fmt\n"
+"[arg ...] -i count in_fmt [arg ...]\n");
 
exit (1);
 }