Daily bump.
[official-gcc.git] / libf2c / libF77 / s_copy.c
blobd1673510c62b8afd684b06c3692094e6147aaab7
1 /* Unless compiled with -DNO_OVERWRITE, this variant of s_copy allows the
2 * target of an assignment to appear on its right-hand side (contrary
3 * to the Fortran 77 Standard, but in accordance with Fortran 90),
4 * as in a(2:5) = a(4:7) .
5 */
7 #include "f2c.h"
9 /* assign strings: a = b */
11 #ifdef KR_headers
12 VOID s_copy(a, b, la, lb) register char *a, *b; ftnlen la, lb;
13 #else
14 void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb)
15 #endif
17 register char *aend, *bend;
19 aend = a + la;
21 if(la <= lb)
22 #ifndef NO_OVERWRITE
23 if (a <= b || a >= b + la)
24 #endif
25 while(a < aend)
26 *a++ = *b++;
27 #ifndef NO_OVERWRITE
28 else
29 for(b += la; a < aend; )
30 *--aend = *--b;
31 #endif
33 else {
34 bend = b + lb;
35 #ifndef NO_OVERWRITE
36 if (a <= b || a >= bend)
37 #endif
38 while(b < bend)
39 *a++ = *b++;
40 #ifndef NO_OVERWRITE
41 else {
42 a += lb;
43 while(b < bend)
44 *--a = *--bend;
45 a += lb;
47 #endif
48 while(a < aend)
49 *a++ = ' ';