home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 2
/
goldfish_vol2_cd1.bin
/
files
/
comm
/
mail
/
smail
/
src
/
rcs
/
str.c,v
< prev
next >
Wrap
Text File
|
1993-12-21
|
2KB
|
135 lines
head 1.2;
access;
symbols
C_1:1.2;
locks; strict;
comment @ * @;
1.2
date 93.09.18.16.47.47; author Aussem; state Exp;
branches;
next 1.1;
1.1
date 93.09.08.16.27.13; author Aussem; state Exp;
branches;
next ;
desc
@stricmp() and strnicmp()
@
1.2
log
@insert GNU license text in the header
@
text
@/*
* str.c
*
* Routines for string compare
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: str.c,v $
* Revision 1.1 1993/09/08 16:27:13 Aussem
* Initial revision
*
*
*/
static char *rcsid="$Id: str.c,v 1.1 1993/09/08 16:27:13 Aussem Exp Aussem $";
#include <ctype.h>
#include <stdio.h>
#include "defs.h"
/*
** strncmpic: string compare, ignore case, stop after 'n' chars
*/
strncmpic(s1, s2, n)
char *s1, *s2;
int n;
{
register char *u = s1;
register char *p = s2;
while((n > 0) && (*p != '\0' && *u != '\0' )) {
/* chars match or only case different */
if(lower(*u) == lower(*p)) {
p++; /* examine next char */
u++;
} else {
break; /* no match - stop comparison */
}
n--;
}
if(n > 0) {
return(lower(*u) - lower(*p)); /* return "difference" */
} else {
return(0);
}
}
/*
** strcmpic: string compare, ignore case
*/
strcmpic(s1, s2)
char *s1, *s2;
{
register char *u = s1;
register char *p = s2;
while(*p != '\0' && *u != '\0') {
/* chars match or only case different */
if(lower(*u) == lower(*p)) {
p++; /* examine next char */
u++;
} else {
break; /* no match - stop comparison */
}
}
return(lower(*u) - lower(*p)); /* return "difference" */
}
@
1.1
log
@Initial revision
@
text
@d2 1
a2 1
* str.c
d4 1
a4 1
* Routines for string compare
d6 4
a9 1
* $Log$
d11 14
d27 1
a27 1
static char *rcsid="$Id$";
@