Last change
on this file since 176 was 142, checked in by ktk, 25 years ago |
Import
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
902 bytes
|
Line | |
---|
1 | /* $Id: string.c 142 2000-04-23 14:55:46Z ktk $ */
|
---|
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 |
|
---|
14 | char *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 |
|
---|
25 | char __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 |
|
---|
35 | int _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.