uu_string.c revision 219089
1219089Spjd/* 2219089Spjd * CDDL HEADER START 3219089Spjd * 4219089Spjd * The contents of this file are subject to the terms of the 5219089Spjd * Common Development and Distribution License (the "License"). 6219089Spjd * You may not use this file except in compliance with the License. 7219089Spjd * 8219089Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9219089Spjd * or http://www.opensolaris.org/os/licensing. 10219089Spjd * See the License for the specific language governing permissions 11219089Spjd * and limitations under the License. 12219089Spjd * 13219089Spjd * When distributing Covered Code, include this CDDL HEADER in each 14219089Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15219089Spjd * If applicable, add the following below this CDDL HEADER, with the 16219089Spjd * fields enclosed by brackets "[]" replaced with your own identifying 17219089Spjd * information: Portions Copyright [yyyy] [name of copyright owner] 18219089Spjd * 19219089Spjd * CDDL HEADER END 20219089Spjd */ 21219089Spjd 22219089Spjd/* 23219089Spjd * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 24219089Spjd */ 25219089Spjd 26219089Spjd/* 27219089Spjd * String helper functions 28219089Spjd */ 29219089Spjd 30219089Spjd#include <string.h> 31219089Spjd#include <sys/types.h> 32219089Spjd#include <stdio.h> 33219089Spjd#include <malloc.h> 34219089Spjd#include <ctype.h> 35219089Spjd#include "libuutil.h" 36219089Spjd 37219089Spjd/* Return true if strings are equal */ 38219089Spjdboolean_t 39219089Spjduu_streq(const char *a, const char *b) 40219089Spjd{ 41219089Spjd return (strcmp(a, b) == 0); 42219089Spjd} 43219089Spjd 44219089Spjd/* Return true if strings are equal, case-insensitively */ 45219089Spjdboolean_t 46219089Spjduu_strcaseeq(const char *a, const char *b) 47219089Spjd{ 48219089Spjd return (strcasecmp(a, b) == 0); 49219089Spjd} 50219089Spjd 51219089Spjd/* Return true if string a Begins With string b */ 52219089Spjdboolean_t 53219089Spjduu_strbw(const char *a, const char *b) 54219089Spjd{ 55219089Spjd return (strncmp(a, b, strlen(b)) == 0); 56219089Spjd} 57