diff mc-macro.c @ 351:000c509b663d

name table reconfigure continue...
author kono
date Sat, 03 Jul 2004 00:32:27 +0900
parents 43099915f4c2
children 7ab4434ad869
line wrap: on
line diff
--- a/mc-macro.c	Fri Jul 02 18:28:19 2004 +0900
+++ b/mc-macro.c	Sat Jul 03 00:32:27 2004 +0900
@@ -87,7 +87,8 @@
 	*cheap->ptr = '/'; cheap = increment_cheap(cheap,&p);
     }
     while(( *cheap->ptr = *name++ )) cheap = increment_cheap(cheap,&p);
-    cheap->ptr = 0;
+    *cheap->ptr = 0;
+    cheap = increment_cheap(cheap,&p);
     return p;
 }
 
@@ -98,10 +99,7 @@
     char *s,*p,**pp,*name;
     FILE *fp;
     struct cheap scheap;
-    struct cheap scheap1;
-    save_cheap(&scheap,cheap);
     name = cheap->ptr;
-    
 
     getch();
     if(skipspc()=='"') { end = '"';
@@ -114,26 +112,28 @@
     }
     if(ch=='\n') error(INCERR);
     if (err) return filep->fcb;
-    cheap->ptr = 0;
+    *cheap->ptr = 0;
+    cheap = increment_cheap(cheap,&name);
+    save_cheap(&scheap,cheap);
     fp = fopen(name,"r") ;
     if (fp) {
 	p = name; 
     } else {
-	save_cheap(&scheap1,cheap);
 	for(pp=(end=='>'||filep->inc=='>') ?l_include_path:include_path;
 		*pp;pp++) {
-	    cheap = reset_cheap(&scheap1);
 	    p = expand_file_name(*pp,name);
 	    if ((fp = fopen(p,"r"))) break ;
 	}
     }
     if(!fp) { error(FILERR); return filep->fcb; }
     copy_current_file_dir(s=p);
+    //  File name determined. Dispose extra copies.
+    cheap = reset_cheap(&scheap);
     if (p!=name) {
-	//  File name determined. Dispose extra copies.
-	cheap = reset_cheap(&scheap);
 	name = cheap->ptr;
 	while((*cheap->ptr = *s++)) cheap = increment_cheap(cheap,&name);
+	*cheap->ptr = 0;
+	cheap = increment_cheap(cheap,&name);
     }
     (filep+1)->inc = end;
     (filep+1)->name0 = name;
@@ -435,7 +435,9 @@
 	&& c != '\n') {
 	cheap = increment_cheap(cheap,body);
 	if (c=='/'&&chptr[0]=='/') {
-	    cheap->ptr--; while(*chptr++); break;
+	    cheap->ptr--; 
+	    *cheap->ptr = '\0';
+	    while(*chptr++); break;
 	} else if (c=='/'&&chptr[0]=='*') {
 	    cheap->ptr--; chptr++;
 	    while((c = *chptr++)) {