14ecbd6dmarkm/* 233f661cstas * Copyright (c) 1998 Kungliga Tekniska H��gskolan 333f661cstas * (Royal Institute of Technology, Stockholm, Sweden). 433f661cstas * All rights reserved. 54ecbd6dmarkm * 633f661cstas * Redistribution and use in source and binary forms, with or without 733f661cstas * modification, are permitted provided that the following conditions 833f661cstas * are met: 94ecbd6dmarkm * 1033f661cstas * 1. Redistributions of source code must retain the above copyright 1133f661cstas * notice, this list of conditions and the following disclaimer. 124ecbd6dmarkm * 1333f661cstas * 2. Redistributions in binary form must reproduce the above copyright 1433f661cstas * notice, this list of conditions and the following disclaimer in the 1533f661cstas * documentation and/or other materials provided with the distribution. 164ecbd6dmarkm * 1733f661cstas * 3. Neither the name of the Institute nor the names of its contributors 1833f661cstas * may be used to endorse or promote products derived from this software 1933f661cstas * without specific prior written permission. 204ecbd6dmarkm * 2133f661cstas * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 2233f661cstas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2333f661cstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2433f661cstas * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 2533f661cstas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2633f661cstas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2733f661cstas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2833f661cstas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2933f661cstas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3033f661cstas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3133f661cstas * SUCH DAMAGE. 324ecbd6dmarkm */ 334ecbd6dmarkm 344ecbd6dmarkm#include <config.h> 354ecbd6dmarkm 364ecbd6dmarkm#include <string.h> 374ecbd6dmarkm#include <ctype.h> 384ecbd6dmarkm#include <stddef.h> 394ecbd6dmarkm 404ecbd6dmarkm#ifndef HAVE_STRNCASECMP 414ecbd6dmarkm 4233f661cstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 434ecbd6dmarkmstrncasecmp(const char *s1, const char *s2, size_t n) 444ecbd6dmarkm{ 4533f661cstas while(n > 0 465c90662nectar && toupper((unsigned char)*s1) == toupper((unsigned char)*s2)) 475c90662nectar { 484ecbd6dmarkm if(*s1 == '\0') 494ecbd6dmarkm return 0; 504ecbd6dmarkm s1++; 514ecbd6dmarkm s2++; 524ecbd6dmarkm n--; 534ecbd6dmarkm } 544ecbd6dmarkm if(n == 0) 554ecbd6dmarkm return 0; 565c90662nectar return toupper((unsigned char)*s1) - toupper((unsigned char)*s2); 574ecbd6dmarkm} 584ecbd6dmarkm 594ecbd6dmarkm#endif 60