Category : C Source Code
Archive   : ECSTR.ZIP
Filename : STRNCMP.C

 
Output of file : STRNCMP.C contained in archive : ECSTR.ZIP
/* File : strncmp.c
Author : Richard A. O'Keefe.
Updated: 10 April 1984
Defines: strncmp()

strncmp(s, t, n) compares the first n characters of s and t.
If they are the same in the first n characters it returns 0,
otherwise it returns the same value as strcmp(s, t) would.
*/

#include "strings.h"

int strncmp(s, t, n)
register char *s, *t;
register int n;
{
while (--n >= 0) {
if (*s != *t++) return s[0]-t[-1];
if (!*s++) return 0;
}
return 0;
}



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