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

Last change on this file since 553 was 553, checked in by rudi, 14 years ago

Adapt sourcecode to OpenWatcom

File size: 1.0 KB
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, size_t n)
15{
16 size_t 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, size_t n)
26{
27 size_t 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, size_t n)
36{
37 size_t i;
38 int a,b;
39
40 for (i=0; i<n; i++) {
41 a=toupper(*string1++);
42 b=toupper(*string2++);
43 if (!a)
44 return b ? 1 : 0;
45 if (!b) return -1;
46 if (a<b) return -1;
47 if (a>b) return 1;
48 }
49 return 0;
50}
51
Note: See TracBrowser for help on using the repository browser.