Follow-up Comment #6, bug #30328 (project make): what about to have some function $(file file_name,open_type,string)
where open_type can be the same as for fopen static void replace_all(char* inputStr,const char* pattern,const char* substr) { char * found = strstr(inputStr,pattern); int patternLen = strlen(pattern); int substrLen = strlen(substr); char * end = inputStr + strlen(inputStr); while (found != 0) { strncpy(found,substr,substrLen); memmove(found+substrLen,found+patternLen,end - (found + substrLen) + 1); found = strstr(found,pattern); } } /** * Output information to file. * argv - file name * argv + 1 - can be w,a, see fopen * argv + 2,... - message to output to file */ static char * func_file(char *o, char **argv, const char *funcname) { char **argvp; int len = 0; FILE * pFile = fopen(*argv,*(argv+1)); if (pFile != 0) { for (argvp = argv+2; *argvp != 0; ++argvp) { char * param = *argvp; replace_all(param,"\n","n"); replace_all(param,"\t","t"); /* need to put more here */ len += strlen(param) + 2; fputs(param,pFile); } fclose(pFile); } else { error(reading_file, _("Could not open file: `%s`"), *argv); } return o; } After that you can use to append $(file file.out,a,some text with n to append to file) if you need to write to file $(file file.out,w,some text with n to create new file) _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?30328> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make