uu_string.c revision 219089
1193323Sed/* 2193323Sed * CDDL HEADER START 3193323Sed * 4193323Sed * The contents of this file are subject to the terms of the 5193323Sed * Common Development and Distribution License (the "License"). 6193323Sed * You may not use this file except in compliance with the License. 7193323Sed * 8193323Sed * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9193323Sed * or http://www.opensolaris.org/os/licensing. 10193323Sed * See the License for the specific language governing permissions 11193323Sed * and limitations under the License. 12193323Sed * 13193323Sed * When distributing Covered Code, include this CDDL HEADER in each 14193323Sed * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15193323Sed * If applicable, add the following below this CDDL HEADER, with the 16193323Sed * fields enclosed by brackets "[]" replaced with your own identifying 17193323Sed * information: Portions Copyright [yyyy] [name of copyright owner] 18193323Sed * 19193323Sed * CDDL HEADER END 20193323Sed */ 21193323Sed 22193323Sed/* 23193323Sed * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 24193323Sed */ 25193323Sed 26193323Sed/* 27193323Sed * String helper functions 28193323Sed */ 29193323Sed 30193323Sed#include <string.h> 31193323Sed#include <sys/types.h> 32193323Sed#include <stdio.h> 33193323Sed#include <malloc.h> 34193323Sed#include <ctype.h> 35193323Sed#include "libuutil.h" 36193323Sed 37193323Sed/* Return true if strings are equal */ 38193323Sedboolean_t 39193323Seduu_streq(const char *a, const char *b) 40193323Sed{ 41 return (strcmp(a, b) == 0); 42} 43 44/* Return true if strings are equal, case-insensitively */ 45boolean_t 46uu_strcaseeq(const char *a, const char *b) 47{ 48 return (strcasecmp(a, b) == 0); 49} 50 51/* Return true if string a Begins With string b */ 52boolean_t 53uu_strbw(const char *a, const char *b) 54{ 55 return (strncmp(a, b, strlen(b)) == 0); 56} 57