/*
*
* This file is licensed under either the Academic Free License
* version 2.1 or The GNU General Public License version 2.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include <strings.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <libhal.h>
#include <logger.h>
#include "printer.h"
static char *
strip_ws(char *s)
{
if (s != NULL) {
char *p;
/* skip the leading whitespace */
/* drop the trailing whitespace */
p--);
*(++p) = '\0';
}
return (s);
}
int
char **serial_no, char ***command_set)
{
char *s;
if (devid_string == NULL)
return (-1);
/* parse the 1284 device id string */
continue;
continue;
if (((strcasecmp(t, "MFG") == 0) ||
(strcasecmp(t, "MANUFACTURER") == 0)) &&
(manufacturer != NULL))
else if (((strcasecmp(t, "MDL") == 0) ||
(strcasecmp(t, "MODEL") == 0)) &&
else if (((strcasecmp(t, "DES") == 0) ||
(strcasecmp(t, "DESCRIPTION") == 0)) &&
(description != NULL))
else if (((strcasecmp(t, "CLS") == 0) ||
(strcasecmp(t, "CLASS") == 0)) &&
else if (((strcasecmp(t, "SER") == 0) ||
(strcasecmp(t, "SERNO") == 0)) &&
else if (((strcasecmp(t, "CMD") == 0) ||
(strcasecmp(t, "COMMAND SET") == 0)) &&
(command_set != NULL)) {
/* this should be more dynamic, I got lazy */
int i = 0;
#define NELEM(a) (sizeof (a) / sizeof (*(a)))
}
*command_set = calloc(++i, sizeof (char *));
(*command_set)[i] = cmds[i];
}
}
return (0);
}
int
char **command_set, char *device)
{
HAL_DEBUG(("udi: %s, snmp data: vendor=%s, product=%s, "
"description=%s, serial=%s, device=%s\n",
"info.product", model);
if (manufacturer != NULL)
"printer.vendor", manufacturer);
"printer.product", model);
if (serial_number != NULL)
"printer.serial", serial_number);
if (description != NULL)
"printer.description", description);
if (command_set != NULL)
(const char **)command_set);
"printer.device", device);
return (0);
}