17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*23a1cceaSRoger A. Faulkner * Common Development and Distribution License (the "License").
6*23a1cceaSRoger A. Faulkner * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
2184ab085aSmws
227c478bd9Sstevel@tonic-gate /*
23*23a1cceaSRoger A. Faulkner * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
287c478bd9Sstevel@tonic-gate * All rights reserved.
297c478bd9Sstevel@tonic-gate */
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate #include <stdio.h>
327c478bd9Sstevel@tonic-gate #include <locale.h>
337c478bd9Sstevel@tonic-gate #include <stdlib.h>
347c478bd9Sstevel@tonic-gate #include <libintl.h>
357c478bd9Sstevel@tonic-gate #include <string.h>
367c478bd9Sstevel@tonic-gate #include <unistd.h>
377c478bd9Sstevel@tonic-gate #include <zone.h>
387c478bd9Sstevel@tonic-gate
3984ab085aSmws extern int do_prominfo(int, char *, int, int);
407c478bd9Sstevel@tonic-gate
4184ab085aSmws static char *
setpname(char * name)42*23a1cceaSRoger A. Faulkner setpname(char *name)
4384ab085aSmws {
4484ab085aSmws char *p;
4584ab085aSmws
4684ab085aSmws if (p = strrchr(name, '/'))
4784ab085aSmws return (p + 1);
4884ab085aSmws else
4984ab085aSmws return (name);
5084ab085aSmws }
5184ab085aSmws
5284ab085aSmws int
main(int argc,char * argv[])537c478bd9Sstevel@tonic-gate main(int argc, char *argv[])
547c478bd9Sstevel@tonic-gate {
557c478bd9Sstevel@tonic-gate int c;
567c478bd9Sstevel@tonic-gate int syserrlog = 0;
57*23a1cceaSRoger A. Faulkner char *progname = setpname(argv[0]);
587c478bd9Sstevel@tonic-gate int print_flag = 1;
597c478bd9Sstevel@tonic-gate int logging = 0;
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate (void) setlocale(LC_ALL, "");
627c478bd9Sstevel@tonic-gate (void) textdomain(TEXT_DOMAIN);
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate if (getzoneid() != GLOBAL_ZONEID) {
657c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
667c478bd9Sstevel@tonic-gate gettext("%s can only be run in the global zone\n"),
677c478bd9Sstevel@tonic-gate progname);
6884ab085aSmws return (1);
697c478bd9Sstevel@tonic-gate }
7084ab085aSmws
717c478bd9Sstevel@tonic-gate while ((c = getopt(argc, argv, "vl")) != -1) {
727c478bd9Sstevel@tonic-gate switch (c) {
737c478bd9Sstevel@tonic-gate case 'v':
747c478bd9Sstevel@tonic-gate ++syserrlog;
757c478bd9Sstevel@tonic-gate break;
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate case 'l':
787c478bd9Sstevel@tonic-gate logging = 1;
797c478bd9Sstevel@tonic-gate break;
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate default:
8284ab085aSmws (void) fprintf(stderr, "Usage: %s [-lv]\n", progname);
8384ab085aSmws return (1);
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate }
867c478bd9Sstevel@tonic-gate
8784ab085aSmws return (do_prominfo(syserrlog, progname, logging, print_flag));
887c478bd9Sstevel@tonic-gate }
89