Category : C Source Code
Archive   : E_C_STR.ZIP
Filename : STRSUFF.C

 
Output of file : STRSUFF.C contained in archive : E_C_STR.ZIP
/* File : strsuff.c
Author : Richard A. O'Keefe.
Updated: 11 April 1984
Defines: strsuff()

strsuff(src, suffix)
checks whether suffix is a suffix of src. If it is not, the result
is NullS. If it is, the result is a pointer to the character of src
where suffix starts (which is the same as src+strlen(src)-strlen(prefix) ).
See strpref.c for a comment about using if (strsuff(...)) in C.
*/

#include "strings.h"

char *strsuff(src, suffix)
register char *src, *suffix;
{
register int L; /* length of suffix */

for (L = 0; *suffix++; L++)
if (!*src++) return NullS;
while (*src++) ;
for (--src, --suffix; --L >= 0; )
if (*--src != *--suffix) return NullS;
return src;
}



  3 Responses to “Category : C Source Code
Archive   : E_C_STR.ZIP
Filename : STRSUFF.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/