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
This commit is contained in:
@@ -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.
|
||||
|
||||
+11
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user