devprop.c revision b13c8383ad6f847486face2fe8df9f0f50f068ed
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
*/
#include <stdio.h>
#include <unistd.h>
#include <strings.h>
#include <libdevinfo.h>
static void
usage(void)
{
"Usage: devprop [-n device-path] "
"[-vq] [-{b|i|l|s}] [property [...]]\n");
}
int
{
int c;
int type = DI_PROP_TYPE_UNKNOWN;
char *path = "/";
int *val_i;
int n;
extern char *optarg;
extern int optind;
case ch: \
break
case ch: \
if (type != DI_PROP_TYPE_UNKNOWN) { \
usage(); \
return (1); \
} \
break
switch (c) {
case 'n':
break;
case ':':
usage();
return (1);
}
}
if (error) {
usage();
return (1);
}
/* default to strings */
if (type == DI_PROP_TYPE_UNKNOWN)
/*
* It's convenient to use the filesystem as a source of device
* node paths. In that case, the path will be prefixed with
* "/devices", which we strip off here as di_init() expects
* just the path to the node.
*/
/* cut off minor name */
*ptr = '\0';
}
perror("di_init");
return (1);
}
/* Careful with that axe, Eugene... */
case (typ): \
n = func(DDI_DEV_T_ANY, \
while (n > 0) { \
incr; \
n--; \
if (n > 0) \
} \
(void) printf("\n"); \
break
if (verbose)
switch (type) {
}
optind++;
}
return (0);
}