PERFORCE change 146218 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Tue Jul 29 17:48:06 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146218
Change 146218 by trasz at trasz_traszkan on 2008/07/29 17:47:44
Really add "-n" option to getfacl(1).
Affected files ...
.. //depot/projects/soc2008/trasz_nfs4acl/bin/getfacl/getfacl.c#8 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/sys/acl.h#14 edit
Differences ...
==== //depot/projects/soc2008/trasz_nfs4acl/bin/getfacl/getfacl.c#8 (text+ko) ====
@@ -54,7 +54,7 @@
usage(void)
{
- fprintf(stderr, "getfacl [-dhqv] [file ...]\n");
+ fprintf(stderr, "getfacl [-dhnqv] [file ...]\n");
}
static char *
@@ -175,12 +175,12 @@
}
static int
-print_acl(char *path, acl_type_t type, int hflag, int qflag, int vflag)
+print_acl(char *path, acl_type_t type, int hflag, int nflag, int qflag, int vflag)
{
struct stat sb;
acl_t acl;
char *acl_text;
- int error;
+ int error, flags = 0;
if (hflag)
error = lstat(path, &sb);
@@ -223,9 +223,12 @@
}
if (vflag)
- acl_text = acl_to_text_np(acl, 0, ACL_TEXT_VERBOSE);
- else
- acl_text = acl_to_text_np(acl, 0, 0);
+ flags |= ACL_TEXT_VERBOSE;
+
+ if (nflag)
+ flags |= ACL_TEXT_NUMERIC_IDS;
+
+ acl_text = acl_to_text_np(acl, 0, flags);
if (!acl_text) {
warn("%s", path);
return(-1);
@@ -240,7 +243,7 @@
}
static int
-print_acl_from_stdin(acl_type_t type, int hflag, int qflag, int vflag)
+print_acl_from_stdin(acl_type_t type, int hflag, int nflag, int qflag, int vflag)
{
char *p, pathname[PATH_MAX];
int carried_error = 0;
@@ -248,7 +251,7 @@
while (fgets(pathname, (int)sizeof(pathname), stdin)) {
if ((p = strchr(pathname, '\n')) != NULL)
*p = '\0';
- if (print_acl(pathname, type, hflag, qflag, vflag) == -1) {
+ if (print_acl(pathname, type, hflag, nflag, qflag, vflag) == -1) {
carried_error = -1;
}
}
@@ -262,12 +265,13 @@
acl_type_t type = ACL_TYPE_ACCESS;
int carried_error = 0;
int ch, error, i;
- int hflag, qflag, vflag;
+ int hflag, qflag, nflag, vflag;
hflag = 0;
qflag = 0;
+ nflag = 0;
vflag = 0;
- while ((ch = getopt(argc, argv, "dhqv")) != -1)
+ while ((ch = getopt(argc, argv, "dhnqv")) != -1)
switch(ch) {
case 'd':
type = ACL_TYPE_DEFAULT;
@@ -275,6 +279,9 @@
case 'h':
hflag = 1;
break;
+ case 'n':
+ nflag = 1;
+ break;
case 'q':
qflag = 1;
break;
@@ -289,17 +296,19 @@
argv += optind;
if (argc == 0) {
- error = print_acl_from_stdin(type, hflag, qflag, vflag);
+ error = print_acl_from_stdin(type, hflag, nflag, qflag, vflag);
return(error ? 1 : 0);
}
for (i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-")) {
- error = print_acl_from_stdin(type, hflag, qflag, vflag);
+ error = print_acl_from_stdin(type, hflag, nflag, qflag,
+ vflag);
if (error == -1)
carried_error = -1;
} else {
- error = print_acl(argv[i], type, hflag, qflag, vflag);
+ error = print_acl(argv[i], type, hflag, nflag, qflag,
+ vflag);
if (error == -1)
carried_error = -1;
}
==== //depot/projects/soc2008/trasz_nfs4acl/sys/sys/acl.h#14 (text+ko) ====
@@ -228,7 +228,8 @@
/*
* Possible values for _flags parameter in acl_to_text_np(3).
*/
-#define ACL_TEXT_VERBOSE 1
+#define ACL_TEXT_VERBOSE 0x01
+#define ACL_TEXT_NUMERIC_IDS 0x02
#ifdef _KERNEL
More information about the p4-projects
mailing list