Re: [PATCH 3/7] lsfd: improve grammar, and use angular brackets around placeholder word

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Karel Zak <kzak@xxxxxxxxxx>
Subject: Re: [PATCH 3/7] lsfd: improve grammar, and use angular brackets around placeholder word
Date: Thu, 24 Apr 2025 12:05:07 +0200
> On Thu, Apr 24, 2025 at 06:55:05PM +0900, Masatake YAMATO wrote:
>> > Also, use dots instead of "(s)" to indicate possible multiple arguments,
>> > and don't use "<when>" when the possible arguments differ from "always",
>> > "never", "auto".
>> > 
>> > Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxx>
>> > ---
>> >  lsfd-cmd/lsfd.c | 6 +++---
>> >  1 file changed, 3 insertions(+), 3 deletions(-)
>> > 
>> > diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c
>> > index 2eb53935c..3610de8dd 100644
>> > --- a/lsfd-cmd/lsfd.c
>> > +++ b/lsfd-cmd/lsfd.c
>> > @@ -2190,14 +2190,14 @@ static void __attribute__((__noreturn__)) usage(void)
>> >  	fputs(_(" -o, --output <list>          output columns (see --list-columns)\n"), out);
>> >  	fputs(_(" -r, --raw                    use raw output format\n"), out);
>> >  	fputs(_(" -u, --notruncate             don't truncate text in columns\n"), out);
>> > -	fputs(_(" -p, --pid  <pid(s)>          collect information only specified processes\n"), out);
>> > +	fputs(_(" -p, --pid <pid>...           collect information only for specified processes\n"), out);
>> 
>> This change implies that --pid 1 2 3 works.
>> However, specifying multiple pids to one --pid doesn't work.
>> 
>>    # lsfd --pid 1 $$
>>    Try 'lsfd --help' for more information.
>> 
>> Only --pid "1 2 3"  or works. See double-quote chars.
>> 
>>    # lsfd --pid "1 $$"
> 
> It also supports comma, it means --pid 1,2,3
> 
> It would be better to not announce that space is possible to use as
> separator, and use comma in the help and man page
> 
>   fputs(_(" -p, --pid <list>           restrict to specified processes (command separated pids)\nn"), out);
> 
> or so ...

I added code supporting whitespace as a separator for combining lsfd with
pidof, as I wrote as an example in lsfd(1):

       # lsfd --pid "$(pidof firefox)"

The idea combining with pidof comes from strace.

The -p option of strace supported whitespace as a separator.
So we can run strace with pidof like:

       # strace -p "$(pidof firefox)"

I didn't know this smart feature.
So I added -S option, an option for specifying separator to pidof ago.

    $ pidof -S ' -p ' zsh
    4185021 -p 4161716 -p 4156470 -p 4155385
    $ strace -p $(pidof -S ' -p ' zsh)

https://gitlab.com/procps-ng/procps/-/commit/73492b182dc60c1605d1b0d62de651fad97807af
https://lists.strace.io/pipermail/strace-devel/2018-March/007950.html
https://lists.strace.io/pipermail/strace-devel/2018-March/007951.html
https://lists.strace.io/pipermail/strace-devel/2018-March/007952.html

That was a small thing but impressive study for me.

Simplifying the output of --help is nice
However, from the man page, I want to keep the description of -p
supporting whitespace as a separator.

Masatake YAMATO

>     Karel
> 
> -- 
>  Karel Zak  <kzak@xxxxxxxxxx>
>  http://karelzak.blogspot.com
> 





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux