1{
2    This file is part of the Free Pascal run time library.
3    Copyright (c) 1999-2000 by the Free Pascal development team
4
5    Processor independent part for strings and sysutils units
6
7    See the file COPYING.FPC, included in this distribution,
8    for details about the copyright.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 **********************************************************************}
15
16    function strcat(dest,source : pchar) : pchar;
17
18      begin
19        strcopy(strend(dest),source);
20        strcat:=dest;
21      end;
22
23    function strlcat(dest,source : pchar;l : SizeInt) : pchar;
24
25      var
26         destend : pchar;
27
28      begin
29         destend:=strend(dest);
30         dec(l,destend-dest);
31         if l>0 then
32          strlcopy(destend,source,l);
33         strlcat:=dest;
34      end;
35
36    function strmove(dest,source : pchar;l : SizeInt) : pchar;
37
38      begin
39         move(source^,dest^,l);
40         strmove:=dest;
41      end;
42
43
44    function strpos(str1,str2 : pchar) : pchar;
45      var
46         p : pchar;
47         lstr2 : SizeInt;
48      begin
49         strpos:=nil;
50         if (str1 = nil) or (str2 = nil) then
51           exit;
52         p:=strscan(str1,str2^);
53         if p=nil then
54           exit;
55         lstr2:=strlen(str2);
56         while p<>nil do
57           begin
58              if strlcomp(p,str2,lstr2)=0 then
59                begin
60                   strpos:=p;
61                   exit;
62                end;
63              inc(p);
64              p:=strscan(p,str2^);
65           end;
66      end;
67
68    function stripos(str1,str2 : pchar) : pchar;
69      var
70         p : pchar;
71         lstr2 : SizeInt;
72      begin
73         stripos:=nil;
74         if (str1 = nil) or (str2 = nil) then
75           exit;
76         p:=striscan(str1,str2^);
77         if p=nil then
78           exit;
79         lstr2:=strlen(str2);
80         while p<>nil do
81           begin
82              if strlicomp(p,str2,lstr2)=0 then
83                begin
84                   stripos:=p;
85                   exit;
86                end;
87              inc(p);
88              p:=striscan(p,str2^);
89           end;
90      end;
91