diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2004-02-29 19:27:25 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2004-02-29 19:27:25 +0000 |
commit | 06bbcaeb9d33fce156543e2d84b1df4a0a9e1127 (patch) | |
tree | 8614ca58169c994e07adc995d206e8434b020c5d /gnu/lib/libf2c/libF77/s_copy.c | |
parent | 4a95829907bd98f42503d9e6f91af8df4c9313ab (diff) |
Import of libf2c from gcc3.3.2
Diffstat (limited to 'gnu/lib/libf2c/libF77/s_copy.c')
-rw-r--r-- | gnu/lib/libf2c/libF77/s_copy.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/lib/libf2c/libF77/s_copy.c b/gnu/lib/libf2c/libF77/s_copy.c new file mode 100644 index 00000000000..d1673510c62 --- /dev/null +++ b/gnu/lib/libf2c/libF77/s_copy.c @@ -0,0 +1,51 @@ +/* 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) . + */ + +#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 +{ + register char *aend, *bend; + + aend = a + la; + + 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 + + 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++ = ' '; + } + } |