/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* Contains
* listdgrp Writes on the standard output stream a list of devices
* that belong to the specified device group
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <devmgmt.h>
#include <devtab.h>
#include <fmtmsg.h>
/*
* Local Definitions
* TRUE Boolean TRUE value (if not already defined)
* FALSE Boolean not-TRUE value (if not already defined)
*/
#ifndef TRUE
#endif
#ifndef FALSE
#define FALSE (0)
#endif
/*
* Messages:
* M_USAGE Command usage error
* M_NODGRP Device group not found
* M_DGRPTAB Device-group table not found
* M_ERROR Internal error
*/
/*
* Exit codes
* EX_OK Exiting okay, no problem
* EX_ERROR Some problem with the command
* EX_NODGRPTAB Device group table could not be opened
* EX_NODGROUP Device group couldn't be found
*/
#define EX_OK 0
/*
* Macros
* stdmsg(r,l,s,t) Write a message in standard format
* r Recoverability flag
* l Label
* s Severity
* t Tag
*/
/*
* Global Variables
*/
/*
* Static Variables
*
* lbl Buffer for the message label
*/
/*
* listdgrp <dgroup>
*
* List the devices that belong to the device group <dgroup>.
* It writes the list to the standard output file (stdout)
* in a new-line list.
*
* Returns:
* 0 Ok
* 1 Syntax or other error
* 2 Device table can't be opened
* 3 Device group doesn't exist
*/
int
{
/*
* Automatic data
*/
/* Build the message label from the (simple) command name */
/* Only write the text component of a message (this goes away in SVR4.1) */
(void) putenv("MSGVERB=text");
/*
* Parse the command line:
* - Options
* - Device group to display
*/
/*
* Extract options from the command line
*/
/* Initializations */
/*
* Loop until all of the command line options have been parced
* (and don't let getopt() write messages)
*/
/* Default case -- command usage error */
case '?':
default:
break;
}
/* Check the argument count and extract the device group name */
/* If there is a usage error, write an appropriate message and exit */
if (usageerr) {
}
/* Open the device-group file (if there's one to be opened) */
if (!_opendgrptab("r")) {
if (dgrptab = _dgrptabpath()) {
} else {
}
}
/*
* Get the list of devices associated with the device group.
* If we get one, write the list to the standard output.
* Otherwise, write an appropriate error message
*/
}
else {
}
else {
}
}
/* Finished (now wasn't that special?) */
return(exitcode);
}