xref: /illumos-gate/usr/src/cmd/bart/lutbl.c (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 #include <dirent.h>
27 #include <fnmatch.h>
28 #include "bart.h"
29 
30 
31 struct cmd_keyword {
32 	char    *ck_name;
33 	void    (*ck_func)(void);
34 };
35 
36 static struct attr_keyword attr_keywords[] = {
37 	{ ALL_KEYWORD,	~0 },
38 	{ CONTENTS_KEYWORD,	ATTR_CONTENTS },
39 	{ TYPE_KEYWORD,	ATTR_TYPE },
40 	{ SIZE_KEYWORD,	ATTR_SIZE },
41 	{ MODE_KEYWORD,	ATTR_MODE },
42 	{ ACL_KEYWORD,	ATTR_ACL },
43 	{ UID_KEYWORD,	ATTR_UID },
44 	{ GID_KEYWORD,	ATTR_GID },
45 	{ MTIME_KEYWORD,	ATTR_MTIME },
46 	{ LNMTIME_KEYWORD,	ATTR_LNMTIME },
47 	{ DIRMTIME_KEYWORD,	ATTR_DIRMTIME },
48 	{ DEST_KEYWORD,	ATTR_DEST },
49 	{ DEVNODE_KEYWORD,	ATTR_DEVNODE },
50 	{ ADD_KEYWORD,	ATTR_ADD },
51 	{ DELETE_KEYWORD,	ATTR_DELETE },
52 	{ NULL }
53 };
54 
55 struct attr_keyword *
56 attr_keylookup(char *word)
57 {
58 	struct attr_keyword	*akp;
59 
60 	for (akp = attr_keywords; ; akp++) {
61 		if (akp->ak_name == NULL)
62 			break;
63 		if (strcasecmp(word, akp->ak_name) == 0)
64 			return (akp);
65 	}
66 	return (NULL);
67 }
68