From 2671a7f418d031dd08268b40a42862b151dba91d Mon Sep 17 00:00:00 2001 From: borutr Date: Mon, 10 Mar 2003 20:04:32 +0000 Subject: [PATCH] pipe preprocessor's output git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2362 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCmain.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 00518124..5fd4cf0a 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -1613,33 +1613,29 @@ preProcess (char **envp) preOutName = Safe_strdup (fullDstFileName); } } - else - preOutName = Safe_strdup (tempfilename ()); /* Have to set cppoutfilename to something, even if just pre-processing. */ setMainValue ("cppoutfilename", preOutName ? preOutName : ""); - addSetHead (&tmpfileNameSet, preOutName); if (options.verbose) printf ("sdcc: Calling preprocessor...\n"); buildCmdLine2 (buffer, _preCmd, sizeof(buffer)); - if (my_system (buffer)) - { + if (preProcOnly) { + if (my_system (buffer)) { exit (1); } - if (preProcOnly) - { - exit (0); - } - yyin = fopen (preOutName, "r"); - if (yyin == NULL) - { - perror ("Preproc file not found\n"); + + exit (0); + } + + yyin = my_popen (buffer); + if (yyin == NULL) { + perror ("Preproc file not found"); exit (1); - } - addSetHead (&tmpfileSet, yyin); + } + addSetHead (&pipeSet, yyin); } return 0; @@ -1929,6 +1925,10 @@ main (int argc, char **argv, char **envp) printf ("sdcc: Generating code...\n"); yyparse (); + + pclose(yyin); + deleteSetItem(&pipeSet, yyin); + if (fatalError) { exit (1); } -- 2.39.5