/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
typedef struct {
char *manufacturer;
char *model;
char *description;
char *class;
int
{
/* open the device */
return (fd);
/* get the 1284 device id */
/* close(fd); */
if (rc < 0)
return (rc);
/* parse the 1284 device id string */
continue;
continue;
if ((strcasecmp(t, "MFG") == 0) ||
(strcasecmp(t, "MANUFACTURER") == 0))
else if ((strcasecmp(t, "MDL") == 0) ||
(strcasecmp(t, "MODEL") == 0))
else if ((strcasecmp(t, "DES") == 0) ||
(strcasecmp(t, "DESCRIPTION") == 0))
else if ((strcasecmp(t, "CLS") == 0) ||
(strcasecmp(t, "CLASS") == 0))
else if ((strcasecmp(t, "CMD") == 0) ||
(strcasecmp(t, "COMMAND SET") == 0)) {
/* this should be more dynamic, I got lazy */
int i = 0;
((v != NULL) && (i < COMMAND_SET_MAX));
}
}
return (0);
}
static void
{
char *program;
else
program++;
}
int
{
int rc;
class = 0;
switch (rc) {
case 'a':
manufacturer++;
model++;
description++;
command_set++;
class++;
break;
case 'M':
manufacturer++;
break;
case 'm':
model++;
break;
case 'd':
description++;
break;
case 'C':
command_set++;
break;
case 'c':
class++;
break;
default:
exit(1);
}
exit(1);
}
if (rc == 0) {
if (manufacturer != 0)
printf("\tManufacturer: %s\n",
if (model != 0)
printf("\tModel: %s\n",
if (description != 0)
printf("\tDescription: %s\n",
if (class != 0)
printf("\tClass: %s\n",
if (command_set != 0) {
int i;
printf("\tCommand set:\n");
printf("\t\tcmd[%d]: %s\n", i,
info.command_set[i]);
}
} else
}
return (rc);
}