git: ec8e79c4e4cf - main - getfacl: add some long options for Linux compatibility
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Apr 2025 03:58:05 UTC
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ec8e79c4e4cfb786fdb7eb00bea2ad32660bf878 commit ec8e79c4e4cfb786fdb7eb00bea2ad32660bf878 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2025-04-21 03:57:44 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2025-04-21 03:57:44 +0000 getfacl: add some long options for Linux compatibility Only three of our options have compatible looking long options, w.r.t. the commonly provided getfacl(1) on Linux systems. Of particular interest is --omit-header, which is -c on !FreeBSD and -q on FreeBSD. Reviewed by: imp, markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D40602 --- bin/getfacl/getfacl.1 | 8 ++++---- bin/getfacl/getfacl.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bin/getfacl/getfacl.1 b/bin/getfacl/getfacl.1 index f8ff3df432a1..b2b6294c46de 100644 --- a/bin/getfacl/getfacl.1 +++ b/bin/getfacl/getfacl.1 @@ -28,7 +28,7 @@ .\" Developed by the TrustedBSD Project. .\" Support for POSIX.1e access control lists. .\" -.Dd September 4, 2009 +.Dd June 19, 2023 .Dt GETFACL 1 .Os .Sh NAME @@ -54,7 +54,7 @@ an ACL containing only the required ACL entries. .Pp The following option is available: .Bl -tag -width indent -.It Fl d +.It Fl d , Fl -default The operation applies to the default ACL of a directory instead of the access ACL. An error is generated if a default ACL cannot be associated with @@ -67,11 +67,11 @@ the symbolic link itself rather than following the link. For NFSv4 ACLs, append numerical ID at the end of each entry containing user or group name. Ignored for POSIX.1e ACLs. -.It Fl n +.It Fl n , Fl -numeric Display user and group IDs numerically rather than converting to a user or group name. Ignored for POSIX.1e ACLs. -.It Fl q +.It Fl q , Fl -omit-header Do not write commented information about file name and ownership. This is useful when dealing with filenames with unprintable characters. diff --git a/bin/getfacl/getfacl.c b/bin/getfacl/getfacl.c index 3ac9e61555de..2b98f923d618 100644 --- a/bin/getfacl/getfacl.c +++ b/bin/getfacl/getfacl.c @@ -37,6 +37,7 @@ #include <err.h> #include <errno.h> +#include <getopt.h> #include <grp.h> #include <pwd.h> #include <stdio.h> @@ -46,6 +47,14 @@ static int more_than_one = 0; +static const struct option long_options[] = +{ + { "default", no_argument, NULL, 'd' }, + { "numeric", no_argument, NULL, 'n' }, + { "omit-header", no_argument, NULL, 'q' }, + { NULL, no_argument, NULL, 0 }, +}; + static void usage(void) { @@ -197,7 +206,8 @@ main(int argc, char *argv[]) qflag = 0; nflag = 0; vflag = 0; - while ((ch = getopt(argc, argv, "dhinqv")) != -1) + while ((ch = getopt_long(argc, argv, "+dhinqv", long_options, + NULL)) != -1) switch(ch) { case 'd': type = ACL_TYPE_DEFAULT;