7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Common Development and Distribution License, Version 1.0 only
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (the "License"). You may not use this file except in compliance
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#pragma ident "%Z%%M% %I% %E% SMI"
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi (void) strcpy(p, s);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (p);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiconst char *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (s);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (++p);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (p == s && *p == '/')
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi while (p != s) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (*--p == '/') {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi while (*p == '/' && p != s)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *++p = '\0';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (s);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi const char *p;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi h = (h << 4) + *p;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if ((g = (h & 0xf0000000)) != 0) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi h ^= (g >> 24);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (h);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Transform string s inline, converting each embedded C escape sequence string
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * to the corresponding character. For example, the substring "\n" is replaced
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * by an inline '\n' character. The length of the resulting string is returned.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi char *p, *q, c;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi for (p = q = s; (c = *p) != '\0'; p++) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi switch (c) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\a';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\b';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\f';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\n';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\r';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\t';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\v';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi for (x = 0; (c = *++p) != '\0'; ) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = (char)x;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *q++ = '\\';
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return ((size_t)(q - s));
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (0);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if ((c = *p++) == '\0')
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (*s == '\0');
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (c == '*') {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi while (*p == '*')
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi p++; /* consecutive *'s can be collapsed */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (*p == '\0')
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (1);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi while (*s != '\0') {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (topo_strmatch(s++, p) != 0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (1);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (0);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi } while (c == *s++);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (0);