Skip to content

Commit

Permalink
lsfd: cleanup --list-columns
Browse files Browse the repository at this point in the history
* remove dependence on command-line options order ("-H -J" vs. "-J -H")

References: util-linux#2602
Signed-off-by: Karel Zak <[email protected]>
  • Loading branch information
karelzak committed Dec 6, 2023
1 parent ff578e0 commit f5a81ca
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions misc-utils/lsfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -l, --threads list in threads level\n"), out);
fputs(_(" -J, --json use JSON output format\n"), out);
fputs(_(" -n, --noheadings don't print headings\n"), out);
fputs(_(" -o, --output <list> output columns\n"), out);
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);
Expand Down Expand Up @@ -2167,7 +2167,7 @@ static const char *inet46_subexpr = INET_SUBEXP_BEGIN

int main(int argc, char *argv[])
{
int c;
int c, collist = 0;
size_t i;
char *outarg = NULL;
char *filter_expr = NULL;
Expand Down Expand Up @@ -2286,11 +2286,16 @@ int main(int argc, char *argv[])
case 'h':
usage();
case 'H':
list_colunms("lsfd-columns", stdout, ctl.raw, ctl.json);
collist = 1;
break;
default:
errtryhelp(EXIT_FAILURE);
}
}

if (collist)
list_colunms("lsfd-columns", stdout, ctl.raw, ctl.json); /* print and exit */

if (argv[optind])
errtryhelp(EXIT_FAILURE);

Expand Down

0 comments on commit f5a81ca

Please sign in to comment.