8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright (c) 2011, Joyent, Inc. All rights reserved.
29 */
30
31 /*
32 * svcprop - report service configuration properties
33 */
34
35 #include <locale.h>
36 #include <libintl.h>
37 #include <libscf.h>
38 #include <libscf_priv.h>
39 #include <libuutil.h>
40 #include <stddef.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <unistd.h>
44 #include <strings.h>
45 #include <assert.h>
46 #include <zone.h>
47
48 #ifndef TEXT_DOMAIN
613
614 prop = scf_property_create(hndl);
615 if (prop == NULL)
616 scfdie();
617
618 for (spn = uu_list_first(prop_list);
619 spn != NULL;
620 spn = uu_list_next(prop_list, spn)) {
621 if (spn->spn_comp2 != NULL) {
622 char *buf;
623
624 buf = safe_malloc(max_scf_fmri_length + 1);
625 if (scf_pg_to_fmri(pg, buf, max_scf_fmri_length + 1) ==
626 -1)
627 scfdie();
628
629 uu_xdie(UU_EXIT_USAGE, gettext("-p argument `%s/%s' "
630 "has too many components for property "
631 "group `%s'.\n"), spn->spn_comp1, spn->spn_comp2,
632 buf);
633
634 free(buf);
635 }
636
637 if (scf_pg_get_property(pg, spn->spn_comp1, prop) == 0) {
638 if (!quiet)
639 display_prop(pg, prop);
640 continue;
641 }
642
643 if (scf_error() != SCF_ERROR_NOT_FOUND)
644 scfdie();
645
646 if (PRINT_NOPROP_ERRORS) {
647 char *buf;
648
649 buf = safe_malloc(max_scf_fmri_length + 1);
650 if (scf_pg_to_fmri(pg, buf, max_scf_fmri_length + 1) ==
651 -1)
652 scfdie();
653
654 uu_warn(gettext("Couldn't find property `%s' in "
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2019 Joyent, Inc.
29 */
30
31 /*
32 * svcprop - report service configuration properties
33 */
34
35 #include <locale.h>
36 #include <libintl.h>
37 #include <libscf.h>
38 #include <libscf_priv.h>
39 #include <libuutil.h>
40 #include <stddef.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <unistd.h>
44 #include <strings.h>
45 #include <assert.h>
46 #include <zone.h>
47
48 #ifndef TEXT_DOMAIN
613
614 prop = scf_property_create(hndl);
615 if (prop == NULL)
616 scfdie();
617
618 for (spn = uu_list_first(prop_list);
619 spn != NULL;
620 spn = uu_list_next(prop_list, spn)) {
621 if (spn->spn_comp2 != NULL) {
622 char *buf;
623
624 buf = safe_malloc(max_scf_fmri_length + 1);
625 if (scf_pg_to_fmri(pg, buf, max_scf_fmri_length + 1) ==
626 -1)
627 scfdie();
628
629 uu_xdie(UU_EXIT_USAGE, gettext("-p argument `%s/%s' "
630 "has too many components for property "
631 "group `%s'.\n"), spn->spn_comp1, spn->spn_comp2,
632 buf);
633 }
634
635 if (scf_pg_get_property(pg, spn->spn_comp1, prop) == 0) {
636 if (!quiet)
637 display_prop(pg, prop);
638 continue;
639 }
640
641 if (scf_error() != SCF_ERROR_NOT_FOUND)
642 scfdie();
643
644 if (PRINT_NOPROP_ERRORS) {
645 char *buf;
646
647 buf = safe_malloc(max_scf_fmri_length + 1);
648 if (scf_pg_to_fmri(pg, buf, max_scf_fmri_length + 1) ==
649 -1)
650 scfdie();
651
652 uu_warn(gettext("Couldn't find property `%s' in "
|