diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2001-03-15 03:09:48 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2001-03-15 03:09:48 +0000 |
| commit | 187e87911cad6c83a03a82b406eabeea0e1ca604 (patch) | |
| tree | ee83d46202dfcf3dbbaf9b49848d12bd9095cd09 /usr.sbin/getextattr | |
| parent | bf6afea751fc670d3b82454c1811d9ff2b6ef782 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/getextattr')
| -rw-r--r-- | usr.sbin/getextattr/Makefile | 1 | ||||
| -rw-r--r-- | usr.sbin/getextattr/getextattr.8 | 9 | ||||
| -rw-r--r-- | usr.sbin/getextattr/getextattr.c | 23 |
3 files changed, 23 insertions, 10 deletions
diff --git a/usr.sbin/getextattr/Makefile b/usr.sbin/getextattr/Makefile index a9747fc1a974..45560a9c2581 100644 --- a/usr.sbin/getextattr/Makefile +++ b/usr.sbin/getextattr/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ PROG= getextattr SRCS= getextattr.c +LDADD= ${LIBUTIL} CFLAGS+= -Wall MAN8= getextattr.8 diff --git a/usr.sbin/getextattr/getextattr.8 b/usr.sbin/getextattr/getextattr.8 index 75881d9db60f..306c23c4e177 100644 --- a/usr.sbin/getextattr/getextattr.8 +++ b/usr.sbin/getextattr/getextattr.8 @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2000 Robert N. M. Watson +.\" Copyright (c) 2000, 2001 Robert N. M. Watson .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -34,6 +34,7 @@ .Sh SYNOPSIS .Nm .Op Fl ls +.Ar namespace .Ar attrname .Ar filename ... .Sh DESCRIPTION @@ -41,6 +42,10 @@ is a user tool to retrieve a named extended attribute on a file or directory. The +.Ar namespace +argument should be the namespace of the attribute to retrieve: legal +values are "user" and "system". +The .Ar attrname argument should be the name of the attribute, and .Ar filename @@ -70,7 +75,7 @@ to succeed, the attribute service must be available on the file system, and the attribute must of defined for the file queried. .Sh EXAMPLES .Bd -literal -offset indent -# getextattr md5 /kernel +# getextattr system md5 /kernel /kernel: 61 61 33 62 39 39 66 65 31 35 35 32 31 62 65 32 62 36 38 36 62 31 66 39 63 64 33 39 35 36 36 31 diff --git a/usr.sbin/getextattr/getextattr.c b/usr.sbin/getextattr/getextattr.c index 07299d2ea35b..db55b318a7d3 100644 --- a/usr.sbin/getextattr/getextattr.c +++ b/usr.sbin/getextattr/getextattr.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999, 2000 Robert N. M. Watson + * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD$ */ /* * TrustedBSD Project - extended attribute support @@ -32,6 +32,7 @@ #include <sys/uio.h> #include <sys/extattr.h> +#include <libutil.h> #include <stdio.h> #include <unistd.h> #include <vis.h> @@ -40,7 +41,8 @@ void usage(void) { - fprintf(stderr, "getextattr [-s] [attrname] [filename ...]\n"); + fprintf(stderr, "getextattr [-s] [namespace] [attrname] " + "[filename ...]\n"); exit(-1); } @@ -56,7 +58,7 @@ main(int argc, char *argv[]) char *attrname; char buf[BUFSIZE]; char visbuf[BUFSIZE*4]; - int error, i, arg_counter; + int error, i, arg_counter, namespace; int ch; int flag_as_string = 0; @@ -78,10 +80,15 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (argc <= 1) + if (argc < 3) usage(); - attrname = argv[0]; + error = extattr_string_to_namespace(argv[0], &namespace); + if (error) { + perror(argv[0]); + return (-1); + } + attrname = argv[1]; argc--; argv++; @@ -89,8 +96,8 @@ main(int argc, char *argv[]) iov_buf.iov_base = buf; iov_buf.iov_len = BUFSIZE; - for (arg_counter = 0; arg_counter < argc; arg_counter++) { - error = extattr_get_file(argv[arg_counter], attrname, + for (arg_counter = 1; arg_counter < argc; arg_counter++) { + error = extattr_get_file(argv[arg_counter], namespace, attrname, &iov_buf, 1); if (error == -1) |
