setlist.c revision 5c51f1241dbbdf2656d0e10011981411ed0c9673
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <locale.h>
#include <libintl.h>
#include <pkglocs.h>
#include <pkglib.h>
#include "libinst.h"
int cl_NClasses = -1;
static int new_order;
static unsigned s_pathtype(char *class_name);
#define MALSIZ 64
#define ERR_MEMORY "memory allocation failure"
static struct cl_attr *
new_cl_attr(char *cl_name)
{
if (cl_handle == -1) {
"package class");
if (cl_handle == -1) {
return (NULL);
}
}
return (NULL);
}
return (class);
}
/* Insert a single class into the list. */
void
{
int i;
/* If the list is already there, scan for this item */
if (*listp) {
for (i = 0; (*listp)[i]; i++)
return;
} else {
i = 0;
}
/* Insert the new entry */
quit(99);
/* Point the passed pointer to the head of the list. */
}
/*
* Create a list of all classes involved in this installation as well as
* their attributes.
*/
int
{
char *pt;
int n;
int i;
int sn = -1;
/* Initialize the environment scanners. */
(void) s_pathtype(NULL);
n = 0;
/*
* This looks like a serious memory leak, however pkgmk depends on
* this creating a second list and forgetting any prior ones. The
* pkgmk utility does a reasonable job of keeping track of a prior
* list constructed from the prototype file using addlist() above.
* Perhaps this should be reviewed later, but I do not believe this
* to be a problem from what I've seen. - JST
*/
/* Isolate the first token. */
while (pt) {
sn = n;
/* Add new class to list. */
quit(99);
/* Next token. */
n++;
}
/*
* According to the ABI, if there is a class "none", it will be
* the first class to be installed. This insures that iff there
* is a class "none", it will be the first to be installed.
* If there is no class "none", nothing happens!
*/
new_order = 0;
/* Get the head of the array. */
if (sn > 0) {
for (i = sn; i > 0; i--)
list[0] = struct_ptr;
new_order++; /* the order is different now */
}
/* Point the passed pointer to the head of the list. */
return (n);
}
/* Process the class list from the caller. */
void
{
char *list_ptr;
/* If there is a list, process it; else skip it */
if (new_order) /* if list order changed ... */
/* ... tell the environment. */
}
}
}
int
cl_getn(void)
{
return (cl_NClasses);
}
/*
* Since the order may have changed, this puts the CLASSES list back into
* the environment in the precise order to be used.
*/
void
{
int i;
size_t j;
j = 1; /* room for ending null */
for (i = 0; list[i]; i++)
for (i = 1; list[i]; i++) {
}
}
}
int
{
int n;
for (n = 0; n < cl_NClasses; n++)
return (n);
return (-1);
}
/* Return source verification level for this class */
unsigned
{
return (0);
}
/* Return destination verify level for this class */
unsigned
{
return (0);
}
/* Return path argument type for this class. */
unsigned
{
return (0);
}
/* Return the class name associated with this class index */
char *
{
return (NULL);
}
void
{
int i;
int sn = -1;
if (cl_lst) {
if (sn == -1)
sn = cl_NClasses;
if (sn > 0) {
for (i = sn; i > 0; i--)
}
i = 1;
while (i < cl_NClasses) {
i++;
}
cl_Classes = cl_lst;
} else {
cl_Classes = NULL;
cl_NClasses = -1;
}
}
/*
* Scan the given environment variable for an occurrance of the given
* class name. Return 0 if not found or 1 if found.
*/
static unsigned
{
unsigned retval = 0;
char *test_class;
if (class_name && *class_name) {
/*
* If a prior getenv() has not failed and there is no
* environment string then get environment info on
* this parameter.
*/
if (*paramvalue == NULL)
(*noentry)++;
}
/* If there's something there, evaluate it. */
if (!(*noentry)) {
int n;
/*
* At this point we have a pointer to a
* substring within param that matches
* class_name for its length, but class_name
* may be a substring of the test_class, so
* we check that next.
*/
if (isspace(*(test_class + n)) ||
*(test_class + n) == '\0') {
retval = 1;
break;
}
if (*(++test_class) == '\0')
break;
}
}
}
return (retval);
}
/* Assign source path verification level to this class */
static unsigned
s_verify(char *class_name)
{
static int noentry;
static char *noverify;
noentry = 0;
} else {
&noentry))
return (NOVERIFY);
else
return (DEFAULT);
}
return (0);
}
/*
* Set destination verify to default. This is usually called by pkgdbmerg()
* in order to correct verification conflicts.
*/
void
cl_def_dverify(int idx)
{
}
/* Assign destination path verification level to this path. */
static unsigned
d_verify(char *class_name)
{
static int noentry;
static char *qkverify;
noentry = 0;
} else {
&noentry))
return (QKVERIFY);
else
return (DEFAULT);
}
return (0);
}
/* Assign CAS path type to this class */
static unsigned
s_pathtype(char *class_name)
{
static int noentry;
static char *type_list;
noentry = 0;
} else {
&noentry))
return (REL_2_CAS);
else
return (DEFAULT);
}
return (0);
}