summaryrefslogtreecommitdiff
path: root/usr/src/lib/print/libpapi-common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/print/libpapi-common')
-rw-r--r--usr/src/lib/print/libpapi-common/Makefile57
-rw-r--r--usr/src/lib/print/libpapi-common/Makefile.com56
-rw-r--r--usr/src/lib/print/libpapi-common/common/attribute.c1119
-rw-r--r--usr/src/lib/print/libpapi-common/common/common.c135
-rw-r--r--usr/src/lib/print/libpapi-common/common/config-site.h60
-rw-r--r--usr/src/lib/print/libpapi-common/common/config.h159
-rw-r--r--usr/src/lib/print/libpapi-common/common/library.c105
-rw-r--r--usr/src/lib/print/libpapi-common/common/list.c177
-rw-r--r--usr/src/lib/print/libpapi-common/common/mapfile168
-rw-r--r--usr/src/lib/print/libpapi-common/common/misc.c224
-rw-r--r--usr/src/lib/print/libpapi-common/common/papi.h452
-rw-r--r--usr/src/lib/print/libpapi-common/common/status.c133
-rw-r--r--usr/src/lib/print/libpapi-common/common/uri.c300
-rw-r--r--usr/src/lib/print/libpapi-common/common/uri.h66
-rw-r--r--usr/src/lib/print/libpapi-common/i386/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-common/sparc/Makefile30
16 files changed, 0 insertions, 3271 deletions
diff --git a/usr/src/lib/print/libpapi-common/Makefile b/usr/src/lib/print/libpapi-common/Makefile
deleted file mode 100644
index ef7e964b85..0000000000
--- a/usr/src/lib/print/libpapi-common/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# 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
-# or http://www.opensolaris.org/os/licensing.
-# 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 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-HDRS = papi.h
-HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber: .WAIT $(SUBDIRS)
-install: .WAIT $(SUBDIRS) install_h
-
-lint: # $(SUBDIRS)
-
-install_h: $(ROOTHDRS)
-
-check: $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-common/Makefile.com b/usr/src/lib/print/libpapi-common/Makefile.com
deleted file mode 100644
index 1f1bd87f89..0000000000
--- a/usr/src/lib/print/libpapi-common/Makefile.com
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# 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
-# or http://www.opensolaris.org/os/licensing.
-# 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 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-LIBRARY = libpapi-common.a
-VERS = .0
-OBJECTS = attribute.o common.o library.o list.o misc.o status.o uri.o
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-ROOTLIBDIR= $(ROOT)/usr/lib
-
-SRCDIR = ../common
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-
-MAPFILES = $(SRCDIR)/mapfile
-
-LDLIBS += -lc -lsocket -lnsl
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-include ../../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-common/common/attribute.c b/usr/src/lib/print/libpapi-common/common/attribute.c
deleted file mode 100644
index 244e54555d..0000000000
--- a/usr/src/lib/print/libpapi-common/common/attribute.c
+++ /dev/null
@@ -1,1119 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: attribute.c 157 2006-04-26 15:07:55Z ktou $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <alloca.h>
-#include <papi.h>
-#include <regex.h>
-
-#define MAX_PAGES 32767
-/*
- * Assuming the maximum number of pages in
- * a document to be 32767
- */
-
-static void papiAttributeFree(papi_attribute_t *attribute);
-
-static void
-papiAttributeValueFree(papi_attribute_value_type_t type,
- papi_attribute_value_t *value)
-{
- if (value != NULL) {
- switch (type) {
- case PAPI_STRING:
- if (value->string != NULL)
- free(value->string);
- break;
- case PAPI_COLLECTION:
- if (value->collection != NULL) {
- int i;
-
- for (i = 0; value->collection[i] != NULL; i++)
- papiAttributeFree(value->collection[i]);
-
- free(value->collection);
- }
- break;
- default: /* don't need to free anything extra */
- break;
- }
-
- free(value);
- }
-}
-
-static void
-papiAttributeValuesFree(papi_attribute_value_type_t type,
- papi_attribute_value_t **values)
-{
- if (values != NULL) {
- int i;
-
- for (i = 0; values[i] != NULL; i++)
- papiAttributeValueFree(type, values[i]);
-
- free(values);
- }
-}
-
-static void
-papiAttributeFree(papi_attribute_t *attribute)
-{
- if (attribute != NULL) {
- if (attribute->name != NULL)
- free(attribute->name);
- if (attribute->values != NULL)
- papiAttributeValuesFree(attribute->type,
- attribute->values);
- free(attribute);
- }
-}
-
-void
-papiAttributeListFree(papi_attribute_t **list)
-{
- if (list != NULL) {
- int i;
-
- for (i = 0; list[i] != NULL; i++)
- papiAttributeFree(list[i]);
-
- free(list);
- }
-}
-
-static papi_attribute_t **
-collection_dup(papi_attribute_t **collection)
-{
- papi_attribute_t **result = NULL;
-
- /* allows a NULL collection that is "empty" or "no value" */
- if (collection != NULL) {
- papi_status_t status = PAPI_OK;
- int i;
-
- for (i = 0; ((collection[i] != NULL) && (status == PAPI_OK));
- i++) {
- papi_attribute_t *a = collection[i];
-
- status = papiAttributeListAddValue(&result,
- PAPI_ATTR_APPEND, a->name, a->type,
- NULL);
- if ((status == PAPI_OK) && (a->values != NULL)) {
- int j;
-
- for (j = 0; ((a->values[j] != NULL) &&
- (status == PAPI_OK)); j++)
- status = papiAttributeListAddValue(
- &result,
- PAPI_ATTR_APPEND,
- a->name, a->type,
- a->values[j]);
- }
- }
- if (status != PAPI_OK) {
- papiAttributeListFree(result);
- result = NULL;
- }
- }
-
- return (result);
-}
-
-static papi_attribute_value_t *
-papiAttributeValueDup(papi_attribute_value_type_t type,
- papi_attribute_value_t *v)
-{
- papi_attribute_value_t *result = NULL;
-
- if ((v != NULL) && ((result = calloc(1, sizeof (*result))) != NULL)) {
- switch (type) {
- case PAPI_STRING:
- if (v->string == NULL) {
- free(result);
- result = NULL;
- } else
- result->string = strdup(v->string);
- break;
- case PAPI_INTEGER:
- result->integer = v->integer;
- break;
- case PAPI_BOOLEAN:
- result->boolean = v->boolean;
- break;
- case PAPI_RANGE:
- result->range.lower = v->range.lower;
- result->range.upper = v->range.upper;
- break;
- case PAPI_RESOLUTION:
- result->resolution.xres = v->resolution.xres;
- result->resolution.yres = v->resolution.yres;
- result->resolution.units = v->resolution.units;
- break;
- case PAPI_DATETIME:
- result->datetime = v->datetime;
- break;
- case PAPI_COLLECTION:
- result->collection = collection_dup(v->collection);
- break;
- case PAPI_METADATA:
- result->metadata = v->metadata;
- break;
- default: /* unknown type, fail to duplicate */
- free(result);
- result = NULL;
- }
- }
-
- return (result);
-}
-
-static papi_attribute_t *
-papiAttributeAlloc(char *name, papi_attribute_value_type_t type)
-{
- papi_attribute_t *result = NULL;
-
- if ((result = calloc(1, sizeof (*result))) != NULL) {
- result->name = strdup(name);
- result->type = type;
- }
-
- return (result);
-}
-
-static papi_status_t
-papiAttributeListAppendValue(papi_attribute_value_t ***values,
- papi_attribute_value_type_t type,
- papi_attribute_value_t *value)
-{
-
- if (values == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if (value != NULL) { /* this allows "empty" attributes */
- papi_attribute_value_t *tmp = NULL;
-
- if ((tmp = papiAttributeValueDup(type, value)) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- list_append(values, tmp);
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiAttributeListAddValue(papi_attribute_t ***list, int flgs,
- char *name, papi_attribute_value_type_t type,
- papi_attribute_value_t *value)
-{
- papi_status_t result;
- int flags = flgs;
- papi_attribute_t *attribute = NULL;
- papi_attribute_value_t **values = NULL;
-
- if ((list == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((type == PAPI_RANGE) && (value != NULL) &&
- (value->range.lower > value->range.upper))
- return (PAPI_BAD_ARGUMENT); /* RANGE must have min <= max */
-
- if (flags == 0) /* if it wasn't set, set a default behaviour */
- flags = PAPI_ATTR_APPEND;
-
- /* look for an existing one */
- attribute = papiAttributeListFind(*list, name);
-
- if (((flags & PAPI_ATTR_EXCL) != 0) && (attribute != NULL))
- return (PAPI_CONFLICT); /* EXISTS */
-
- if (((flags & PAPI_ATTR_REPLACE) == 0) && (attribute != NULL) &&
- (attribute->type != type))
- return (PAPI_CONFLICT); /* TYPE CONFLICT */
-
- /* if we don't have one, create it and add it to the list */
- if ((attribute == NULL) &&
- ((attribute = papiAttributeAlloc(name, type)) != NULL))
- list_append(list, attribute);
-
- /* if we don't have one by now, it's most likely an alloc fail */
- if (attribute == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /*
- * if we are replacing, clear any existing values, but don't free
- * until after we have replaced the values, in case we are replacing
- * a collection with a relocated version of the original collection.
- */
- if (((flags & PAPI_ATTR_REPLACE) != 0) && (attribute->values != NULL)) {
- values = attribute->values;
- attribute->values = NULL;
- }
-
- attribute->type = type;
-
- result = papiAttributeListAppendValue(&attribute->values, type, value);
-
- /* free old values if we replaced them */
- if (values != NULL)
- papiAttributeValuesFree(type, values);
-
- return (result);
-}
-
-papi_status_t
-papiAttributeListAddString(papi_attribute_t ***list, int flags,
- char *name, char *string)
-{
- papi_attribute_value_t v;
-
- v.string = (char *)string;
- return (papiAttributeListAddValue(list, flags, name, PAPI_STRING, &v));
-}
-
-papi_status_t
-papiAttributeListAddInteger(papi_attribute_t ***list, int flags,
- char *name, int integer)
-{
- papi_attribute_value_t v;
-
- v.integer = integer;
- return (papiAttributeListAddValue(list, flags, name, PAPI_INTEGER, &v));
-}
-
-papi_status_t
-papiAttributeListAddBoolean(papi_attribute_t ***list, int flags,
- char *name, char boolean)
-{
- papi_attribute_value_t v;
-
- v.boolean = boolean;
- return (papiAttributeListAddValue(list, flags, name, PAPI_BOOLEAN, &v));
-}
-
-papi_status_t
-papiAttributeListAddRange(papi_attribute_t ***list, int flags,
- char *name, int lower, int upper)
-{
- papi_attribute_value_t v;
-
- v.range.lower = lower;
- v.range.upper = upper;
- return (papiAttributeListAddValue(list, flags, name, PAPI_RANGE, &v));
-}
-
-papi_status_t
-papiAttributeListAddResolution(papi_attribute_t ***list, int flags,
- char *name, int xres, int yres,
- papi_resolution_unit_t units)
-{
- papi_attribute_value_t v;
-
- v.resolution.xres = xres;
- v.resolution.yres = yres;
- v.resolution.units = units;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_RESOLUTION, &v));
-}
-
-papi_status_t
-papiAttributeListAddDatetime(papi_attribute_t ***list, int flags,
- char *name, time_t datetime)
-{
- papi_attribute_value_t v;
-
- v.datetime = datetime;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_DATETIME, &v));
-}
-
-papi_status_t
-papiAttributeListAddCollection(papi_attribute_t ***list, int flags,
- char *name, papi_attribute_t **collection)
-{
- papi_attribute_value_t v;
-
- v.collection = (papi_attribute_t **)collection;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_COLLECTION, &v));
-}
-
-papi_status_t
-papiAttributeListAddMetadata(papi_attribute_t ***list, int flags,
- char *name, papi_metadata_t metadata)
-{
- papi_attribute_value_t v;
-
- v.metadata = metadata;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_METADATA, &v));
-}
-
-papi_status_t
-papiAttributeListDelete(papi_attribute_t ***list, char *name)
-{
- papi_attribute_t *attribute;
-
- if ((list == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((attribute = papiAttributeListFind(*list, name)) == NULL)
- return (PAPI_NOT_FOUND);
-
- list_remove(list, attribute);
- papiAttributeFree(attribute);
-
- return (PAPI_OK);
-}
-
-papi_attribute_t *
-papiAttributeListFind(papi_attribute_t **list, char *name)
-{
- int i;
- if ((list == NULL) || (name == NULL))
- return (NULL);
-
- for (i = 0; list[i] != NULL; i++)
- if (strcasecmp(list[i]->name, name) == 0)
- return ((papi_attribute_t *)list[i]);
-
- return (NULL);
-}
-
-papi_attribute_t *
-papiAttributeListGetNext(papi_attribute_t **list, void **iter)
-{
- papi_attribute_t **tmp, *result;
-
- if ((list == NULL) && (iter == NULL))
- return (NULL);
-
- if (*iter == NULL)
- *iter = list;
-
- tmp = *iter;
- result = *tmp;
- *iter = ++tmp;
-
- return (result);
-}
-
-papi_status_t
-papiAttributeListGetValue(papi_attribute_t **list, void **iter,
- char *name, papi_attribute_value_type_t type,
- papi_attribute_value_t **value)
-{
- papi_attribute_value_t **tmp;
- void *fodder = NULL;
-
- if ((list == NULL) || ((name == NULL) && (iter == NULL)) ||
- (value == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (iter == NULL)
- iter = &fodder;
-
- if ((iter == NULL) || (*iter == NULL)) {
- papi_attribute_t *attr = papiAttributeListFind(list, name);
-
- if (attr == NULL)
- return (PAPI_NOT_FOUND);
-
- if (attr->type != type)
- return (PAPI_NOT_POSSIBLE);
-
- tmp = attr->values;
- } else
- tmp = *iter;
-
- if (tmp == NULL)
- return (PAPI_NOT_FOUND);
-
- *value = *tmp;
- *iter = ++tmp;
-
- if (*value == NULL)
- return (PAPI_GONE);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiAttributeListGetString(papi_attribute_t **list, void **iter,
- char *name, char **vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_STRING, &value);
- if (status == PAPI_OK)
- *vptr = value->string;
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetInteger(papi_attribute_t **list, void **iter,
- char *name, int *vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_INTEGER, &value);
- if (status == PAPI_OK)
- *vptr = value->integer;
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetBoolean(papi_attribute_t **list, void **iter,
- char *name, char *vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_BOOLEAN, &value);
- if (status == PAPI_OK)
- *vptr = value->boolean;
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetRange(papi_attribute_t **list, void **iter,
- char *name, int *min, int *max)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if ((min == NULL) || (max == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_RANGE, &value);
- if (status == PAPI_OK) {
- *min = value->range.lower;
- *max = value->range.upper;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetResolution(papi_attribute_t **list, void **iter,
- char *name, int *x, int *y,
- papi_resolution_unit_t *units)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if ((x == NULL) || (y == NULL) || (units == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_RESOLUTION, &value);
- if (status == PAPI_OK) {
- *x = value->resolution.xres;
- *y = value->resolution.yres;
- *units = value->resolution.units;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetDatetime(papi_attribute_t **list, void **iter,
- char *name, time_t *dt)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (dt == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_DATETIME, &value);
- if (status == PAPI_OK) {
- *dt = value->datetime;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetCollection(papi_attribute_t **list, void **iter,
- char *name, papi_attribute_t ***collection)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (collection == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_COLLECTION, &value);
- if (status == PAPI_OK) {
- *collection = value->collection;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetMetadata(papi_attribute_t **list, void **iter,
- char *name, papi_metadata_t *vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_METADATA, &value);
- if (status == PAPI_OK)
- *vptr = value->metadata;
-
- return (status);
-}
-
-
-/* The string is modified by this call */
-static char *
-regvalue(regmatch_t match, char *string)
-{
- char *result = NULL;
- if (match.rm_so != match.rm_eo) {
- result = string + match.rm_so;
- *(result + (match.rm_eo - match.rm_so)) = '\0';
- }
- return (result);
-}
-
-static papi_attribute_value_type_t
-_process_value(char *string, char ***parts)
-{
- int i;
- static struct {
- papi_attribute_value_type_t type;
- size_t vals;
- char *expression;
- int compiled;
- regex_t re;
- } types[] = {
- { PAPI_BOOLEAN, 1, "^(true|false|yes|no)$", 0 },
- { PAPI_COLLECTION, 1, "^\\{(.+)\\}$", 0 },
- /* PAPI_DATETIME is unsupported, too much like an integer */
- { PAPI_INTEGER, 1, "^([+-]{0,1}[[:digit:]]+)$", 0 },
- { PAPI_RANGE, 3, "^([[:digit:]]*)-([[:digit:]]*)$", 0 },
- { PAPI_RESOLUTION, 4, "^([[:digit:]]+)x([[:digit:]]+)dp(i|c)$",
- 0 },
- NULL
- };
- regmatch_t matches[4];
-
- for (i = 0; i < 5; i++) {
- int j;
-
- if (types[i].compiled == 0) {
- (void) regcomp(&(types[i].re), types[i].expression,
- REG_EXTENDED|REG_ICASE);
- types[i].compiled = 1;
- }
- if (regexec(&(types[i].re), string, (size_t)types[i].vals,
- matches, 0) == REG_NOMATCH)
- continue;
-
- for (j = 0 ; j < types[i].vals; j++)
- list_append(parts, regvalue(matches[j], string));
- return (types[i].type);
- }
-
- list_append(parts, string);
- return (PAPI_STRING);
-}
-
-static void
-_add_attribute_value(papi_attribute_value_t ***list,
- papi_attribute_value_type_t type,
- papi_attribute_value_type_t dtype, char **parts)
-{
- papi_attribute_value_t *value = calloc(1, sizeof (*value));
-
- switch(type) {
- case PAPI_STRING:
- value->string = strdup(parts[0]);
- list_append(list, value);
- break;
- case PAPI_BOOLEAN:
- value->boolean = PAPI_TRUE;
- if ((strcasecmp(parts[0], "false") == 0) ||
- (strcasecmp(parts[0], "no") == 0))
- value->boolean = PAPI_FALSE;
- list_append(list, value);
- break;
- case PAPI_INTEGER:
- value->integer = atoi(parts[0]);
- list_append(list, value);
- break;
- case PAPI_RANGE:
- if (dtype == PAPI_INTEGER) {
- if (atoi(parts[0]) < 0) {
- /*
- * Handles -P -x case
- * which prints from page number 1
- * till page number x
- */
- value->range.lower = 1;
- value->range.upper = 0 - (atoi(parts[0]));
- } else {
- value->range.lower = value->range.upper
- = atoi(parts[0]);
- }
- } else if (dtype == PAPI_RANGE) {
- if (parts[2] == NULL) {
- value->range.lower = atoi(parts[1]);
- /*
- * Imposing an artificial limit on
- * the upper bound for page range.
- */
- value->range.upper = MAX_PAGES;
- } else if ((parts[1] != NULL) && (parts[2] != NULL)) {
- value->range.lower = atoi(parts[1]);
- value->range.upper = atoi(parts[2]);
- }
- }
- list_append(list, value);
- break;
- case PAPI_RESOLUTION:
- value->resolution.xres = atoi(parts[1]);
- value->resolution.yres = atoi(parts[2]);
- if (parts[3][0] == 'i')
- value->resolution.units = PAPI_RES_PER_INCH;
- else
- value->resolution.units = PAPI_RES_PER_CM;
- list_append(list, value);
- break;
- case PAPI_COLLECTION:
- papiAttributeListFromString(&(value->collection), 0, parts[0]);
- list_append(list, value);
- break;
- }
-}
-
-static papi_status_t
-_papiAttributeFromStrings(papi_attribute_t ***list, int flags,
- char *key, char **values)
-{
- int i;
- papi_status_t result = PAPI_OK;
- papi_attribute_t *attr = calloc(1, sizeof (*attr));
-
- /* these are specified in the papi spec as ranges */
- char *ranges[] = { "copies-supported", "job-impressions-supported",
- "job-k-octets-supported",
- "job-media-sheets-supported", "page-ranges",
- NULL };
-
- if ((attr == NULL) || ((attr->name = strdup(key)) == NULL))
- return (PAPI_TEMPORARY_ERROR);
-
- attr->type = PAPI_METADATA;
- /* these are known ranges */
- for (i = 0; ranges[i] != NULL; i++)
- if (strcasecmp(attr->name, ranges[i]) == 0) {
- attr->type = PAPI_RANGE;
- break;
- }
-
- if (values != NULL) {
- papi_attribute_value_t **vals = NULL;
-
- for (i = 0; values[i] != NULL; i++) {
- papi_attribute_value_type_t dtype;
- char **parts = NULL;
-
- dtype = _process_value(values[i], &parts);
- if (attr->type == PAPI_METADATA)
- attr->type = dtype;
- _add_attribute_value(&vals, attr->type, dtype, parts);
- free(parts);
- }
- attr->values = vals;
- }
-
- list_append(list, attr);
-
- return (result);
-}
-
-static papi_status_t
-_parse_attribute_list(papi_attribute_t ***list, int flags, char *string)
-{
- papi_status_t result = PAPI_OK;
- char *ptr;
-
- if ((list == NULL) || (string == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((ptr = strdup(string)) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- while ((*ptr != '\0') && (result == PAPI_OK)) {
- char *key, **values = NULL;
-
- /* strip any leading whitespace */
- while (isspace(*ptr) != 0)
- ptr++;
-
- /* Get the name: name[=value] */
- key = ptr;
- while ((*ptr != '\0') && (*ptr != '=') && (isspace(*ptr) == 0))
- ptr++;
-
- if (*ptr == '=') {
- *ptr++ = '\0';
-
- while ((*ptr != '\0') && (isspace(*ptr) == 0)) {
- char *value = ptr;
-
- if ((*ptr == '\'') || (*ptr == '"')) {
- char q = *ptr++;
-
- /* quoted string value */
- while ((*ptr != '\0') && (*ptr != q))
- ptr++;
- if (*ptr == q)
- ptr++;
- } else if (*ptr == '{') {
- /* collection */
- while ((*ptr != '\0') && (*ptr != '}'))
- ptr++;
- if (*ptr == '}')
- ptr++;
- } else {
- /* value */
- while ((*ptr != '\0') &&
- (*ptr != ',') &&
- (isspace(*ptr) == 0))
- ptr++;
- }
- if (*ptr == ',')
- *ptr++ = '\0';
- list_append(&values, value);
- }
- } else { /* boolean "[no]key" */
- char *value = "true";
-
- if (strncasecmp(key, "no", 2) == 0) {
- key += 2;
- value = "false";
- }
- list_append(&values, value);
- }
- if (*ptr != '\0')
- *ptr++ = '\0';
-
- result = _papiAttributeFromStrings(list, flags, key, values);
- free(values);
- }
-
- return (result);
-}
-
-papi_status_t
-papiAttributeListFromString(papi_attribute_t ***attrs,
- int flags, char *string)
-{
- papi_status_t result = PAPI_OK;
-
- if ((attrs != NULL) && (string != NULL) &&
- ((flags & ~(PAPI_ATTR_APPEND+PAPI_ATTR_REPLACE+PAPI_ATTR_EXCL))
- == 0)) {
- result = _parse_attribute_list(attrs, flags, string);
- } else {
- result = PAPI_BAD_ARGUMENT;
- }
-
- return (result);
-}
-
-static papi_status_t
-papiAttributeToString(papi_attribute_t *attribute, char *delim,
- char *buffer, size_t buflen)
-{
- papi_attribute_value_t **values = attribute->values;
- int rc, i;
-
- if ((attribute->type == PAPI_BOOLEAN) && (values[1] == NULL)) {
- if (values[0]->boolean == PAPI_FALSE) {
- if (isupper(attribute->name[0]) == 0)
- strlcat(buffer, "no", buflen);
- else
- strlcat(buffer, "No", buflen);
- }
- rc = strlcat(buffer, attribute->name, buflen);
- } else {
- strlcat(buffer, attribute->name, buflen);
- rc = strlcat(buffer, "=", buflen);
- }
-
- if (values == NULL)
- return (PAPI_OK);
-
- for (i = 0; values[i] != NULL; i++) {
- switch (attribute->type) {
- case PAPI_STRING:
- rc = strlcat(buffer, values[i]->string, buflen);
- break;
- case PAPI_INTEGER: {
- char string[24];
-
- snprintf(string, sizeof (string), "%d",
- values[i]->integer);
- rc = strlcat(buffer, string, buflen);
- }
- break;
- case PAPI_BOOLEAN:
- if (values[1] != NULL)
- rc = strlcat(buffer, (values[i]->boolean ?
- "true" : "false"), buflen);
- break;
- case PAPI_RANGE: {
- char string[24];
-
- if (values[i]->range.lower == values[i]->range.upper)
- snprintf(string, sizeof (string), "%d",
- values[i]->range.lower);
- else
- snprintf(string, sizeof (string), "%d-%d",
- values[i]->range.lower,
- values[i]->range.upper);
- rc = strlcat(buffer, string, buflen);
- }
- break;
- case PAPI_RESOLUTION: {
- char string[24];
-
- snprintf(string, sizeof (string), "%dx%ddp%c",
- values[i]->resolution.xres,
- values[i]->resolution.yres,
- (values[i]->resolution.units == PAPI_RES_PER_CM
- ? 'c' : 'i'));
- rc = strlcat(buffer, string, buflen);
- }
- break;
- case PAPI_DATETIME: {
- struct tm *tm = localtime(&values[i]->datetime);
-
- if (tm != NULL) {
- char string[64];
-
- strftime(string, sizeof (string), "%C", tm);
- rc = strlcat(buffer, string, buflen);
- }}
- break;
- case PAPI_COLLECTION: {
- char *string = alloca(buflen);
-
- papiAttributeListToString(values[i]->collection,
- delim, string, buflen);
- rc = strlcat(buffer, string, buflen);
- }
- break;
- default: {
- char string[32];
-
- snprintf(string, sizeof (string), "unknown-type-0x%x",
- attribute->type);
- rc = strlcat(buffer, string, buflen);
- }
- }
- if (values[i+1] != NULL)
- rc = strlcat(buffer, ",", buflen);
-
- if (rc >= buflen)
- return (PAPI_NOT_POSSIBLE);
-
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiAttributeListToString(papi_attribute_t **attrs,
- char *delim, char *buffer, size_t buflen)
-{
- papi_status_t status = PAPI_OK;
- int i;
-
- if ((attrs == NULL) || (buffer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- buffer[0] = '\0';
- if (!delim)
- delim = " ";
-
- for (i = 0; ((attrs[i] != NULL) && (status == PAPI_OK)); i++) {
- status = papiAttributeToString(attrs[i], delim, buffer, buflen);
- if (attrs[i+1] != NULL)
- strlcat(buffer, delim, buflen);
- }
-
- return (status);
-}
-
-static int
-is_in_list(char *value, char **list)
-{
- if ((list != NULL) && (value != NULL)) {
- int i;
-
- for (i = 0; list[i] != NULL; i++)
- if (strcasecmp(value, list[i]) == 0)
- return (0);
- }
-
- return (1);
-}
-
-static papi_status_t
-copy_attribute(papi_attribute_t ***list, papi_attribute_t *attribute)
-{
- papi_status_t status;
- int i = 0;
-
- if ((list == NULL) || (attribute == NULL) ||
- (attribute->values == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- for (status = papiAttributeListAddValue(list, PAPI_ATTR_EXCL,
- attribute->name, attribute->type,
- attribute->values[i]);
- ((status == PAPI_OK) && (attribute->values[i] != NULL));
- status = papiAttributeListAddValue(list, PAPI_ATTR_APPEND,
- attribute->name, attribute->type,
- attribute->values[i]))
- i++;
-
- return (status);
-}
-
-void
-copy_attributes(papi_attribute_t ***result, papi_attribute_t **attributes)
-{
- int i;
-
- if ((result == NULL) || (attributes == NULL))
- return;
-
- for (i = 0; attributes[i] != NULL; i++)
- copy_attribute(result, attributes[i]);
-}
-
-void
-split_and_copy_attributes(char **list, papi_attribute_t **attributes,
- papi_attribute_t ***in, papi_attribute_t ***out)
-{
- int i;
-
- if ((list == NULL) || (attributes == NULL))
- return;
-
- for (i = 0; attributes[i] != NULL; i++)
- if (is_in_list(attributes[i]->name, list) == 0)
- copy_attribute(in, attributes[i]);
- else
- copy_attribute(out, attributes[i]);
-}
-
-void
-papiAttributeListPrint(FILE *fp, papi_attribute_t **attributes,
- char *prefix_fmt, ...)
-{
- char *prefix = NULL;
- char *buffer = NULL;
- char *newfmt = NULL;
- void *mem;
- ssize_t size = 0;
- va_list ap;
-
- newfmt = malloc(strlen(prefix_fmt) + 2);
- sprintf(newfmt, "\n%s", prefix_fmt);
-
- va_start(ap, prefix_fmt);
- while (vsnprintf(prefix, size, newfmt, ap) > size) {
- size += 1024;
- mem = realloc(prefix, size);
- if (!mem) goto error;
- prefix = mem;
- }
- va_end(ap);
-
- if (attributes) {
- size = 0;
- while (papiAttributeListToString(attributes, prefix, buffer,
- size) != PAPI_OK) {
- size += 1024;
- mem = realloc(buffer, size);
- if (!mem) goto error;
- buffer = mem;
- }
- }
-
- fprintf(fp, "%s%s\n", prefix, buffer ? buffer : "");
- fflush(fp);
-
- error:
- free(newfmt);
- free(prefix);
- free(buffer);
-}
diff --git a/usr/src/lib/print/libpapi-common/common/common.c b/usr/src/lib/print/libpapi-common/common/common.c
deleted file mode 100644
index c14515417b..0000000000
--- a/usr/src/lib/print/libpapi-common/common/common.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: common.c 151 2006-04-25 16:55:34Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Shared "unsupported" function implementations that can be overridden
- * by libpapi and the various print service modules (psms).
- */
-
-#include <stdlib.h>
-#include <papi.h>
-
-static papi_status_t
-_unsupported()
-{
- return (PAPI_OPERATION_NOT_SUPPORTED);
-}
-
-static void *
-_unsupported_null_return()
-{
- return (NULL);
-}
-
-static void
-_unsupported_no_return()
-{
-}
-
-/*
- * Service interfaces
- */
-#pragma weak papiServiceCreate = _unsupported
-#pragma weak papiServiceDestroy = _unsupported_no_return
-#pragma weak papiServiceSetPeer = _unsupported
-#pragma weak papiServiceSetUserName = _unsupported
-#pragma weak papiServiceSetPassword = _unsupported
-#pragma weak papiServiceSetEncryption = _unsupported
-#pragma weak papiServiceSetAuthCB = _unsupported
-#pragma weak papiServiceSetAppData = _unsupported
-
-#pragma weak papiServiceGetServiceName = _unsupported_null_return
-#pragma weak papiServiceGetUserName = _unsupported_null_return
-#pragma weak papiServiceGetPassword = _unsupported_null_return
-#pragma weak papiServiceGetAppData = _unsupported_null_return
-
-papi_encryption_t
-papiServiceGetEncryption(papi_service_t handle)
-{
- return (PAPI_ENCRYPT_NEVER);
-}
-
-#pragma weak papiServiceGetAttributeList = _unsupported_null_return
-#pragma weak papiServiceGetStatusMessage = _unsupported_null_return
-
-/*
- * Printer operations
- */
-#pragma weak papiPrintersList = _unsupported
-#pragma weak papiPrinterQuery = _unsupported
-#pragma weak papiPrinterEnable = _unsupported
-#pragma weak papiPrinterDisable = _unsupported
-#pragma weak papiPrinterPause = _unsupported
-#pragma weak papiPrinterResume = _unsupported
-#pragma weak papiPrinterAdd = _unsupported
-#pragma weak papiPrinterModify = _unsupported
-#pragma weak papiPrinterRemove = _unsupported
-#pragma weak papiPrinterPurgeJobs = _unsupported
-#pragma weak papiPrinterListJobs = _unsupported
-#pragma weak papiPrinterGetAttributeList = _unsupported_null_return
-#pragma weak papiPrinterFree = _unsupported_no_return
-#pragma weak papiPrinterListFree = _unsupported_no_return
-
-/*
- * Job interfaces
- */
-#pragma weak papiJobHold = _unsupported
-#pragma weak papiJobRelease = _unsupported
-#pragma weak papiJobRestart = _unsupported
-#pragma weak papiJobPromote = _unsupported
-#pragma weak papiJobModify = _unsupported
-#pragma weak papiJobSubmit = _unsupported
-#pragma weak papiJobSubmitByReference = _unsupported
-#pragma weak papiJobValidate = _unsupported
-#pragma weak papiJobStreamOpen = _unsupported
-#pragma weak papiJobStreamWrite = _unsupported
-#pragma weak papiJobStreamClose = _unsupported
-#pragma weak papiJobQuery = _unsupported
-#pragma weak papiJobMove = _unsupported
-#pragma weak papiJobCancel = _unsupported
-#pragma weak papiJobGetAttributeList = _unsupported_null_return
-#pragma weak papiJobGetPrinterName = _unsupported_null_return
-#pragma weak papiJobCreate = _unsupported
-#pragma weak papiJobStreamAdd = _unsupported
-#pragma weak papiJobCommit = _unsupported
-
-int
-papiJobGetId(papi_job_t job)
-{
- return (-1);
-}
-
-#pragma weak papiJobGetJobTicket = _unsupported_null_return
-#pragma weak papiJobFree = _unsupported_no_return
-#pragma weak papiJobListFree = _unsupported_no_return
-
-/* private functions */
-#pragma weak getprinterbyname = _unsupported_null_return
diff --git a/usr/src/lib/print/libpapi-common/common/config-site.h b/usr/src/lib/print/libpapi-common/common/config-site.h
deleted file mode 100644
index 2007f4f669..0000000000
--- a/usr/src/lib/print/libpapi-common/common/config-site.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _CONFIG_SITE_H
-#define _CONFIG_SITE_H
-
-/* $Id: config-site.h.in 171 2006-05-20 06:00:32Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* the "default" destination for various commands and libraries */
-#define DEFAULT_DEST "_default"
-
-/* the "default" server uri to fallback to */
-#define DEFAULT_SERVICE_URI "lpsched://localhost/printers"
-
-/* the "default" IPP service to fallback to in the IPP psm */
-#define DEFAULT_IPP_SERVICE_URI "ipp://localhost/printers"
-
-/* the name of the SUID lpd-port binary that hands psm-lpd a connected socket */
-#define SUID_LPD_PORT "/usr/lib/print/lpd-port"
-
-/* enable/disable printer-uri in enumeration results */
-#define NEED_BROKEN_PRINTER_URI_SEMANTIC
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONFIG_SITE_H */
diff --git a/usr/src/lib/print/libpapi-common/common/config.h b/usr/src/lib/print/libpapi-common/common/config.h
deleted file mode 100644
index 280ac6d6b4..0000000000
--- a/usr/src/lib/print/libpapi-common/common/config.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _CONFIG_H
-#define _CONFIG_H
-
-/* source/libpapi-common/config.h. Generated by configure. */
-/* source/libpapi-common/config.h.in. Generated from configure.in by autoheader. */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the `dlopen' function. */
-#define HAVE_DLOPEN 1
-
-/* Define to 1 if you have the `dlsym' function. */
-#define HAVE_DLSYM 1
-
-/* Define to 1 if you have the `fprintf' function. */
-#define HAVE_FPRINTF 1
-
-/* define if you have getipnodbyname */
-#define HAVE_GETIPNODEBYNAME 1
-
-/* Define to 1 if you have the `getpassphrase' function. */
-#define HAVE_GETPASSPHRASE 1
-
-/* Define to 1 if you have the `gettext' function. */
-#define HAVE_GETTEXT 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `is_system_labeled' function. */
-#define HAVE_IS_SYSTEM_LABELED 1
-
-/* Define to 1 if you have the `localtime' function. */
-#define HAVE_LOCALTIME 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the <priv.h> header file. */
-#define HAVE_PRIV_H 1
-
-/* define if you have rresvport_af */
-#define HAVE_RRESVPORT_AF 1
-
-/* Define to 1 if you have the <ruby.h> header file. */
-/* #undef HAVE_RUBY_H */
-
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strcmp' function. */
-#define HAVE_STRCMP 1
-
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define to 1 if you have the `strftime' function. */
-#define HAVE_STRFTIME 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strlcat' function. */
-#define HAVE_STRLCAT 1
-
-/* Define to 1 if you have the `strlcpy' function. */
-#define HAVE_STRLCPY 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Name of package */
-#define PACKAGE "papi"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME ""
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION ""
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "1.0_rc1"
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONFIG_H */
diff --git a/usr/src/lib/print/libpapi-common/common/library.c b/usr/src/lib/print/libpapi-common/common/library.c
deleted file mode 100644
index 12b1ffb449..0000000000
--- a/usr/src/lib/print/libpapi-common/common/library.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: library.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <alloca.h>
-#include <libintl.h>
-#include <papi.h>
-
-static char *calls[] = {
- /* Attribute Calls */
- "papiAttributeListAddValue",
- "papiAttributeListAddBoolean", "papiAttributeListAddCollection",
- "papiAttributeListAddDatetime", "papiAttributeListAddInteger",
- "papiAttributeListAddMetadata", "papiAttributeListAddRange",
- "papiAttributeListAddResolution", "papiAttributeListAddString",
- "papiAttributeListDelete",
- "papiAttributeListGetValue", "papiAttributeListGetNext",
- "papiAttributeListFind",
- "papiAttributeListGetBoolean", "papiAttributeListGetCollection",
- "papiAttributeListGetDatetime", "papiAttributeListGetInteger",
- "papiAttributeListGetMetadata", "papiAttributeListGetRange",
- "papiAttributeListGetResolution", "papiAttributeListGetString",
- "papiAttributeListFromString", "papiAttributeListToString",
- "papiAttributeListFree",
- /* Job Calls */
- "papiJobSubmit", "papiJobSubmitByReference", "papiJobValidate",
- "papiJobStreamOpen", "papiJobStreamWrite", "papiJobStreamClose",
- "papiJobQuery", "papiJobModify", "papiJobCancel", "papiJobPromote",
- "papiJobGetAttributeList", "papiJobGetId", "papiJobGetPrinterName",
- "papiJobGetJobTicket",
- "papiJobFree", "papiJobListFree",
- "papiJobHold", "papiJobRelease", "papiJobRestart",
- /* Printer Calls */
- "papiPrintersList", "papiPrinterQuery", "papiPrinterModify",
- "papiPrinterAdd", "papiPrinterRemove",
- "papiPrinterPause", "papiPrinterResume",
- "papiPrinterDisable", "papiPrinterEnable",
- "papiPrinterPurgeJobs", "papiPrinterListJobs",
- "papiPrinterGetAttributeList",
- "papiPrinterFree", "papiPrinterListFree",
- /* Service Calls */
- "papiServiceCreate", "papiServiceDestroy",
- "papiServiceGetAppData",
- "papiServiceGetEncryption", "papiServiceGetPassword",
- "papiServiceGetServiceName", "papiServiceGetUserName",
- "papiServiceSetAppData", "papiServiceSetAuthCB",
- "papiServiceSetEncryption", "papiServiceSetPassword",
- "papiServiceSetUserName",
- "papiServiceGetAttributeList", "papiServiceGetStatusMessage",
- /* Misc Calls */
- "papiStatusString",
- "papiLibrarySupportedCall", "papiLibrarySupportedCalls",
- NULL
-};
-
-char **
-papiLibrarySupportedCalls()
-{
- return (calls);
-}
-
-char
-papiLibrarySupportedCall(const char *name)
-{
- int i;
-
- for (i = 0; calls[i] != NULL; i++)
- if (strcmp(name, calls[i]) == 0)
- return (PAPI_TRUE);
-
- return (PAPI_FALSE);
-}
diff --git a/usr/src/lib/print/libpapi-common/common/list.c b/usr/src/lib/print/libpapi-common/common/list.c
deleted file mode 100644
index b2560c5059..0000000000
--- a/usr/src/lib/print/libpapi-common/common/list.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: list.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-
-static int __list_increment = 16;
-
-#define LIST_SIZE(x) ((((x) / __list_increment) + 1) * __list_increment)
-
-int
-list_append(void ***list, void *item)
-{
- int count;
-
- if ((list == NULL) || (item == NULL)) {
- errno = EINVAL;
- return (-1);
- }
-
- if (item != NULL) {
- if (*list == NULL)
- *list = (void **)calloc(__list_increment,
- sizeof (void *));
-
- for (count = 0; (*list)[count] != NULL; count++)
- ;
-
- if ((count + 1) % __list_increment == 0) { /* expand the list */
- void **new_list = NULL;
- int new_size = LIST_SIZE(count + 1);
-
- new_list = (void **)calloc(new_size, sizeof (void *));
- if (new_list == NULL)
- return (-1);
-
- for (count = 0; (*list)[count] != NULL; count++)
- new_list[count] = (*list)[count];
- free(*list);
- *list = new_list;
- }
-
- (*list)[count] = item;
- }
-
- return (0);
-}
-
-/*
- * list_concatenate() takes in two NULL terminated lists of items (type **)
- * and creates a new list with items from list2 appended on the end of
- * the list of items from list1. The result is a list (type **). If
- * there is a failure, -1 is returned.
- */
-int
-list_concatenate(void ***result, void **list2)
-{
- void **list1;
- int size1 = 0;
- int size2 = 0;
- int new_size = 0;
-
- if ((result == NULL) || ((*result == NULL) && (list2 == NULL))) {
- errno = EINVAL;
- return (-1);
- }
-
- list1 = *result;
-
- if (list1 != NULL)
- for (size1 = 0; list1[size1] != NULL; size1++)
- ;
- if (list2 != NULL)
- for (size2 = 0; list2[size2] != NULL; size2++)
- ;
-
- /* list1 + list2 padded to a multiple of _list_increment */
- new_size = LIST_SIZE(size1 + size2);
-
- if ((*result = (void **)calloc((new_size), sizeof (void *))) != NULL) {
- int count = 0;
-
- if (list1 != NULL)
- for (size1 = 0; list1[size1] != NULL; size1++)
- (*result)[count++] = list1[size1];
- if (list2 != NULL)
- for (size2 = 0; list2[size2] != NULL; size2++)
- (*result)[count++] = list2[size2];
- free(list1);
- }
-
- return (0);
-}
-
-/*
- * list_locate() iterates through the list passed in and uses the comparison
- * routine and element passed in to find an element in the list. It
- * returns the first element matched, or NULL if none exists
- */
-void *
-list_locate(void **list, int (*compare)(void *, void *), void *element)
-{
- int current = 0;
-
- if ((list != NULL) && (element != NULL))
- for (current = 0; list[current] != NULL; current++)
- if ((compare)(list[current], element) == 0)
- return (list[current]);
- return (NULL);
-}
-
-void
-list_remove(void ***list, void *item)
-{
- int i = 0, count;
-
- if ((list == NULL) || (*list == NULL) || (item == NULL))
- return;
-
- /* size the original list */
- for (count = 0; (*list)[count] != NULL; count++)
- if ((*list)[count] == item) { /* mark the location of item */
- i = count;
- item = NULL;
- }
-
- /* if found, remove it */
- if (item == NULL) {
- /* shift the list over the item */
- for (++i; ((*list)[i] != NULL); i++)
- (*list)[i-1] = (*list)[i];
- (*list)[i-1] = NULL;
- }
-
- /* if found, removed, and list should shrink, shrink it */
- if ((item == NULL) && (LIST_SIZE(i) < LIST_SIZE(count))) {
- void **tmp = (void **)calloc(LIST_SIZE(i), sizeof (void *));
-
- if (tmp != NULL) {
- for (i = 0; (*list)[i] != NULL; i++)
- tmp[i] = (*list)[i];
- free(*list);
- *list = tmp;
- }
- }
-}
diff --git a/usr/src/lib/print/libpapi-common/common/mapfile b/usr/src/lib/print/libpapi-common/common/mapfile
deleted file mode 100644
index c1f9e3f1ab..0000000000
--- a/usr/src/lib/print/libpapi-common/common/mapfile
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# 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
-# or http://www.opensolaris.org/os/licensing.
-# 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 (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# $Id: mapfile.in,v 1.2 2006/03/02 06:31:36 njacobs Exp $
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-#
-# Common interfaces that are most likely to be shared amongst the various
-# PAPI implementations.
-#
-
-SYMBOL_VERSION SUNW_1.0 {
- global:
- # PAPI Attribute Calls
- papiAttributeListAddValue;
- papiAttributeListAddBoolean;
- papiAttributeListAddCollection;
- papiAttributeListAddDatetime;
- papiAttributeListAddInteger;
- papiAttributeListAddMetadata;
- papiAttributeListAddRange;
- papiAttributeListAddResolution;
- papiAttributeListAddString;
- papiAttributeListDelete;
- papiAttributeListGetValue;
- papiAttributeListGetNext;
- papiAttributeListFind;
- papiAttributeListGetBoolean;
- papiAttributeListGetCollection;
- papiAttributeListGetDatetime;
- papiAttributeListGetInteger;
- papiAttributeListGetMetadata;
- papiAttributeListGetRange;
- papiAttributeListGetResolution;
- papiAttributeListGetString;
- papiAttributeListFromString;
- papiAttributeListToString;
- papiAttributeListFree;
-
- # PAPI Service Calls
- papiServiceCreate { FLAGS = NODYNSORT };
- papiServiceDestroy { FLAGS = NODYNSORT };
- papiServiceSetUserName { FLAGS = NODYNSORT };
- papiServiceSetPassword { FLAGS = NODYNSORT };
- papiServiceSetEncryption { FLAGS = NODYNSORT };
- papiServiceSetAuthCB { FLAGS = NODYNSORT };
- papiServiceSetAppData { FLAGS = NODYNSORT };
- papiServiceGetUserName { FLAGS = NODYNSORT };
- papiServiceGetPassword { FLAGS = NODYNSORT };
- papiServiceGetEncryption;
- papiServiceGetAppData { FLAGS = NODYNSORT };
- papiServiceGetServiceName { FLAGS = NODYNSORT };
- papiServiceGetAttributeList { FLAGS = NODYNSORT };
- papiServiceGetStatusMessage { FLAGS = NODYNSORT };
-
- # PAPI Printer Calls
- papiPrintersList { FLAGS = NODYNSORT };
- papiPrinterQuery { FLAGS = NODYNSORT };
- papiPrinterAdd { FLAGS = NODYNSORT };
- papiPrinterModify { FLAGS = NODYNSORT };
- papiPrinterRemove { FLAGS = NODYNSORT };
- papiPrinterDisable { FLAGS = NODYNSORT };
- papiPrinterEnable { FLAGS = NODYNSORT };
- papiPrinterPause { FLAGS = NODYNSORT };
- papiPrinterResume { FLAGS = NODYNSORT };
- papiPrinterPurgeJobs { FLAGS = NODYNSORT };
- papiPrinterListJobs { FLAGS = NODYNSORT };
- papiPrinterGetAttributeList { FLAGS = NODYNSORT };
- papiPrinterFree { FLAGS = NODYNSORT };
- papiPrinterListFree { FLAGS = NODYNSORT };
-
- # PAPI Job Calls
- papiJobSubmit { FLAGS = NODYNSORT };
- papiJobSubmitByReference { FLAGS = NODYNSORT };
- papiJobValidate { FLAGS = NODYNSORT };
- papiJobStreamOpen { FLAGS = NODYNSORT };
- papiJobStreamWrite { FLAGS = NODYNSORT };
- papiJobStreamClose { FLAGS = NODYNSORT };
- papiJobQuery { FLAGS = NODYNSORT };
- papiJobModify { FLAGS = NODYNSORT };
- papiJobMove { FLAGS = NODYNSORT };
- papiJobCancel { FLAGS = NODYNSORT };
- papiJobHold { FLAGS = NODYNSORT };
- papiJobRelease { FLAGS = NODYNSORT };
- papiJobRestart { FLAGS = NODYNSORT };
- papiJobPromote { FLAGS = NODYNSORT };
- papiJobGetAttributeList { FLAGS = NODYNSORT };
- papiJobGetPrinterName { FLAGS = NODYNSORT };
- papiJobGetId;
- papiJobGetJobTicket { FLAGS = NODYNSORT };
- papiJobFree { FLAGS = NODYNSORT };
- papiJobListFree { FLAGS = NODYNSORT };
-
- # Misc. PAPI Calls
- papiStatusString;
- papiLibrarySupportedCall;
- papiLibrarySupportedCalls;
-};
-
-SYMBOL_VERSION SUNWprivate_1.0 { # Misc. semi-private supporting calls
- global:
- papiServiceSetPeer { FLAGS = NODYNSORT };
- papiJobCreate { FLAGS = NODYNSORT };
- papiJobStreamAdd { FLAGS = NODYNSORT };
- papiJobCommit { FLAGS = NODYNSORT };
-
- # URI
- uri_from_string;
- uri_to_string;
- uri_free;
-
- # list
- list_remove;
- list_append;
- list_concatenate;
-
- # NS
- getprinterbyname { FLAGS = NODYNSORT };
-
- # extra Attribute Calls
- copy_attributes;
- split_and_copy_attributes;
- papiAttributeListPrint;
-
- is_localhost;
-
- local:
- *;
-};
diff --git a/usr/src/lib/print/libpapi-common/common/misc.c b/usr/src/lib/print/libpapi-common/common/misc.c
deleted file mode 100644
index 2688fd0ec0..0000000000
--- a/usr/src/lib/print/libpapi-common/common/misc.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: misc.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <papi.h>
-#include <uri.h>
-#include <config-site.h>
-
-/*
- * The implementations of strlcpy() and strlcat() have been taken directly
- * from OpenSolaris. The contents of this file originated from
- * usr/src/lib/libc/port/gen/strlcpy.c
- * usr/src/lib/libc/port/gen/strcat.c
- */
-
-#ifndef HAVE_STRLCPY
-size_t
-strlcpy(char *dst, const char *src, size_t len)
-{
- size_t slen = strlen(src);
- size_t copied;
-
- if (len == 0)
- return (slen);
-
- if (slen >= len)
- copied = len - 1;
- else
- copied = slen;
- (void) memcpy(dst, src, copied);
- dst[copied] = '\0';
- return (slen);
-}
-#endif
-
-#ifndef HAVE_STRLCAT
-size_t
-strlcat(char *dst, const char *src, size_t dstsize)
-{
- char *df = dst;
- size_t left = dstsize;
- size_t l1;
- size_t l2 = strlen(src);
- size_t copied;
-
- while (left-- != 0 && *df != '\0')
- df++;
- l1 = df - dst;
- if (dstsize == l1)
- return (l1 + l2);
-
- copied = l1 + l2 >= dstsize ? dstsize - l1 - 1 : l2;
- (void) memcpy(dst + l1, src, copied);
- dst[l1+copied] = '\0';
- return (l1 + l2);
-}
-#endif
-
-#if defined(__sun) && defined(__SVR4)
-#include <sys/systeminfo.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/sockio.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-static struct in6_addr **
-local_interfaces()
-{
- struct in6_addr **result = NULL;
- int s;
- struct lifnum n;
- struct lifconf c;
- struct lifreq *r;
- int count;
-
- /* we need a socket to get the interfaces */
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- return (0);
-
- /* get the number of interfaces */
- memset(&n, 0, sizeof (n));
- n.lifn_family = AF_UNSPEC;
- if (ioctl(s, SIOCGLIFNUM, (char *)&n) < 0) {
- close(s);
- return (0); /* no interfaces */
- }
-
- /* get the interface(s) configuration */
- memset(&c, 0, sizeof (c));
- c.lifc_family = AF_UNSPEC;
- c.lifc_buf = calloc(n.lifn_count, sizeof (struct lifreq));
- c.lifc_len = (n.lifn_count * sizeof (struct lifreq));
- if (ioctl(s, SIOCGLIFCONF, (char *)&c) < 0) {
- free(c.lifc_buf);
- close(s);
- return (0); /* can't get interface(s) configuration */
- }
- close(s);
-
- r = c.lifc_req;
- for (count = c.lifc_len / sizeof (struct lifreq);
- count > 0; count--, r++) {
- struct in6_addr v6[1], *addr = NULL;
-
- switch (r->lifr_addr.ss_family) {
- case AF_INET: {
- struct sockaddr_in *s =
- (struct sockaddr_in *)&r->lifr_addr;
- IN6_INADDR_TO_V4MAPPED(&s->sin_addr, v6);
- addr = v6;
- }
- break;
- case AF_INET6: {
- struct sockaddr_in6 *s =
- (struct sockaddr_in6 *)&r->lifr_addr;
- addr = &s->sin6_addr;
- }
- break;
- }
-
- if (addr != NULL) {
- struct in6_addr *a = malloc(sizeof (*a));
-
- memcpy(a, addr, sizeof (*a));
- list_append(&result, a);
- }
- }
- free(c.lifc_buf);
-
- return (result);
-}
-
-static int
-match_interfaces(char *host)
-{
- struct in6_addr **lif = local_interfaces();
- struct hostent *hp;
- int rc = 0;
- int errnum;
-
- /* are there any local interfaces */
- if (lif == NULL)
- return (0);
-
- /* cycle through the host db addresses */
- hp = getipnodebyname(host, AF_INET6, AI_ALL|AI_V4MAPPED, &errnum);
- if (hp != NULL) {
- struct in6_addr **tmp = (struct in6_addr **)hp->h_addr_list;
- int i;
-
- for (i = 0; ((rc == 0) && (tmp[i] != NULL)); i++) {
- int j;
-
- for (j = 0; ((rc == 0) && (lif[j] != NULL)); j++)
- if (memcmp(tmp[i], lif[j],
- sizeof (struct in6_addr)) == 0)
- rc = 1;
- }
- }
- free(lif);
-
- return (rc);
-}
-#endif
-
-int
-is_localhost(char *host)
-{
- char hostname[BUFSIZ];
-
- /* is it "localhost" */
- if (strncasecmp(host, "localhost", 10) == 0)
- return (1);
-
- /* is it the {nodename} */
- sysinfo(SI_HOSTNAME, hostname, sizeof (hostname));
- if (strncasecmp(host, hostname, strlen(hostname)) == 0)
- return (1);
-
-#if defined(__sun) && defined(__SVR4)
- /* does it match one of the host's configured interfaces */
- if (match_interfaces(host) != 0)
- return (1);
-#endif
- return (0);
-}
diff --git a/usr/src/lib/print/libpapi-common/common/papi.h b/usr/src/lib/print/libpapi-common/common/papi.h
deleted file mode 100644
index 5fcaccc584..0000000000
--- a/usr/src/lib/print/libpapi-common/common/papi.h
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _PAPI_H
-#define _PAPI_H
-
-/* $Id: papi.h 161 2006-05-03 04:32:59Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <time.h>
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Types
- */
-
-/* service related types */
-typedef void *papi_service_t;
-typedef void *papi_printer_t;
-typedef void *papi_job_t;
-typedef void *papi_stream_t;
-
-typedef enum {
- PAPI_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
- PAPI_ENCRYPT_NEVER, /* Never encrypt */
- PAPI_ENCRYPT_REQUIRED, /* Encryption required (TLS upgrade) */
- PAPI_ENCRYPT_ALWAYS /* Always encrypt (SSL) */
-} papi_encryption_t;
-
-/* attribute related types */
-typedef enum {
- PAPI_STRING,
- PAPI_INTEGER,
- PAPI_BOOLEAN,
- PAPI_RANGE,
- PAPI_RESOLUTION,
- PAPI_DATETIME,
- PAPI_COLLECTION,
- PAPI_METADATA
-} papi_attribute_value_type_t;
-
-typedef enum {
- PAPI_RES_PER_INCH = 3,
- PAPI_RES_PER_CM
-} papi_resolution_unit_t;
-
-enum { /* for boolean values */
- PAPI_FALSE = 0,
- PAPI_TRUE = 1
-};
-
-typedef enum {
- PAPI_UNSUPPORTED = 0x10,
- PAPI_DEFAULT = 0x11,
- PAPI_UNKNOWN,
- PAPI_NO_VALUE,
- PAPI_NOT_SETTABLE = 0x15,
- PAPI_DELETE = 0x16
-} papi_metadata_t;
-
-#define PAPI_LIST_JOBS_OTHERS 0x0001
-#define PAPI_LIST_JOBS_COMPLETED 0x0002
-#define PAPI_LIST_JOBS_NOT_COMPLETED 0x0004
-#define PAPI_LIST_JOBS_ALL 0xFFFF
-
-typedef struct papi_attribute_s papi_attribute_t;
-
-typedef union {
- char *string; /* PAPI_STRING value */
- int integer; /* PAPI_INTEGER value */
- char boolean; /* PAPI_BOOLEAN value */
- struct { /* PAPI_RANGE value */
- int lower;
- int upper;
- } range;
- struct { /* PAPI_RESOLUTION value */
- int xres;
- int yres;
- papi_resolution_unit_t units;
- } resolution;
- time_t datetime; /* PAPI_DATETIME value */
- papi_attribute_t **collection; /* PAPI_COLLECTION value */
- papi_metadata_t metadata; /* PAPI_METADATA value */
-} papi_attribute_value_t;
-
-struct papi_attribute_s {
- char *name; /* attribute name */
- papi_attribute_value_type_t type; /* type of values */
- papi_attribute_value_t **values; /* list of values */
-};
-
-#define PAPI_ATTR_APPEND 0x0001 /* Add values to attr */
-#define PAPI_ATTR_REPLACE 0x0002 /* Delete existing values, then add */
-#define PAPI_ATTR_EXCL 0x0004 /* Fail if attr exists */
-
-/* job related types */
-typedef enum {
- PAPI_JT_FORMAT_JDF = 0,
- PAPI_JT_FORMAT_PWG = 1
-} papi_jt_format_t;
-
-typedef struct {
- papi_jt_format_t format;
- char *ticket_data;
- char *file_name;
-} papi_job_ticket_t;
-
-/* status related types */
-typedef enum {
- PAPI_OK = 0x0000,
- PAPI_OK_SUBST,
- PAPI_OK_CONFLICT,
- PAPI_OK_IGNORED_SUBSCRIPTIONS,
- PAPI_OK_IGNORED_NOTIFICATIONS,
- PAPI_OK_TOO_MANY_EVENTS,
- PAPI_OK_BUT_CANCEL_SUBSCRIPTION,
- PAPI_REDIRECTION_OTHER_SITE = 0x0300,
- PAPI_BAD_REQUEST = 0x0400,
- PAPI_FORBIDDEN,
- PAPI_NOT_AUTHENTICATED,
- PAPI_NOT_AUTHORIZED,
- PAPI_NOT_POSSIBLE,
- PAPI_TIMEOUT,
- PAPI_NOT_FOUND,
- PAPI_GONE,
- PAPI_REQUEST_ENTITY,
- PAPI_REQUEST_VALUE,
- PAPI_DOCUMENT_FORMAT,
- PAPI_ATTRIBUTES,
- PAPI_URI_SCHEME,
- PAPI_CHARSET,
- PAPI_CONFLICT,
- PAPI_COMPRESSION_NOT_SUPPORTED,
- PAPI_COMPRESSION_ERROR,
- PAPI_DOCUMENT_FORMAT_ERROR,
- PAPI_DOCUMENT_ACCESS_ERROR,
- PAPI_ATTRIBUTES_NOT_SETTABLE,
- PAPI_IGNORED_ALL_SUBSCRIPTIONS,
- PAPI_TOO_MANY_SUBSCRIPTIONS,
- PAPI_IGNORED_ALL_NOTIFICATIONS,
- PAPI_PRINT_SUPPORT_FILE_NOT_FOUND,
- PAPI_INTERNAL_ERROR = 0x0500,
- PAPI_OPERATION_NOT_SUPPORTED,
- PAPI_SERVICE_UNAVAILABLE,
- PAPI_VERSION_NOT_SUPPORTED,
- PAPI_DEVICE_ERROR,
- PAPI_TEMPORARY_ERROR,
- PAPI_NOT_ACCEPTING,
- PAPI_PRINTER_BUSY,
- PAPI_ERROR_JOB_CANCELLED,
- PAPI_MULTIPLE_JOBS_NOT_SUPPORTED,
- PAPI_PRINTER_IS_DEACTIVATED,
- PAPI_BAD_ARGUMENT,
- PAPI_JOB_TICKET_NOT_SUPPORTED
-} papi_status_t;
-
-/* list filter related */
-typedef enum {
- PAPI_FILTER_BITMASK = 0
-} papi_filter_type_t;
-
-typedef struct {
- papi_filter_type_t type;
- union {
- struct { /* PAPI_FILTER_BITMASK */
- unsigned int mask;
- unsigned int value;
- } bitmask;
- } filter;
-} papi_filter_t;
-
-enum {
- PAPI_PRINTER_LOCAL = 0x0000, /* Local destination */
- PAPI_PRINTER_CLASS = 0x0001, /* Printer class */
- PAPI_PRINTER_REMOTE = 0x0002, /* Remote destination */
- PAPI_PRINTER_BW = 0x0004, /* Can do B&W printing */
- PAPI_PRINTER_COLOR = 0x0008, /* Can do color printing */
- PAPI_PRINTER_DUPLEX = 0x0010, /* Can do duplex printing */
- PAPI_PRINTER_STAPLE = 0x0020, /* Can do stapling */
- PAPI_PRINTER_COPIES = 0x0040, /* Can do copies */
- PAPI_PRINTER_COLLATE = 0x0080, /* Can collate copies */
- PAPI_PRINTER_PUNCH = 0x0100, /* Can punch output */
- PAPI_PRINTER_COVER = 0x0200, /* Can cover output */
- PAPI_PRINTER_BIND = 0x0400, /* Can bind output */
- PAPI_PRINTER_SORT = 0x0800, /* Can sort output */
- PAPI_PRINTER_SMALL = 0x1000, /* Can do letter/legal/a4 */
- PAPI_PRINTER_MEDIUM = 0x2000, /* Can do tabloid/B/C/A3/A2 */
- PAPI_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */
- PAPI_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */
- PAPI_PRINTER_IMPLICIT = 0x10000, /* implicit class */
- PAPI_PRINTER_DEFAULT = 0x20000, /* Default printer on network */
- PAPI_PRINTER_OPTIONS = 0xfffc /* ~ (CLASS | REMOTE | IMPLICIT) */
-};
-
-/*
- * Functions
- */
-
-/* Service related */
-extern papi_status_t papiServiceCreate(papi_service_t *handle,
- char *service_name, char *user_name,
- char *password,
- int (*authCB)(papi_service_t svc,
- void *app_data),
- papi_encryption_t encryption,
- void *app_data);
-extern void papiServiceDestroy(papi_service_t handle);
-extern papi_status_t papiServiceSetUserName(papi_service_t handle,
- char *user_name);
-extern papi_status_t papiServiceSetPassword(papi_service_t handle,
- char *password);
-extern papi_status_t papiServiceSetEncryption(papi_service_t handle,
- papi_encryption_t encryption);
-extern papi_status_t papiServiceSetAuthCB(papi_service_t handle,
- int (*authCB)(papi_service_t s,
- void *app_data));
-extern papi_status_t papiServiceSetAppData(papi_service_t handle,
- void *app_data);
-extern char *papiServiceGetServiceName(papi_service_t handle);
-extern char *papiServiceGetUserName(papi_service_t handle);
-extern char *papiServiceGetPassword(papi_service_t handle);
-extern papi_encryption_t papiServiceGetEncryption(papi_service_t handle);
-extern void *papiServiceGetAppData(papi_service_t handle);
-extern papi_attribute_t **papiServiceGetAttributeList(papi_service_t handle);
-extern char *papiServiceGetStatusMessage(papi_service_t handle);
-
-/* Attribute related */
-extern papi_status_t papiAttributeListAddValue(papi_attribute_t ***attrs,
- int flags, char *name,
- papi_attribute_value_type_t type,
- papi_attribute_value_t *value);
-extern papi_status_t papiAttributeListAddString(papi_attribute_t ***attrs,
- int flags, char *name, char *string);
-extern papi_status_t papiAttributeListAddInteger(papi_attribute_t ***attrs,
- int flags, char *name, int integer);
-extern papi_status_t papiAttributeListAddBoolean(papi_attribute_t ***attrs,
- int flags, char *name, char boolean);
-extern papi_status_t papiAttributeListAddRange(papi_attribute_t ***attrs,
- int flags, char *name,
- int lower, int upper);
-extern papi_status_t papiAttributeListAddResolution(papi_attribute_t ***attrs,
- int flags, char *name,
- int xres, int yres,
- papi_resolution_unit_t units);
-extern papi_status_t papiAttributeListAddDatetime(papi_attribute_t ***attrs,
- int flags, char *name, time_t datetime);
-extern papi_status_t papiAttributeListAddCollection(papi_attribute_t ***attrs,
- int flags, char *name,
- papi_attribute_t **collection);
-extern papi_status_t papiAttributeListAddMetadata(papi_attribute_t ***attrs,
- int flags, char *name,
- papi_metadata_t metadata);
-extern papi_status_t papiAttributeListDelete(papi_attribute_t ***attributes,
- char *name);
-extern papi_status_t papiAttributeListGetValue(papi_attribute_t **list,
- void **iterator, char *name,
- papi_attribute_value_type_t type,
- papi_attribute_value_t **value);
-extern papi_status_t papiAttributeListGetString(papi_attribute_t **list,
- void **iterator, char *name,
- char **vptr);
-extern papi_status_t papiAttributeListGetInteger(papi_attribute_t **list,
- void **iterator, char *name, int *vptr);
-extern papi_status_t papiAttributeListGetBoolean(papi_attribute_t **list,
- void **iterator, char *name,
- char *vptr);
-extern papi_status_t papiAttributeListGetRange(papi_attribute_t **list,
- void **iterator, char *name,
- int *min, int *max);
-extern papi_status_t papiAttributeListGetResolution(papi_attribute_t **list,
- void **iterator, char *name,
- int *x, int *y,
- papi_resolution_unit_t *units);
-extern papi_status_t papiAttributeListGetDatetime(papi_attribute_t **list,
- void **iterator, char *name,
- time_t *dt);
-extern papi_status_t papiAttributeListGetCollection(papi_attribute_t **list,
- void **iterator, char *name,
- papi_attribute_t ***collection);
-extern papi_status_t papiAttributeListGetMetadata(papi_attribute_t **list,
- void **iterator, char *name,
- papi_metadata_t *vptr);
-extern papi_attribute_t *papiAttributeListFind(papi_attribute_t **list,
- char *name);
-extern papi_attribute_t *papiAttributeListGetNext(papi_attribute_t **list,
- void **iterator);
-extern void papiAttributeListFree(papi_attribute_t **attributes);
-
-extern papi_status_t papiAttributeListFromString(papi_attribute_t ***attrs,
- int flags, char *string);
-extern papi_status_t papiAttributeListToString(papi_attribute_t **attrs,
- char *delim,
- char *buffer, size_t buflen);
-extern void papiAttributeListPrint(FILE *fp, papi_attribute_t **list,
- char *prefix_fmt, ...);
-
-/* Printer related */
-extern papi_status_t papiPrintersList(papi_service_t handle,
- char **requested_attrs,
- papi_filter_t *filter,
- papi_printer_t **printers);
-extern papi_status_t papiPrinterQuery(papi_service_t handle, char *name,
- char **requested_attrs,
- papi_attribute_t **job_attributes,
- papi_printer_t *printer);
-extern papi_status_t papiPrinterAdd(papi_service_t handle, char *name,
- papi_attribute_t **attributes,
- papi_printer_t *printer);
-extern papi_status_t papiPrinterModify(papi_service_t handle, char *name,
- papi_attribute_t **attributes,
- papi_printer_t *printer);
-extern papi_status_t papiPrinterRemove(papi_service_t handle, char *name);
-extern papi_status_t papiPrinterDisable(papi_service_t handle, char *name,
- char *message);
-extern papi_status_t papiPrinterEnable(papi_service_t handle, char *name);
-extern papi_status_t papiPrinterPause(papi_service_t handle, char *name,
- char *message);
-extern papi_status_t papiPrinterResume(papi_service_t handle, char *name);
-extern papi_status_t papiPrinterPurgeJobs(papi_service_t handle,
- char *name, papi_job_t **jobs);
-extern papi_status_t papiPrinterListJobs(papi_service_t handle,
- char *name, char **requested_attrs,
- int type_mask, int max_num_jobs,
- papi_job_t **jobs);
-extern papi_attribute_t **papiPrinterGetAttributeList(papi_printer_t printer);
-extern void papiPrinterFree(papi_printer_t printer);
-extern void papiPrinterListFree(papi_printer_t *printers);
-
-/* Job related */
-extern papi_status_t papiJobSubmit(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job);
-extern papi_status_t papiJobSubmitByReference(papi_service_t handle,
- char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job);
-extern papi_status_t papiJobValidate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job);
-extern papi_status_t papiJobStreamOpen(papi_service_t handle,
- char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- papi_stream_t *stream);
-extern papi_status_t papiJobStreamWrite(papi_service_t handle,
- papi_stream_t stream,
- void *buffer, size_t buflen);
-extern papi_status_t papiJobStreamClose(papi_service_t handle,
- papi_stream_t stream,
- papi_job_t *job);
-extern papi_status_t papiJobQuery(papi_service_t handle, char *printer,
- int32_t job_id, char **requested_attrs,
- papi_job_t *job);
-extern papi_status_t papiJobModify(papi_service_t handle, char *printer,
- int32_t job_id,
- papi_attribute_t **attributes,
- papi_job_t *job);
-extern papi_status_t papiJobMove(papi_service_t handle, char *printer,
- int32_t job_id, char *destination);
-extern papi_status_t papiJobCancel(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobHold(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobRelease(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobRestart(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobPromote(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_attribute_t **papiJobGetAttributeList(papi_job_t printer);
-extern char *papiJobGetPrinterName(papi_job_t printer);
-extern int32_t papiJobGetId(papi_job_t printer);
-extern papi_job_ticket_t *papiJobGetJobTicket(papi_job_t printer);
-extern void papiJobFree(papi_job_t job);
-extern void papiJobListFree(papi_job_t *jobs);
-
-#ifdef SOLARIS_PRIVATE_POST_0_9
-/*
- * These have been added to support IPP create-job/send-document with PAPI v0.9
- * in an IPP listener using PAPI as it's spooler interface. A future version
- * of the API is expected to support this type of functionality
- */
-extern papi_status_t papiJobCreate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- papi_job_t *job);
-extern papi_status_t papiJobStreamAdd(papi_service_t handle, char *printer,
- int32_t id, papi_stream_t *stream);
-extern papi_status_t papiJobCommit(papi_service_t handle, char *printer,
- int32_t id);
-extern papi_status_t papiServiceSetPeer(papi_service_t handle, int peerfd);
-#endif /* SOLARIS_PRIVATE_POST_0_9 */
-
-extern char *papiStatusString(papi_status_t status);
-
-/*
- * Internal functions that aren't in the API, but are shared across
- * protocol support implementations(psms) and the tightly bound
- * listener library. Do not use these in your applications.
- */
-extern void list_append();
-extern void list_concatenate();
-extern void list_remove();
-extern void copy_attributes(papi_attribute_t ***result,
- papi_attribute_t **list);
-extern void split_and_copy_attributes(char **list,
- papi_attribute_t **attributes,
- papi_attribute_t ***in,
- papi_attribute_t ***out);
-
-extern papi_attribute_t **getprinterbyname(char *name, char *ns);
-
-extern int is_localhost(char *hostname);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PAPI_H */
diff --git a/usr/src/lib/print/libpapi-common/common/status.c b/usr/src/lib/print/libpapi-common/common/status.c
deleted file mode 100644
index 897aa1322d..0000000000
--- a/usr/src/lib/print/libpapi-common/common/status.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: status.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdlib.h>
-#include <papi.h>
-#include <libintl.h>
-
-char *
-papiStatusString(const papi_status_t status)
-{
- switch (status) {
- case PAPI_OK:
- return (gettext("ok"));
- case PAPI_OK_SUBST:
- return (gettext("ok-substitution"));
- case PAPI_OK_CONFLICT:
- return (gettext("ok-conflict"));
- case PAPI_OK_IGNORED_SUBSCRIPTIONS:
- return (gettext("ok-ignored-subscriptions"));
- case PAPI_OK_IGNORED_NOTIFICATIONS:
- return (gettext("ok-ignored-notifications"));
- case PAPI_OK_TOO_MANY_EVENTS:
- return (gettext("ok-too-many-events"));
- case PAPI_OK_BUT_CANCEL_SUBSCRIPTION:
- return (gettext("ok-but-cancel-subscription"));
- case PAPI_REDIRECTION_OTHER_SITE:
- return (gettext("redirection-to-other-site"));
- case PAPI_BAD_REQUEST:
- return (gettext("bad-request"));
- case PAPI_FORBIDDEN:
- return (gettext("forbidden"));
- case PAPI_NOT_AUTHENTICATED:
- return (gettext("not-authenticated"));
- case PAPI_NOT_AUTHORIZED:
- return (gettext("not-authorized"));
- case PAPI_NOT_POSSIBLE:
- return (gettext("not-possible"));
- case PAPI_TIMEOUT:
- return (gettext("timeout"));
- case PAPI_NOT_FOUND:
- return (gettext("not-found"));
- case PAPI_GONE:
- return (gettext("gone"));
- case PAPI_REQUEST_ENTITY:
- return (gettext("request-entity"));
- case PAPI_REQUEST_VALUE:
- return (gettext("request-value"));
- case PAPI_DOCUMENT_FORMAT:
- return (gettext("document-format"));
- case PAPI_ATTRIBUTES:
- return (gettext("attributes"));
- case PAPI_URI_SCHEME:
- return (gettext("uri-scheme"));
- case PAPI_CHARSET:
- return (gettext("charset"));
- case PAPI_CONFLICT:
- return (gettext("conflict"));
- case PAPI_COMPRESSION_NOT_SUPPORTED:
- return (gettext("compression-not-supported"));
- case PAPI_COMPRESSION_ERROR:
- return (gettext("compression-error"));
- case PAPI_DOCUMENT_FORMAT_ERROR:
- return (gettext("document-format-error"));
- case PAPI_DOCUMENT_ACCESS_ERROR:
- return (gettext("document-access-error"));
- case PAPI_ATTRIBUTES_NOT_SETTABLE:
- return (gettext("attributes-not-settable"));
- case PAPI_IGNORED_ALL_SUBSCRIPTIONS:
- return (gettext("ignored-all-subscriptions"));
- case PAPI_TOO_MANY_SUBSCRIPTIONS:
- return (gettext("too-many-subscriptions"));
- case PAPI_IGNORED_ALL_NOTIFICATIONS:
- return (gettext("ignored-all-notifications"));
- case PAPI_PRINT_SUPPORT_FILE_NOT_FOUND:
- return (gettext("print-support-file-not-found"));
- case PAPI_INTERNAL_ERROR:
- return (gettext("internal-error"));
- case PAPI_OPERATION_NOT_SUPPORTED:
- return (gettext("operation-not-supported"));
- case PAPI_SERVICE_UNAVAILABLE:
- return (gettext("service-unavailable"));
- case PAPI_VERSION_NOT_SUPPORTED:
- return (gettext("version-not-supported"));
- case PAPI_DEVICE_ERROR:
- return (gettext("device-error"));
- case PAPI_TEMPORARY_ERROR:
- return (gettext("temporary-error"));
- case PAPI_NOT_ACCEPTING:
- return (gettext("not-accepting"));
- case PAPI_PRINTER_BUSY:
- return (gettext("printer-busy"));
- case PAPI_ERROR_JOB_CANCELLED:
- return (gettext("error-job-cancelled"));
- case PAPI_MULTIPLE_JOBS_NOT_SUPPORTED:
- return (gettext("multiple-jobs-not-supported"));
- case PAPI_PRINTER_IS_DEACTIVATED:
- return (gettext("printer-is-deactivated"));
- case PAPI_BAD_ARGUMENT:
- return (gettext("bad-argument"));
- case PAPI_JOB_TICKET_NOT_SUPPORTED:
- return (gettext("job-ticket-not-supported"));
- default:
- return (gettext("unknown-error"));
- }
-}
diff --git a/usr/src/lib/print/libpapi-common/common/uri.c b/usr/src/lib/print/libpapi-common/common/uri.c
deleted file mode 100644
index 31f6ce4eff..0000000000
--- a/usr/src/lib/print/libpapi-common/common/uri.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/* $Id: uri.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <errno.h>
-#include "uri.h"
-
-/*
- * This will handle the following forms:
- * scheme:scheme_data
- * scheme://[[user[:password]@]host[:port]]/path[[#fragment]|[?query]]
- */
-int
-uri_from_string(char *string, uri_t **uri)
-{
- char *ptr;
- uri_t *u;
-
- if ((string == NULL) || (uri == NULL)) {
- errno = EINVAL;
- return (-1);
- }
-
- /* find the scheme:scheme_part split */
- if ((ptr = strchr(string, ':')) == NULL) {
- errno = EINVAL;
- return (-1);
- }
-
- if ((*uri = u = calloc(1, sizeof (*u))) == NULL)
- return (-1);
-
- u->scheme = strndup(string, ptr - string);
-
- if ((ptr[1] == '/') && (ptr[2] == '/')) {
- /*
- * CSTYLED
- * scheme://[host_part]/[path_part]
- */
- char *end = NULL, *user = NULL, *host = NULL, *path = NULL;
-
- string = ptr + 3; /* skip the :// */
-
- if ((path = end = strchr(string, '/')) == NULL)
- for (end = string; *end != '\0'; end++)
- continue;
-
- u->host_part = strndup(string, end - string);
-
- for (host = string; host < end; host ++)
- if (*host == '@') {
- /* string to host is the user part */
- u->user_part = strndup(string, host-string);
- /* host+1 to end is the host part */
- u->host_part = strndup(host + 1,
- end - (host+1));
- user = string;
- host++;
- break;
- }
-
- if (user != NULL) {
- char *password = NULL;
-
- for (password = user; (password < host - 1); password++)
- if (*password == ':') {
- u->password = strndup(password + 1,
- host - password - 2);
- break;
- }
- u->user = strndup(user, password - user);
- } else
- host = string;
-
- if (host != NULL) {
- char *port = NULL;
-
- for (port = host; (port < path); port++)
- if ((*port == ':') || (*port == '/'))
- break;
-
- if (port < path) {
- u->port = strndup(port + 1, path - port - 1);
- }
-
- u->host = strndup(host, port - host);
- }
-
- if (path != NULL) {
- char *name = strrchr(path, '/');
-
- u->path_part = strdup(path);
-
- if (name != NULL) {
- char *query, *fragment;
-
- query = strrchr(name, '?');
- if ((query != NULL) && (*query != '\0')) {
- u->query = strdup(query + 1);
- end = query;
- } else {
- for (end = path; *end != '\0'; end++)
- continue;
- }
-
- fragment = strrchr(name, '#');
- if ((fragment != NULL) && (*fragment != '\0')) {
- u->fragment = strndup(fragment + 1,
- end - fragment - 1);
- end = fragment;
- }
-
- u->path = strndup(path, end - path);
- }
- }
- } else { /* scheme:scheme_part */
- u->scheme_part = strdup(&ptr[1]);
- }
-
- if ((u->host_part == NULL) && (u->path_part == NULL) &&
- (u->scheme_part == NULL)) {
- errno = EINVAL;
- uri_free(u);
- *uri = NULL;
- return (-1);
- }
-
- return (0);
-}
-
-int
-uri_to_string(uri_t *uri, char *buffer, size_t buflen)
-{
- char *uri_ppfix;
-
- if ((uri == NULL) || (buffer == NULL) || (buflen == 0) ||
- (uri->scheme == NULL) ||
- ((uri->password != NULL) && (uri->user == NULL)) ||
- ((uri->user != NULL) && (uri->host == NULL)) ||
- ((uri->port != NULL) && (uri->host == NULL)) ||
- ((uri->fragment != NULL) && (uri->path == NULL)) ||
- ((uri->query != NULL) && (uri->path == NULL))) {
- errno = EINVAL;
- return (-1);
- }
- if (uri->path == NULL || uri->path[0] == '/')
- uri_ppfix = "";
- else
- uri_ppfix = "/";
-
- (void) memset(buffer, 0, buflen);
-
- if (uri->scheme_part == NULL) {
- (void) snprintf(buffer, buflen,
- "%s://%s%s%s%s%s%s%s%s%s%s%s%s%s",
- uri->scheme,
- (uri->user ? uri->user : ""),
- (uri->password ? ":" : ""),
- (uri->password ? uri->password : ""),
- (uri->user ? "@": ""),
- (uri->host ? uri->host : ""),
- (uri->port ? ":" : ""),
- (uri->port ? uri->port : ""),
- uri_ppfix,
- (uri->path ? uri->path : ""),
- (uri->fragment ? "#" : ""),
- (uri->fragment ? uri->fragment : ""),
- (uri->query ? "?" : ""),
- (uri->query ? uri->query : ""));
- } else {
- (void) snprintf(buffer, buflen, "%s:%s", uri->scheme,
- uri->scheme_part);
- }
-
- return (0);
-}
-
-void
-uri_free(uri_t *uri)
-{
- if (uri != NULL) {
- if (uri->scheme != NULL)
- free(uri->scheme);
- if (uri->scheme_part != NULL)
- free(uri->scheme_part);
- if (uri->user != NULL)
- free(uri->user);
- if (uri->password != NULL)
- free(uri->password);
- if (uri->host != NULL)
- free(uri->host);
- if (uri->port != NULL)
- free(uri->port);
- if (uri->path != NULL)
- free(uri->path);
- if (uri->fragment != NULL)
- free(uri->fragment);
- if (uri->query != NULL)
- free(uri->query);
- /* help me debug */
- if (uri->user_part != NULL)
- free(uri->user_part);
- if (uri->host_part != NULL)
- free(uri->host_part);
- if (uri->path_part != NULL)
- free(uri->path_part);
- free(uri);
- }
-}
-
-#ifdef DEADBEEF
-static void
-uri_dump(FILE *fp, uri_t *uri)
-{
- if (uri != NULL) {
- fprintf(fp, "URI:\n");
- if (uri->scheme != NULL)
- fprintf(fp, "scheme: %s\n", uri->scheme);
- if (uri->scheme_part != NULL)
- fprintf(fp, "scheme_part: %s\n", uri->scheme_part);
- if (uri->user != NULL)
- fprintf(fp, "user: %s\n", uri->user);
- if (uri->password != NULL)
- fprintf(fp, "password: %s\n", uri->password);
- if (uri->host != NULL)
- fprintf(fp, "host: %s\n", uri->host);
- if (uri->port != NULL)
- fprintf(fp, "port: %s\n", uri->port);
- if (uri->path != NULL)
- fprintf(fp, "path: %s\n", uri->path);
- if (uri->fragment != NULL)
- fprintf(fp, "fragment: %s\n", uri->fragment);
- if (uri->query != NULL)
- fprintf(fp, "query: %s\n", uri->query);
- /* help me debug */
- if (uri->user_part != NULL)
- fprintf(fp, "user_part: %s\n", uri->user_part);
- if (uri->host_part != NULL)
- fprintf(fp, "host_part: %s\n", uri->host_part);
- if (uri->path_part != NULL)
- fprintf(fp, "path_part: %s\n", uri->path_part);
- fflush(fp);
- }
-}
-
-int
-main(int argc, char *argv[])
-{
- uri_t *u = NULL;
-
- if (argc != 2) {
- fprintf(stderr, "Usage: %s uri\n", argv[0]);
- exit(1);
- }
-
- if (uri_from_string(argv[1], &u) == 0) {
- char buf[BUFSIZ];
-
- uri_dump(stdout, u);
- uri_to_string(u, buf, sizeof (buf));
- fprintf(stdout, "reconstituted: %s\n", buf);
-
- uri_to_string(u, buf, 12);
- fprintf(stdout, "reconstituted(12): %s\n", buf);
- } else
- printf(" failed for %s (%s)\n", argv[1], strerror(errno));
-
- exit(0);
-}
-#endif /* DEADBEEF */
diff --git a/usr/src/lib/print/libpapi-common/common/uri.h b/usr/src/lib/print/libpapi-common/common/uri.h
deleted file mode 100644
index 5dd714a199..0000000000
--- a/usr/src/lib/print/libpapi-common/common/uri.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _URI_H
-#define _URI_H
-
-/* $Id: uri.h 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * scheme://[[user[:password]@]host[:port]]/path[[#fragment]|[?query]]
- */
-typedef struct {
- char *scheme;
- char *scheme_part;
- char *user;
- char *password;
- char *host;
- char *port;
- char *path;
- char *fragment;
- char *query;
- /* really for testing, but left in */
- char *user_part;
- char *host_part;
- char *path_part;
-} uri_t;
-
-extern int uri_from_string(char *string, uri_t **uri);
-extern int uri_to_string(uri_t *uri, char *buffer, size_t buflen);
-extern void uri_free(uri_t *uri);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _URI_H */
diff --git a/usr/src/lib/print/libpapi-common/i386/Makefile b/usr/src/lib/print/libpapi-common/i386/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libpapi-common/i386/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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
-# or http://www.opensolaris.org/os/licensing.
-# 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 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libpapi-common/sparc/Makefile b/usr/src/lib/print/libpapi-common/sparc/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libpapi-common/sparc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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
-# or http://www.opensolaris.org/os/licensing.
-# 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 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)