Home | History | Annotate | Download | only in prtdiag
      1    0  stevel /*
      2    0  stevel  * CDDL HEADER START
      3    0  stevel  *
      4    0  stevel  * The contents of this file are subject to the terms of the
      5    0  stevel  * Common Development and Distribution License, Version 1.0 only
      6    0  stevel  * (the "License").  You may not use this file except in compliance
      7    0  stevel  * with the License.
      8    0  stevel  *
      9    0  stevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10    0  stevel  * or http://www.opensolaris.org/os/licensing.
     11    0  stevel  * See the License for the specific language governing permissions
     12    0  stevel  * and limitations under the License.
     13    0  stevel  *
     14    0  stevel  * When distributing Covered Code, include this CDDL HEADER in each
     15    0  stevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16    0  stevel  * If applicable, add the following below this CDDL HEADER, with the
     17    0  stevel  * fields enclosed by brackets "[]" replaced with your own identifying
     18    0  stevel  * information: Portions Copyright [yyyy] [name of copyright owner]
     19    0  stevel  *
     20    0  stevel  * CDDL HEADER END
     21    0  stevel  */
     22  437     mws 
     23    0  stevel /*
     24  437     mws  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
     25    0  stevel  * Use is subject to license terms.
     26    0  stevel  */
     27    0  stevel 
     28    0  stevel /*
     29    0  stevel  * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
     30    0  stevel  * All rights reserved.
     31    0  stevel  */
     32    0  stevel 
     33  437     mws #pragma ident	"%Z%%M%	%I%	%E% SMI"
     34    0  stevel 
     35  437     mws #include <stdio.h>
     36  437     mws #include <locale.h>
     37  437     mws #include <stdlib.h>
     38  437     mws #include <libintl.h>
     39  437     mws #include <string.h>
     40  437     mws #include <unistd.h>
     41  437     mws #include <zone.h>
     42    0  stevel 
     43  437     mws extern int do_prominfo(int, char *, int, int);
     44    0  stevel 
     45  437     mws static char *
     46  437     mws setprogname(char *name)
     47  437     mws {
     48  437     mws 	char	*p;
     49    0  stevel 
     50  437     mws 	if (p = strrchr(name, '/'))
     51  437     mws 		return (p + 1);
     52  437     mws 	else
     53  437     mws 		return (name);
     54  437     mws }
     55  437     mws 
     56  437     mws int
     57    0  stevel main(int argc, char *argv[])
     58    0  stevel {
     59    0  stevel 	int	c;
     60    0  stevel 	int	syserrlog = 0;
     61  437     mws 	char	*progname = setprogname(argv[0]);
     62    0  stevel 	int	print_flag = 1;
     63    0  stevel 	int	logging = 0;
     64    0  stevel 
     65    0  stevel 	(void) setlocale(LC_ALL, "");
     66    0  stevel 	(void) textdomain(TEXT_DOMAIN);
     67    0  stevel 
     68    0  stevel 	if (getzoneid() != GLOBAL_ZONEID) {
     69    0  stevel 		(void) fprintf(stderr,
     70    0  stevel 		    gettext("%s can only be run in the global zone\n"),
     71    0  stevel 		    progname);
     72  437     mws 		return (1);
     73    0  stevel 	}
     74  437     mws 
     75    0  stevel 	while ((c = getopt(argc, argv, "vl")) != -1)  {
     76    0  stevel 		switch (c)  {
     77    0  stevel 		case 'v':
     78    0  stevel 			++syserrlog;
     79    0  stevel 			break;
     80    0  stevel 
     81    0  stevel 		case 'l':
     82    0  stevel 			logging = 1;
     83    0  stevel 			break;
     84    0  stevel 
     85    0  stevel 		default:
     86  437     mws 			(void) fprintf(stderr, "Usage: %s [-lv]\n", progname);
     87  437     mws 			return (1);
     88    0  stevel 		}
     89    0  stevel 	}
     90    0  stevel 
     91  437     mws 	return (do_prominfo(syserrlog, progname, logging, print_flag));
     92    0  stevel }
     93