ftp.nice.ch/pub/next/connectivity/news/Alexandra-0.9.s.tar.gz#/alex/instr.c

This is instr.c in view mode; [Download] [Up]

#import "instr.h"
#import <objc/objc.h>
#include <ctype.h>

const char *instr(const char *big,const char *little,int case_matters)
{
    register char *t, *s, *x;

    for (t = (char *)big; *t; t++) {
	for (x=t,s=(char *)little; *s; x++,s++) {
	    if (!*x)
		return (char *)0;
	    if (case_matters == YES) {
		if(*s != *x)
		    break;
	    } else {
		register char c,d;
		if (isupper(*s)) 
		    c = tolower(*s);
		else
		    c = *s;
		if (isupper(*x)) 
		    d = tolower(*x);
		else
		    d = *x;
		if ( c != d )
		    break;
	   }
	}
	if (!*s)
	    return t;
    }
    return (char *)0;
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.