nfs4-acl-tools/nfs4-acl-tools-0.3.5-c-opti...

77 lines
2.8 KiB
Diff

diff -up nfs4-acl-tools-0.3.5/man/man1/nfs4_getfacl.1.orig nfs4-acl-tools-0.3.5/man/man1/nfs4_getfacl.1
--- nfs4-acl-tools-0.3.5/man/man1/nfs4_getfacl.1.orig 2018-08-21 12:07:51.000000000 -0400
+++ nfs4-acl-tools-0.3.5/man/man1/nfs4_getfacl.1 2019-07-17 13:21:14.920774997 -0400
@@ -28,6 +28,12 @@ flag is specified,
.B nfs4_getfacl
will list the NFSv4 ACLs of all files and directories recursively.
+If the
+.BR -c / --omit-header
+flag is specified,
+.B nfs4_getfacl
+will not display the comment header (Do not print filename).
+
The output format for an NFSv4 file ACL, e.g., is:
.RS
.nf
diff -up nfs4-acl-tools-0.3.5/nfs4_getfacl/nfs4_getfacl.c.orig nfs4-acl-tools-0.3.5/nfs4_getfacl/nfs4_getfacl.c
--- nfs4-acl-tools-0.3.5/nfs4_getfacl/nfs4_getfacl.c.orig 2019-07-17 13:23:47.030033107 -0400
+++ nfs4-acl-tools-0.3.5/nfs4_getfacl/nfs4_getfacl.c 2019-07-17 13:23:12.818750147 -0400
@@ -46,6 +46,7 @@ static void usage(int);
static void more_help();
static char *execname;
static void print_acl_from_path();
+static int ignore_comment = 0;
static int recursive(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftwbuf)
{
@@ -57,6 +58,7 @@ static struct option long_options[] = {
{"more-help", 0, 0, 'H' },
{"help", 0, 0, 'h' },
{"recursive", 0, 0, 'R' },
+ {"omit-header", 0, 0, 'c'},
{ NULL, 0, 0, 0, },
};
@@ -73,7 +75,7 @@ int main(int argc, char **argv)
goto out;
}
- while ((opt = getopt_long(argc, argv, "HR?h", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "HR?hc", long_options, NULL)) != -1) {
switch(opt) {
case 'H':
more_help();
@@ -83,7 +85,9 @@ int main(int argc, char **argv)
case 'R':
do_recursive = 1;
break;
-
+ case 'c':
+ ignore_comment = 1;
+ break;
default:
usage(1);
res = 0;
@@ -115,8 +119,10 @@ static void print_acl_from_path(const ch
struct nfs4_acl *acl;
acl = nfs4_acl_for_path(fpath);
if (acl != NULL) {
- printf("\n# file: %s\n", fpath);
+ if (ignore_comment == 0)
+ printf("# file: %s\n", fpath);
nfs4_print_acl(stdout, acl);
+ printf("\n");
nfs4_free_acl(acl);
}
}
@@ -125,7 +131,7 @@ static void usage(int label)
{
if (label)
fprintf(stderr, "%s %s -- get NFSv4 file or directory access control lists.\n", execname, VERSION);
- fprintf(stderr, "Usage: %s [-R] file ...\n -H, --more-help\tdisplay ACL format information\n -?, -h, --help\tdisplay this help text\n -R --recursive\trecurse into subdirectories\n", execname);
+ fprintf(stderr, "Usage: %s [-R] file ...\n -H, --more-help\tdisplay ACL format information\n -?, -h, --help\tdisplay this help text\n -R --recursive\trecurse into subdirectories\n -c, --omit-header\tDo not display the comment header (Do not print filename)\n", execname);
}
static void more_help()