/* $Header: /usr/cvsroot/target/src/wrn/wm/common/lib/stricmp.c,v 1.3 2003/01/16 18:18:57 josh Exp $ */ /* * Copyright (C) 1999-2005 Wind River Systems, Inc. * All rights reserved. Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. */ /**************************************************************************** * Copyright 1993-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************/ /* * $Log: stricmp.c,v $ * Revision 1.3 2003/01/16 18:18:57 josh * directory structure shifting * * Revision 1.2 2001/11/06 22:15:54 tneale * Fixed for newest file layout * * Revision 1.1.1.1 2001/11/05 17:48:39 tneale * Tornado shuffle * * Revision 1.6 2001/05/24 20:32:30 paul * CAD-UL compiler is picky. * * Revision 1.5 2001/01/19 22:21:32 paul * Update copyright. * * Revision 1.4 2000/03/17 00:16:57 meister * Update copyright message * * Revision 1.3 1999/04/09 20:33:48 wes * re-constify. let's see what, if anything, blows up * * Revision 1.2 1998/06/17 18:28:33 meister * This function returned -1 for both cases of non-matching strings. Fixed * to return 1 or -1 as appropriate. * * Revision 1.1 1998/06/03 20:12:51 sar * Added some common string functions. The user can choose to install * these if his library doesn't include them or they are broken. * */ /* [clearcase] modification history ------------------- 01b,20apr05,job update copyright notices 01a,11dec03,job fix copyright statements */ #include #include #include #include /* PORTABLE 'Standard' C FUNCTIONS - these are written in C because not * all systems provide them consistently. Sometimes they're even broken. * This code used to be in snark/snmptalk/stdf.c but was moved here to * be available to more code. */ int etc_stricmp(register const char *s, register const char *t) { int a, b; while (*s && *t) { a = (int)*s; b = (int)*t; /* we only call tolower() if we're sure we need to because * on some systems, calling tolower() on something other * than an uppercase character will break the character. */ if (isupper(a)) a = tolower(a); if (isupper(b)) b = tolower(b); if (a != b) return (a > b ? 1 : -1); s++; t++; } if (*s != *t) return (*s > *t ? 1 : -1); else return 0; }