xref: /titanic_41/usr/src/cmd/bart/lutbl.c (revision 989f28072d20c73ae0955d6a1e3e2fc74831cb39)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include <dirent.h>
29 #include <fnmatch.h>
30 #include "bart.h"
31 
32 
33 struct cmd_keyword {
34 	char    *ck_name;
35 	void    (*ck_func)(void);
36 };
37 
38 static struct attr_keyword attr_keywords[] = {
39 	{ ALL_KEYWORD,	~0 },
40 	{ CONTENTS_KEYWORD,	ATTR_CONTENTS },
41 	{ TYPE_KEYWORD,	ATTR_TYPE },
42 	{ SIZE_KEYWORD,	ATTR_SIZE },
43 	{ MODE_KEYWORD,	ATTR_MODE },
44 	{ ACL_KEYWORD,	ATTR_ACL },
45 	{ UID_KEYWORD,	ATTR_UID },
46 	{ GID_KEYWORD,	ATTR_GID },
47 	{ MTIME_KEYWORD,	ATTR_MTIME },
48 	{ LNMTIME_KEYWORD,	ATTR_LNMTIME },
49 	{ DIRMTIME_KEYWORD,	ATTR_DIRMTIME },
50 	{ DEST_KEYWORD,	ATTR_DEST },
51 	{ DEVNODE_KEYWORD,	ATTR_DEVNODE },
52 	{ ADD_KEYWORD,	ATTR_ADD },
53 	{ DELETE_KEYWORD,	ATTR_DELETE },
54 	{ NULL }
55 };
56 
57 struct attr_keyword *
58 attr_keylookup(char *word)
59 {
60 	struct attr_keyword	*akp;
61 
62 	for (akp = attr_keywords; ; akp++) {
63 		if (akp->ak_name == NULL)
64 			break;
65 		if (strcasecmp(word, akp->ak_name) == 0)
66 			return (akp);
67 	}
68 	return (NULL);
69 }
70