lsipc: add -y,--shell
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
152c17aa46
commit
eba05f308a
2 changed files with 14 additions and 2 deletions
|
@ -45,7 +45,7 @@ Write information about active semaphore sets.
|
|||
Show creator and owner.
|
||||
|
||||
*-e*, *--export*::
|
||||
Produce output in the form of key="value" pairs. All potentially unsafe value characters are hex-escaped (\x<code>). The key (variable name) will be modified to contain only characters allowed for a shell variable identifiers, for example, USE_PCT instead of USE%.
|
||||
Produce output in the form of key="value" pairs. All potentially unsafe value characters are hex-escaped (\x<code>). See also option *--shell*.
|
||||
|
||||
*-J*, *--json*::
|
||||
Use the JSON output format.
|
||||
|
@ -80,6 +80,9 @@ Display dates in short, full or iso format. The default is short, this time form
|
|||
*-P*, *--numeric-perms*::
|
||||
Print numeric permissions in PERMS column.
|
||||
|
||||
*-y*, *--shell*::
|
||||
The column name will be modified to contain only characters allowed for shell variable identifiers. This is usable, for example, with *--export*. Note that this feature has been automatically enabled for *--export* in version 2.37, but due to compatibility issues, now it's necessary to request this behavior by *--shell*.
|
||||
|
||||
== EXIT STATUS
|
||||
|
||||
0::
|
||||
|
|
|
@ -129,6 +129,7 @@ struct lsipc_control {
|
|||
int outmode;
|
||||
unsigned int noheadings : 1, /* don't print header line */
|
||||
notrunc : 1, /* don't truncate columns */
|
||||
shellvar : 1, /* use shell compatible colum names */
|
||||
bytes : 1, /* SIZE in bytes */
|
||||
numperms : 1, /* numeric permissions */
|
||||
time_mode : 2;
|
||||
|
@ -315,6 +316,8 @@ static void __attribute__((__noreturn__)) usage(void)
|
|||
fputs(_(" -P, --numeric-perms print numeric permissions (PERMS column)\n"), out);
|
||||
fputs(_(" -r, --raw display in raw mode\n"), out);
|
||||
fputs(_(" -t, --time show attach, detach and change times\n"), out);
|
||||
fputs(_(" -y, --shell use column names to be usable as shell variable identifiers\n"), out);
|
||||
|
||||
|
||||
fputs(USAGE_SEPARATOR, out);
|
||||
printf(USAGE_HELP_OPTIONS(26));
|
||||
|
@ -352,6 +355,8 @@ static struct libscols_table *new_table(struct lsipc_control *ctl)
|
|||
|
||||
if (ctl->noheadings)
|
||||
scols_table_enable_noheadings(table, 1);
|
||||
if (ctl->shellvar)
|
||||
scols_table_enable_shellvar(table, 1);
|
||||
|
||||
switch(ctl->outmode) {
|
||||
case OUT_NEWLINE:
|
||||
|
@ -1132,6 +1137,7 @@ int main(int argc, char *argv[])
|
|||
{ "time", no_argument, NULL, 't' },
|
||||
{ "time-format", required_argument, NULL, OPT_TIME_FMT },
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ "shell", no_argument, NULL, 'y' },
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
|
@ -1153,7 +1159,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
scols_init_debug(0);
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "bceghi:Jlmno:PqrstV", longopts, NULL)) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "bceghi:Jlmno:PqrstVy", longopts, NULL)) != -1) {
|
||||
|
||||
err_exclusive_options(opt, longopts, excl, excl_st);
|
||||
|
||||
|
@ -1242,6 +1248,9 @@ int main(int argc, char *argv[])
|
|||
case 'c':
|
||||
show_creat = 1;
|
||||
break;
|
||||
case 'y':
|
||||
ctl->shellvar = 1;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue