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 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <string.h>
32 #include <locale.h>
33 #include <unistd.h>
34 #include "getent.h"
35
36 static const char *cmdname;
37
38 struct table {
39 char *name; /* name of the table */
40 int (*func)(const char **); /* function to do the lookup */
41 };
42
43 static struct table t[] = {
44 { "passwd", dogetpw },
45 { "group", dogetgr },
46 { "hosts", dogethost },
47 { "ipnodes", dogetipnodes },
48 { "services", dogetserv },
49 { "protocols", dogetproto },
50 { "ethers", dogetethers },
51 { "networks", dogetnet },
52 { "netmasks", dogetnetmask },
53 { "project", dogetproject },
54 { NULL, NULL }
55 };
56
57 static void usage(void) __NORETURN;
58
59 int
60 main(int argc, const char **argv)
61 {
62 struct table *p;
63
64 (void) setlocale(LC_ALL, "");
|
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 (c) 2014 Gary Mills
24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <string.h>
31 #include <locale.h>
32 #include <unistd.h>
33 #include "getent.h"
34
35 static const char *cmdname;
36
37 struct table {
38 char *name; /* name of the table */
39 int (*func)(const char **); /* function to do the lookup */
40 };
41
42 static struct table t[] = {
43 { "passwd", dogetpw },
44 { "shadow", dogetsp },
45 { "group", dogetgr },
46 { "hosts", dogethost },
47 { "ipnodes", dogetipnodes },
48 { "services", dogetserv },
49 { "protocols", dogetproto },
50 { "ethers", dogetethers },
51 { "networks", dogetnet },
52 { "netmasks", dogetnetmask },
53 { "project", dogetproject },
54 { NULL, NULL }
55 };
56
57 static void usage(void) __NORETURN;
58
59 int
60 main(int argc, const char **argv)
61 {
62 struct table *p;
63
64 (void) setlocale(LC_ALL, "");
|