This is strstr.c in view mode; [Download] [Up]
/***************************************************************************** * $Id: strstr.c,v 1.4 1997/04/05 18:06:58 darren Exp $ * * Copyright (c) 1996-1997, Darren Hiebert * * Substitute for a missing ANSI C function. *****************************************************************************/ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <string.h> #ifndef HAVE_STRSTR extern char * strstr( str, substr ) const char *const str; const char *const substr; { const size_t length = strlen(substr); const char *match = NULL; const char *p; for (p = str ; *p != '\0' ; ++p) if (strncmp(p, substr, length) == 0) { match = p; break; } return match; } #endif /* vi:set tabstop=8 shiftwidth=4: */
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.