source: cmedia/trunk/Runtime/string.c@ 354

Last change on this file since 354 was 354, checked in by stevenhl, 17 years ago

Import untested baseline cmedia sources, work products and binaries
Binaries and work products should be deleted from repository.
once new builds are verified to work.

File size: 997 bytes
Line 
1/* $Id: string.c,v 1.1 2000/04/23 14:55:41 ktk Exp $ */
2
3/* STRING.C - Routines defined in string.h that aren't instrinisc (inlined)
4 by the compiler.
5
6 MODIFICATION HISTORY
7 DATE PROGRAMMER COMMENT
8 01-Jul-95 Timur Tabi Creation
9*/
10
11#include <ctype.h>
12#include <string.h>
13
14char *strncpy(char *dst, const char *src, int n)
15{
16 int i;
17
18 for (i=0; i<n; i++)
19 if ((*dst++ = *src++) == 0)
20 break;
21 return dst;
22}
23
24
25char __far *_fstrncpy(char __far *dst, const char __far *src, int n)
26{
27 int i;
28
29 for (i=0; i<n; i++)
30 if ((*dst++ = *src++) == 0)
31 break;
32 return dst;
33}
34
35int _fstrnicmp(const char __far *string1, const char __far *string2, int n)
36{
37 int i,a,b;
38
39 for (i=0; i<n; i++) {
40 a=toupper(*string1++);
41 b=toupper(*string2++);
42 if (!a)
43 return b ? 1 : 0;
44 if (!b) return -1;
45 if (a<b) return -1;
46 if (a>b) return 1;
47 }
48 return 0;
49}
50
Note: See TracBrowser for help on using the repository browser.