/*
* 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 1997-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "parser.h"
#include "trace.h"
#include "util.h"
#include "errlog.h"
/*
* String processing
*/
/*
* strnormalize -- combined tab-to-space and strtrim, plus removal
* of leading and trailing *$%$^@!!! semicolons.
* Not internationalized: TBD.
*/
char *
{
char *p;
return (str);
if (isspace(*p)) {
*p = ' ';
}
}
p--;
*p-- = NULL;
/* ERA - remove leading spaces */
str++;
return (str);
}
char *
{
char *p;
continue;
p--;
*p-- = NULL;
return (str);
}
/*
* strlower -- make a string lower-case, destructively.
* Not internationalized: TBD.
*/
char *
{
char *p;
*p = tolower(*p);
}
return (str);
}
/*
* strset -- update a dynamically-allocated string or die trying.
*/
char *
{
/* It was never allocated, so allocate it. */
}
/* Reallocate bigger. */
}
}
return (string);
}
/*
* in_string_set --see if string matches any member of a space-separated
* set of strings.
*/
int
{
char *q;
char save;
for (;;) {
if (q == set) {
/* We've hit the end */
break;
}
save = *q;
*q = NULL;
*q = save;
return (YES);
}
*q = save;
set = q;
}
return (NO);
}
char *
strend(char *p)
{
while (*p)
p++;
return (p);
}
char *
lastspace(char *p)
{
char *q;
q = strend(p);
q--;
while (q >= p && isspace(*q))
q--;
return (++q);
}
/*
* skipb -- skip over blanks (whitespace, actually), stopping
* on first non-blank.
*/
char *
skipb(char *p)
{
while (*p && isspace(*p))
p++;
return (p);
}
/*
* nextb -- skip over non-blanks (including operators!)
* stopping on first blank.
*/
char *
nextb(char *p)
{
while (*p && !isspace(*p))
p++;
return (p);
}
/*
* skipsep -- skip over separators (all but alnum and _),
* stopping on first non-separator.
*/
char *
skipsep(char *p)
{
p++;
return (p);
}
/*
* nextsep -- skip over non-separators (alnum and _, actually),
* stopping on first separator.
*/
char *
nextsep(char *p)
{
p++;
return (p);
}
/*
* nextsep2 -- same as nextsep but also skips '.'
*/
char *
nextsep2(char *p)
{
p++;
return (p);
}
/*
* objectname -- basename was taken (in man3c), so...
*/
char *
{
char *p;
/* The / was at the end of the name. */
*p = NULL;
}
*p = NULL;
}
}
/*
* String tables
*/
table_t *
{
table_t *t;
}
t->used = -1;
return (t);
}
table_t *
{
int i;
if (t == NULL) {
"a NULL table");
}
if (in_string_table(t, value)) {
return (t);
}
t->used++;
(char *)*(t->nelem+TABLE_INCREMENT)))))
== NULL) {
}
t = t2;
t->nelem += TABLE_INCREMENT;
}
}
return (t);
}
/*
* free_string_table -- really only mark it empty for reuse.
*/
table_t *
{
if (t != NULL) {
t->used = -1;
}
return (t);
}
char *
{
if (t == NULL) {
return (NULL);
return (NULL);
} else {
}
}
int
{
int i;
if (t == NULL) {
return (0);
}
for (i = 0; i <= t->used; i++) {
return (1);
}
return (0);
}
static int
compare(const void *p, const void *q)
{
return (strcmp((char *)(*(char **)p), (char *)(*(char **)q)));
}
void
{
if (t) {
sizeof (char *), compare);
}
}