diff options
| author | Karel Zak <kzak@redhat.com> | 2025-10-14 10:38:07 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2025-10-14 10:38:07 +0200 |
| commit | c97ca5ec1ca964c81378a8ac85aa9b117b117b09 (patch) | |
| tree | b516538b4ca7cf2be1d52db7b5389321b82a1940 | |
| parent | 3610933be25b0a13a2b4409056dc58fb9bf063d8 (diff) | |
| parent | 92b82b9a0f2de981ff84097b9fe4be912f16218c (diff) | |
| download | util-linux-c97ca5ec1ca964c81378a8ac85aa9b117b117b09.tar.gz | |
Merge branch 'feat/add_usage_list_cols_option_macro' of https://github.com/cgoesche/util-linux-fork
* 'feat/add_usage_list_cols_option_macro' of https://github.com/cgoesche/util-linux-fork:
treewide: consolidate --list-columns option in usage() to USAGE_LIST_COLUMNS_OPTION()
include/c.h: add USAGE_LIST_COLUMNS_OPTION() macro
| -rw-r--r-- | include/c.h | 9 | ||||
| -rw-r--r-- | lsfd-cmd/lsfd.c | 2 | ||||
| -rw-r--r-- | misc-utils/findmnt.c | 2 | ||||
| -rw-r--r-- | misc-utils/lsblk.c | 2 | ||||
| -rw-r--r-- | misc-utils/lslocks.c | 2 | ||||
| -rw-r--r-- | sys-utils/lscpu.c | 2 | ||||
| -rw-r--r-- | sys-utils/lsns.c | 2 |
7 files changed, 13 insertions, 8 deletions
diff --git a/include/c.h b/include/c.h index c4c73ce9df..f7cd08fd8b 100644 --- a/include/c.h +++ b/include/c.h @@ -516,8 +516,13 @@ static inline void __attribute__((__noreturn__)) ul_sig_err(int excode, const ch #define USAGE_DEFAULT_COLUMNS _("\nDefault columns:\n") #define USAGE_SEPARATOR "\n" -#define USAGE_OPTSTR_HELP _("display this help") -#define USAGE_OPTSTR_VERSION _("display version") +#define USAGE_OPTSTR_LIST_COLUMNS _("list the available columns") +#define USAGE_OPTSTR_HELP _("display this help") +#define USAGE_OPTSTR_VERSION _("display version") + +#define USAGE_LIST_COLUMNS_OPTION(marg_dsc) \ + "%-" #marg_dsc "s%s\n" \ + , " -H, --list-columns", USAGE_OPTSTR_LIST_COLUMNS #define USAGE_HELP_OPTIONS(marg_dsc) \ "%-" #marg_dsc "s%s\n" \ diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c index 4596697ad9..335594144d 100644 --- a/lsfd-cmd/lsfd.c +++ b/lsfd-cmd/lsfd.c @@ -2237,7 +2237,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" --_drop-privilege (testing purpose) do setuid(1) just after starting\n"), out); fputs(USAGE_SEPARATOR, out); - fputs(_(" -H, --list-columns list the available columns\n"), out); + fprintf(out, USAGE_LIST_COLUMNS_OPTION(30)); fprintf(out, USAGE_HELP_OPTIONS(30)); fputs(USAGE_DEFAULT_COLUMNS, out); diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 83989c10ec..78511dca7b 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -1593,7 +1593,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(USAGE_SEPARATOR, out); - fputs(_(" -H, --list-columns list the available columns\n"), out); + fprintf(out, USAGE_LIST_COLUMNS_OPTION(24)); fprintf(out, USAGE_HELP_OPTIONS(24)); fprintf(out, USAGE_MAN_TAIL("findmnt(8)")); diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 39a8ca83f4..8f09093b4d 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -2353,7 +2353,7 @@ static void __attribute__((__noreturn__)) usage(void) " methods used to gather data (default: file,udev,blkid)\n"), out); fputs(USAGE_SEPARATOR, out); - fputs(_(" -H, --list-columns list the available columns\n"), out); + fprintf(out, USAGE_LIST_COLUMNS_OPTION(22)); fprintf(out, USAGE_HELP_OPTIONS(22)); fprintf(out, USAGE_MAN_TAIL("lsblk(8)")); diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c index 175b4e7170..42a67fa968 100644 --- a/misc-utils/lslocks.c +++ b/misc-utils/lslocks.c @@ -820,7 +820,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" -u, --notruncate don't truncate text in columns\n"), out); fputs(USAGE_SEPARATOR, out); - fputs(_(" -H, --list-columns list the available columns\n"), out); + fprintf(out, USAGE_LIST_COLUMNS_OPTION(24)); fprintf(out, USAGE_HELP_OPTIONS(24)); fprintf(out, USAGE_MAN_TAIL("lslocks(8)")); diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index f144b1d655..0be6668b22 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -1212,7 +1212,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" --hierarchic[=when] use subsections in summary (auto, never, always)\n"), out); fputs(_(" --output-all print all available columns for -e, -p or -C\n"), out); fputs(USAGE_SEPARATOR, out); - fputs(_(" -H, --list-columns list the available columns\n"), out); + fprintf(out, USAGE_LIST_COLUMNS_OPTION(25)); fprintf(out, USAGE_HELP_OPTIONS(25)); fprintf(out, USAGE_MAN_TAIL("lscpu(1)")); diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c index 14556987c7..2e887e8025 100644 --- a/sys-utils/lsns.c +++ b/sys-utils/lsns.c @@ -1584,7 +1584,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" -T, --tree[=<rel>] use tree format (parent, owner, or process)\n"), out); fputs(USAGE_SEPARATOR, out); - fputs(_(" -H, --list-columns list the available columns\n"), out); + fprintf(out, USAGE_LIST_COLUMNS_OPTION(24)); fprintf(out, USAGE_HELP_OPTIONS(24)); fprintf(out, USAGE_MAN_TAIL("lsns(8)")); |
