source: sbliveos2/trunk/runtime/string.c@ 724

Last change on this file since 724 was 205, checked in by stevenhl, 18 years ago

Make warnings away - SHL
Use drv16/midi_idc.h only - SHL
Add interrupts 16-23 - MF

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 929 bytes
Line 
1/* $Id: string.c 205 2007-06-14 01:33:51Z stevenhl $ */
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, unsigned 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, unsigned 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, unsigned 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.