#endif
}
-void RENAME(string x,string y)
-{
- /* Must move the file "x" to the file "y" */
-#ifdef USE_SYS
- if(!sys_rename(x,y)) fatal(1,"Cannot rename to %s",y);
-#else
- if (rename(x, y) == -1)
- fatal(1, "Cannot rename to %s", y);
-#endif
-}
string libpath(string s)
{
fclose(f);
}
+void copyto(string target, string source)
+{
+ FILE *fsource;
+ FILE *ftarget;
+ int c;
+
+ ftarget = fopen(target,"wb+");
+ if (ftarget == NULL)
+ {
+ fatal(0, "Cannot open file %s, call an expert", target);
+ }
+ fsource = fopen(source,"rb");
+ if (fsource == NULL)
+ {
+ fatal(0, "Cannot open file %s, call an expert", source);
+ }
+ while ((c = getc(fsource)) != EOF)
+ putc(c, ftarget);
+ fclose(fsource);
+ fclose(ftarget);
+}
+
void install(string target, string source)
{
/*
if ((f2 = fopen(target, "r")) == NULL)
{
fclose(f1);
- RENAME(f_pars, target);
+ copyto(target, f_pars);
return;
}
/*
{
fatal(0, "%s : not a file generated by LLgen", target);
}
- RENAME(f_pars, target);
+ copyto(target, f_pars);
}
}