bookmarkctl: xattr-get: rename -m option to -a

This commit is contained in:
CismonX 2025-06-06 19:41:09 +08:00
parent b5fa6960ef
commit eb426f9fc4
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
3 changed files with 9 additions and 9 deletions

View file

@ -32,7 +32,7 @@ bookmarkctl - manage a mounted BookmarkFS filesystem
.B bookmarkctl .B bookmarkctl
.B xattr\-get .B xattr\-get
.RI [ options ] .RI [ options ]
.B \-m .B \-a
.IR attrname "... " pathname .IR attrname "... " pathname
.PP .PP
.B bookmarkctl .B bookmarkctl
@ -145,7 +145,7 @@ Treat the value as binary, and print it verbatim.
.IP .IP
If this option is not provided, non-printable characters are replaced with '?'. If this option is not provided, non-printable characters are replaced with '?'.
.TP .TP
.B \-m .B \-a
Switch to multi-attrname mode, where multiple extended attribute names Switch to multi-attrname mode, where multiple extended attribute names
can be specified instead of multiple files. can be specified instead of multiple files.
.IP .IP

View file

@ -630,7 +630,7 @@ Displays extended attribute values.
@example @example
bookmarkctl xattr-get [@var{options}] @var{attrname} @var{pathname}... bookmarkctl xattr-get [@var{options}] @var{attrname} @var{pathname}...
bookmarkctl xattr-get [@var{options}] -m @var{attrname}... @var{pathname} bookmarkctl xattr-get [@var{options}] -a @var{attrname}... @var{pathname}
@end example @end example
@table @var @table @var
@ -650,7 +650,7 @@ Treat the value as binary, and print it verbatim.
If this option is not provided, non-printable characters are replaced with If this option is not provided, non-printable characters are replaced with
@samp{?}. @samp{?}.
@item -m @item -a
Switch to multi-attrname mode, where multiple extended attribute names Switch to multi-attrname mode, where multiple extended attribute names
can be specified instead of multiple files. can be specified instead of multiple files.

View file

@ -48,7 +48,7 @@ struct xattr_get_ctx {
char eol; char eol;
unsigned binary : 1; unsigned binary : 1;
unsigned multi_name : 1; unsigned multi_attr : 1;
}; };
// Forward declaration start // Forward declaration start
@ -249,8 +249,8 @@ subcmd_xattr_get (
ctx.binary = 1; ctx.binary = 1;
break; break;
} }
OPT_OPT('m') { OPT_OPT('a') {
ctx.multi_name = 1; ctx.multi_attr = 1;
break; break;
} }
OPT_OPT('q') { OPT_OPT('q') {
@ -269,7 +269,7 @@ subcmd_xattr_get (
return -1; return -1;
} }
if (ctx.multi_name) { if (ctx.multi_attr) {
return xattr_get_one(argv[argc - 1], argv, argc - 1, &ctx); return xattr_get_one(argv[argc - 1], argv, argc - 1, &ctx);
} }
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
@ -416,7 +416,7 @@ xattr_get_one (
for (int i = 0; i < names_cnt; ++i) { for (int i = 0; i < names_cnt; ++i) {
char const *name = names[i]; char const *name = names[i];
ctx->prefix = ctx->multi_name ? name : path; ctx->prefix = ctx->multi_attr ? name : path;
status = bookmarkfs_xattr_get(fd, name, xattr_get_cb, ctx); status = bookmarkfs_xattr_get(fd, name, xattr_get_cb, ctx);
if (status < 0) { if (status < 0) {
goto end; goto end;