Category : C Source Code
Archive   : CSRC2.ZIP
Filename : STRRCH.C

 
Output of file : STRRCH.C contained in archive : CSRC2.ZIP
/*
* s t r r c h . c
*/

/*)LIBRARY
*/

#ifdef DOCUMENTATION

title strrchr Find Last Instance of a Character in a String
index Find last instance of a character in a string

synopsis
.s.nf
char *
strrchr(stng, chr)
char *stng; /* String to search in */
char chr; /* Byte to search for */
.s.f
Description

If chr is in stng, return a pointer to the last (rightmost)
occurrance of it. If not, return NULL.

Bugs

#endif

#define EOS 0
#define NULL 0

char *
strrchr(stng, chr)
register char *stng;
register char chr;
/*
* Return rightmost instance of chr in stng.
*/
{
register char *result;

result = NULL;

do {
if (*stng == chr)
result = stng;
} while (*stng++ != EOS);
return (result);
}


  3 Responses to “Category : C Source Code
Archive   : CSRC2.ZIP
Filename : STRRCH.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/