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
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.
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]
23 * Copyright (c) 2018 Peter Tribble.
24 * Copyright (c) 2014 Gary Mills
25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
36 static const char *cmdname
;
39 char *name
; /* name of the table */
40 int (*func
)(const char **); /* function to do the lookup */
43 static struct table t
[] = {
44 { "passwd", dogetpw
},
45 { "shadow", dogetsp
},
47 { "hosts", dogethost
},
48 { "ipnodes", dogetipnodes
},
49 { "services", dogetserv
},
50 { "protocols", dogetproto
},
51 { "ethers", dogetethers
},
52 { "networks", dogetnet
},
53 { "netmasks", dogetnetmask
},
54 { "project", dogetproject
},
55 { "auth_attr", dogetauthattr
},
56 { "exec_attr", dogetexecattr
},
57 { "prof_attr", dogetprofattr
},
58 { "user_attr", dogetuserattr
},
62 static void usage(void) __NORETURN
;
65 main(int argc
, const char **argv
)
69 (void) setlocale(LC_ALL
, "");
71 #if !defined(TEXT_DOMAIN)
72 #define TEXT_DOMAIN "SYS_TEXT"
75 (void) textdomain(TEXT_DOMAIN
);
82 for (p
= t
; p
->name
!= NULL
; p
++) {
83 if (strcmp(argv
[1], p
->name
) == 0) {
86 rc
= (*p
->func
)(&argv
[2]);
89 (void) fprintf(stderr
,
90 gettext("Syntax error\n"));
92 case EXC_ENUM_NOT_SUPPORTED
:
93 (void) fprintf(stderr
,
94 gettext("Enumeration not supported on %s\n"), argv
[1]);
96 case EXC_NAME_NOT_FOUND
:
102 (void) fprintf(stderr
, gettext("Unknown database: %s\n"), argv
[1]);
110 (void) fprintf(stderr
,
111 gettext("usage: %s database [ key ... ]\n"), cmdname
);