/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* SunOS-specific extensions to libc's standard set of string routines.
*
* to facilitate sharing with standalone.
*/
/*
* Historical entry point: remove in Solaris 2.8.
*/
char *
{
return (buf);
}
/*
* Historical entry point: remove in Solaris 2.8.
*/
/*PRINTFLIKE3*/
char *
{
return (buf);
}
/*
* Simple-minded conversion of a long into a null-terminated character
* string. Caller must ensure there's enough space to hold the result.
*/
void
{
do {
num /= 10;
} while (num);
do {
*s++ = *--cp;
*s = '\0';
}
/*
* Returns the integer value of the string of decimal numeric
* chars beginning at **str. Does no overflow checking.
* Note: updates *str to point at the last character examined.
*/
int
{
char *p = *str;
int n;
int c;
for (n = 0; (c = *p) >= '0' && c <= '9'; p++) {
n = n * 10 + c - '0';
}
*str = p;
return (n);
}
/*
* Like strrchr(), except
* (a) it takes a maximum length for the string to be searched, and
* (b) if the string ends with a null, it is not considered part of the string.
*/
char *
{
const char *r = 0;
while (n-- > 0 && *sp) {
if (*sp == c)
r = sp;
sp++;
}
return ((char *)r);
}
/*
* NOTE: These routines aren't shared with standalone because the DDI mandates
* that they return the buffer rather than its length.
*/
/*PRINTFLIKE2*/
char *
{
return (buf);
}
char *
{
return (buf);
}
/*
* Do not change the length of the returned string; it must be freed
* with strfree().
*/
char *
{
int size;
char *buf;
return (buf);
}