Doxygen Source Code Documentation
s_cat.c File Reference
#include "stdlib.h"
#include "f2c.h"
#include "stdio.h"
#include "string.h"
Go to the source code of this file.
Functions | |
char * | F77_aloc (ftnlen, char *) |
VOID | s_cat (char *lp, char *rpp[], ftnlen rnp[], ftnlen *np, ftnlen ll) |
Function Documentation
|
|
|
Definition at line 26 of file s_cat.c. References F77_aloc(), free, i, L, and nc. Referenced by MAIN__(), and parser_().
00028 { 00029 ftnlen i, nc; 00030 char *rp; 00031 ftnlen n = *np; 00032 #ifndef NO_OVERWRITE 00033 ftnlen L, m; 00034 char *lp0, *lp1; 00035 00036 lp0 = 0; 00037 lp1 = lp; 00038 L = ll; 00039 i = 0; 00040 while(i < n) { 00041 rp = rpp[i]; 00042 m = rnp[i++]; 00043 if (rp >= lp1 || rp + m <= lp) { 00044 if ((L -= m) <= 0) { 00045 n = i; 00046 break; 00047 } 00048 lp1 += m; 00049 continue; 00050 } 00051 lp0 = lp; 00052 lp = lp1 = F77_aloc(L = ll, "s_cat"); 00053 break; 00054 } 00055 lp1 = lp; 00056 #endif /* NO_OVERWRITE */ 00057 for(i = 0 ; i < n ; ++i) { 00058 nc = ll; 00059 if(rnp[i] < nc) 00060 nc = rnp[i]; 00061 ll -= nc; 00062 rp = rpp[i]; 00063 while(--nc >= 0) 00064 *lp++ = *rp++; 00065 } 00066 while(--ll >= 0) 00067 *lp++ = ' '; 00068 #ifndef NO_OVERWRITE 00069 if (lp0) { 00070 memcpy(lp0, lp1, L); 00071 free(lp1); 00072 } 00073 #endif 00074 } |