File:  [MW Coherent from dump] / coherent / a / tmp / smail / str.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:33 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#ifndef lint
static char 	*sccsid="@(#)str.c	2.5 (smail) 9/15/87";
#endif

#include "defs.h"
#include <ctype.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')) {
		/* 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') {
		/* 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" */
}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.