/*
* 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
*/
/*
*/
#include "lint.h"
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <secdb.h>
/*
* _strtok_escape()
* Like strtok_r, except we don't break on a token if it is escaped
* with the escape character (\).
*/
char *
{
char *r;
/* first or subsequent call */
if (string == 0) /* return if no tokens remaining */
return (NULL);
return (NULL);
/* move past token */
*lasts = 0; /* indicate this is last token */
else {
*r = '\0';
*lasts = r+1;
}
return (string);
}
/*
* Return ptr to first occurrence of any non-escaped character from `brkset'
* in the character string `string'; NULL if none exists.
*/
char *
{
const char *p;
do {
;
if (*p != '\0') {
return ((char *)string);
}
} while (*string++);
return (NULL);
}
char *
{
int i, j;
int len_s;
char *tmp;
return (NULL);
/* Invalid string */
return (NULL);
for (i = 0; i < len_s; i++)
nescs++;
return (NULL);
for (i = 0, j = 0; i < len_s; i++) {
tmp[j++] = '\\';
}
tmp[j++] = s[i];
}
return (tmp);
}
char *
{
int len_s;
int i, j;
char *tmp;
return (NULL);
return (NULL);
for (i = 0, j = 0; i < len_s; i++) {
tmp[j++] = s[++i];
else
tmp[j++] = s[i];
}
return (tmp);
}
char *
_strdup_null(const char *s)
{
return (strdup(s ? s : ""));
}
/*
* read a line into buffer from a mmap'ed file.
* return length of line read.
*/
int
int mapsize, /* input size */
char *buffer, /* output storage */
int buflen, /* output size */
int *lastlen) /* input read till here last time */
{
int linelen;
for (;;) {
linelen = 0;
if (linelen == 0 ||
return (-1);
} else {
return (linelen);
}
}
case '\n':
(*lastlen)++;
if (linelen > 0 &&
--linelen; /* remove the '\\' */
} else {
return (linelen);
}
break;
default:
(*lastlen)++;
linelen++;
}
}
/* Buffer overflow -- eat rest of line and loop again */
return (-1);
}
(*lastlen)++;
};
}
/* NOTREACHED */
}