1995-09-28 20:49:15 +00:00
|
|
|
/* Unless compiled with -DNO_OVERWRITE, this variant of s_copy allows the
|
|
|
|
* target of an assignment to appear on its right-hand side (contrary
|
|
|
|
* to the Fortran 77 Standard, but in accordance with Fortran 90),
|
|
|
|
* as in a(2:5) = a(4:7) .
|
|
|
|
*/
|
|
|
|
|
1994-10-26 18:17:41 +00:00
|
|
|
#include "f2c.h"
|
|
|
|
|
|
|
|
/* assign strings: a = b */
|
|
|
|
|
|
|
|
#ifdef KR_headers
|
|
|
|
VOID s_copy(a, b, la, lb) register char *a, *b; ftnlen la, lb;
|
|
|
|
#else
|
|
|
|
void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb)
|
|
|
|
#endif
|
|
|
|
{
|
1995-09-28 20:49:15 +00:00
|
|
|
register char *aend, *bend;
|
1994-10-26 18:17:41 +00:00
|
|
|
|
1995-09-28 20:49:15 +00:00
|
|
|
aend = a + la;
|
1994-10-26 18:17:41 +00:00
|
|
|
|
1995-09-28 20:49:15 +00:00
|
|
|
if(la <= lb)
|
|
|
|
#ifndef NO_OVERWRITE
|
|
|
|
if (a <= b || a >= b + la)
|
|
|
|
#endif
|
|
|
|
while(a < aend)
|
|
|
|
*a++ = *b++;
|
|
|
|
#ifndef NO_OVERWRITE
|
|
|
|
else
|
|
|
|
for(b += la; a < aend; )
|
|
|
|
*--aend = *--b;
|
|
|
|
#endif
|
1994-10-26 18:17:41 +00:00
|
|
|
|
1995-09-28 20:49:15 +00:00
|
|
|
else {
|
|
|
|
bend = b + lb;
|
|
|
|
#ifndef NO_OVERWRITE
|
|
|
|
if (a <= b || a >= bend)
|
|
|
|
#endif
|
|
|
|
while(b < bend)
|
|
|
|
*a++ = *b++;
|
|
|
|
#ifndef NO_OVERWRITE
|
|
|
|
else {
|
|
|
|
a += lb;
|
|
|
|
while(b < bend)
|
|
|
|
*--a = *--bend;
|
|
|
|
a += lb;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
while(a < aend)
|
|
|
|
*a++ = ' ';
|
|
|
|
}
|
1994-10-26 18:17:41 +00:00
|
|
|
}
|