/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1994, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Includes
*/
/* we need to define this to get strtok_r from string.h */
/* SEEMS LIKE A BUG TO ME */
#define _REENTRANT
#ifndef DEBUG
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libintl.h>
#include <regexpr.h>
#include <assert.h>
#include "spec.h"
#include "new.h"
#include "source.h"
/*
* Globals
*/
/*
* spec() - builds a spec
*/
spec_t *
{
if (type == SPEC_REGEXP) {
return (NULL);
}
}
return (new_p);
} /* end spec */
/*
* spec_dup() - duplicates a spec, NOT A SPEC LIST!
*/
spec_t *
{
return (new_p);
} /* end spec_dup */
/*
* spec_destroy() - destroys a spec list
*/
void
{
}
} /* end spec_destroy */
/*
* spec_list() - append a spec_t to a list
*/
spec_t *
spec_t * f)
{
/* queue append handles the NULL cases OK */
} /* end spec_list */
/*
* spec_print() - pretty prints a speclist
*/
void
{
case SPEC_EXACT:
break;
case SPEC_REGEXP:
break;
}
}
} /* end spec_print */
/*
* spec_match() - called with a spec and a string, returns whether they
* match.
*/
static boolean_t
char *str)
{
if (!spec_p)
return (B_FALSE);
case SPEC_EXACT:
case SPEC_REGEXP:
}
return (B_FALSE);
} /* end spec_match */
/*
* spec_attrtrav() - traverse an attribute list, calling the supplied
* function on each matching attribute.
*/
void
char *attrs,
void *calldatap)
{
char *lasts;
char *pair;
char *s;
/*
* * STRATEGY - we make two copies of the attr string. In one *
* string we escape (translate) all relevant quoted characters to * a
* non-significant character. We use this string to feed to * strtok
* to do the parsing. * Once strtok has parsed the string, we use the
* same fragement * positions from the unescaped string to pass to
* the next level.
*/
/* make two copies of the string */
/* escape any quoted ';'s in the escptr string */
for (s = escptr; *s; s++) {
switch (*s) {
case ';':
if (inquote)
*s = '#';
break;
case '\'':
break;
default:
/* nothing on purpose */
break;
}
}
/* loop over each attribute section separated by ';' */
char *escattr;
char *escvals;
char *refattr;
char *refvals;
/*
* setup the ref pointers to the same locations as the esc
* ptrs
*/
/*
* null the reference string in the same spots as the esc
* string
*/
} else {
emptystr[0] = '\0';
}
if (refvals)
else
}
}
if (refptr)
if (escptr)
} /* end spec_attrtrav */
/*
* spec_valtrav() - traverse an value list, calling the supplied function on
* each matching value.
*/
void
char *valstr,
void *calldatap)
{
char *s0;
char *s;
/* return immeadiatly on null pointers */
if (!valstr)
return;
/* special case, match once on empty string */
if (!*valstr) {
return;
}
switch (*s) {
case NULL:
if (intoken) {
}
return; /* ALL DONE */
case '\'':
if (inquote) {
/* end a quoted string */
*s = '\0';
/* next string starts past the quote */
s0 = s + 1;
} else {
/* start a quoted string */
}
break;
case ' ':
case '\t':
/* ignore whitespace in quoted strings */
if (inquote)
break;
if (intoken) {
/* whitespace ended this token */
*s = '\0';
/* next string starts past the whitespace */
s0 = s + 1;
}
break;
default:
/* characters all OK inside quoted string */
if (inquote)
break;
if (!intoken) {
/* start of unquoted token */
s0 = s; /* token starts here */
}
break;
}
}
#ifdef TOOSIMPLE
char *v;
char *ls;
/*
* #### MISSING - need to handle quoted value strings * containing
* whitespace.
*/
if (spec_match(spec_p, v)) {
}
}
#endif
} /* end spec_valtrav */