@@ -75,6 +75,14 @@ void err_comp_label_not_def(const char *name) {
7575 sc_raise (MSG_LABEL_NOT_DEFINED , name );
7676}
7777
78+ // strcat replacement when p is incremented from dest
79+ void memcat (char * dest , char * p ) {
80+ int lenb = strlen (dest );
81+ int lenp = strlen (p );
82+ memmove (dest + lenb , p , lenp );
83+ dest [lenb + lenp ] = '\0' ;
84+ }
85+
7886/*
7987 * reset the external proc/func lists
8088 */
@@ -1564,7 +1572,6 @@ int comp_single_line_if(char *text) {
15641572 }
15651573 // store EOC
15661574 bc_add_code (& comp_prog , kwTYPE_EOC );
1567- // bc_eoc();
15681575
15691576 // auto-goto
15701577 p = pthen + 6 ;
@@ -1583,9 +1590,8 @@ int comp_single_line_if(char *text) {
15831590 pelse = strstr (buf + 1 , LCN_ELSE );
15841591 if (pelse ) {
15851592 do {
1586- if ((* (pelse - 1 ) == ' ' || * (pelse - 1 ) == '\t' )
1587- && (* (pelse + 4 ) == ' ' || * (pelse + 4 ) == '\t' )) {
1588-
1593+ if ((* (pelse - 1 ) == ' ' || * (pelse - 1 ) == '\t' ) &&
1594+ (* (pelse + 4 ) == ' ' || * (pelse + 4 ) == '\t' )) {
15891595 * pelse = '\0' ;
15901596
15911597 // scan the commands before ELSE
@@ -1601,11 +1607,10 @@ int comp_single_line_if(char *text) {
16011607 if (is_digit (* p )) {
16021608 // add goto
16031609 strcat (buf , LCN_GOTO_WRS );
1604- strcat (buf , p );
1605- } else
1606- strcat (buf , p );
1607-
1608- //
1610+ memcat (buf , p );
1611+ } else {
1612+ memcat (buf , p );
1613+ }
16091614 break ;
16101615 } else {
16111616 pelse = strstr (pelse + 1 , LCN_ELSE );
@@ -4005,7 +4010,7 @@ void comp_preproc_unit_path(char *p) {
40054010 * up ++ = * p ++ ;
40064011 }
40074012 * up = '\0' ;
4008- setenv ("UNITPATH" , upath , 1 );
4013+ setenv (LCN_UNIT_PATH , upath , 1 );
40094014 }
40104015 }
40114016}
0 commit comments