Missing dependencies added.
[AROS-Contrib.git] / rexx / lstring / overlay.c
bloba04a2c857feb19b6f8a0262a424f9e86906adfc1
1 /*
2 * $Header$
3 * $Log$
4 * Revision 1.1 2001/04/04 05:43:38 wang
5 * First commit: compiles on Linux, Amiga, Windows, Windows CE, generic gcc
7 * Revision 1.1 1998/07/02 17:18:00 bnv
8 * Initial Version
12 #include <string.h>
13 #include <lstring.h>
15 /* ------------------ Loverlay ---------------- */
16 void
17 Loverlay( const PLstr to, const PLstr newstr, const PLstr target,
18 long n, long length, const char pad)
20 Lstr tmp;
22 L2STR(newstr);
23 L2STR(target);
25 n--;
26 if (n<0) n = 0;
27 if (length==0) {
28 Lstrcpy(to,target);
29 return;
31 if (length<0) length = LLEN(*newstr);
33 if (n+length > LLEN(*target))
34 Lsubstr(to,target,1,n+length,pad);
35 else
36 Lstrcpy(to,target);
38 LINITSTR(tmp);
39 Lsubstr(&tmp,newstr,1,length,pad);
41 MEMCPY( LSTR(*to)+n, LSTR(tmp), (size_t)length);
42 LFREESTR(tmp);
43 } /* Loverlay */