1*cb174861Sjoyce mcintosh /* 2*cb174861Sjoyce mcintosh * CDDL HEADER START 3*cb174861Sjoyce mcintosh * 4*cb174861Sjoyce mcintosh * The contents of this file are subject to the terms of the 5*cb174861Sjoyce mcintosh * Common Development and Distribution License (the "License"). 6*cb174861Sjoyce mcintosh * You may not use this file except in compliance with the License. 7*cb174861Sjoyce mcintosh * 8*cb174861Sjoyce mcintosh * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*cb174861Sjoyce mcintosh * or http://www.opensolaris.org/os/licensing. 10*cb174861Sjoyce mcintosh * See the License for the specific language governing permissions 11*cb174861Sjoyce mcintosh * and limitations under the License. 12*cb174861Sjoyce mcintosh * 13*cb174861Sjoyce mcintosh * When distributing Covered Code, include this CDDL HEADER in each 14*cb174861Sjoyce mcintosh * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*cb174861Sjoyce mcintosh * If applicable, add the following below this CDDL HEADER, with the 16*cb174861Sjoyce mcintosh * fields enclosed by brackets "[]" replaced with your own identifying 17*cb174861Sjoyce mcintosh * information: Portions Copyright [yyyy] [name of copyright owner] 18*cb174861Sjoyce mcintosh * 19*cb174861Sjoyce mcintosh * CDDL HEADER END 20*cb174861Sjoyce mcintosh */ 21*cb174861Sjoyce mcintosh 22*cb174861Sjoyce mcintosh /* 23*cb174861Sjoyce mcintosh * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 24*cb174861Sjoyce mcintosh */ 25*cb174861Sjoyce mcintosh 26*cb174861Sjoyce mcintosh /* 27*cb174861Sjoyce mcintosh * String helper functions 28*cb174861Sjoyce mcintosh */ 29*cb174861Sjoyce mcintosh 30*cb174861Sjoyce mcintosh #include <string.h> 31*cb174861Sjoyce mcintosh #include <sys/types.h> 32*cb174861Sjoyce mcintosh #include <stdio.h> 33*cb174861Sjoyce mcintosh #include <malloc.h> 34*cb174861Sjoyce mcintosh #include <ctype.h> 35*cb174861Sjoyce mcintosh #include "libuutil.h" 36*cb174861Sjoyce mcintosh 37*cb174861Sjoyce mcintosh /* Return true if strings are equal */ 38*cb174861Sjoyce mcintosh boolean_t 39*cb174861Sjoyce mcintosh uu_streq(const char *a, const char *b) 40*cb174861Sjoyce mcintosh { 41*cb174861Sjoyce mcintosh return (strcmp(a, b) == 0); 42*cb174861Sjoyce mcintosh } 43*cb174861Sjoyce mcintosh 44*cb174861Sjoyce mcintosh /* Return true if strings are equal, case-insensitively */ 45*cb174861Sjoyce mcintosh boolean_t 46*cb174861Sjoyce mcintosh uu_strcaseeq(const char *a, const char *b) 47*cb174861Sjoyce mcintosh { 48*cb174861Sjoyce mcintosh return (strcasecmp(a, b) == 0); 49*cb174861Sjoyce mcintosh } 50*cb174861Sjoyce mcintosh 51*cb174861Sjoyce mcintosh /* Return true if string a Begins With string b */ 52*cb174861Sjoyce mcintosh boolean_t 53*cb174861Sjoyce mcintosh uu_strbw(const char *a, const char *b) 54*cb174861Sjoyce mcintosh { 55*cb174861Sjoyce mcintosh return (strncmp(a, b, strlen(b)) == 0); 56*cb174861Sjoyce mcintosh } 57