diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-09 22:23:07 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-09 22:23:07 +0000 |
commit | 9978f7e2aeb3beae6d48160a61f3843eab5b8171 (patch) | |
tree | d02e3d02df7f72563a1b207981491d34cf6591ae /TAO/TAO_IDL/driver | |
parent | abc3e4969485f03b0a3312a60eba7a25b5b067ea (diff) | |
download | ATCD-9978f7e2aeb3beae6d48160a61f3843eab5b8171.tar.gz |
ChangeLogTag:Fri Mar 9 14:07:06 2001 Darrell Brunsch <brunsch@uci.edu>
Diffstat (limited to 'TAO/TAO_IDL/driver')
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 1e4a6368fbc..a7942049ca2 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -397,7 +397,6 @@ void DRV_pre_proc (const char *myfile) { long readfromstdin = I_FALSE; - char catbuf[512]; // Macro to avoid "warning: unused parameter" type warning. ACE_UNUSED_ARG (readfromstdin); @@ -583,11 +582,31 @@ DRV_pre_proc (const char *myfile) FE_set_yyin (ACE_reinterpret_cast (File *, yyin)); - // @@ TODO: This is not portable, cat(1) is a UNIX tool. - if (idl_global->compile_flags() & IDL_CF_ONLY_PREPROC) { - sprintf(catbuf, "cat < %s", tmp_file); - system(catbuf); - } + if (idl_global->compile_flags() & IDL_CF_ONLY_PREPROC) + { + FILE *preproc = ACE_OS::fopen (tmp_file, "r"); + char buffer[BUFSIZ + 1]; // 1 for extra null + int bytes; + + if (preproc == NULL) + { + ACE_ERROR ((LM_ERROR, + "%s: Could not open cpp output file: %s\n", + ACE_TEXT (idl_global->prog_name ()), + ACE_TEXT (tmp_file))); + + ACE_OS::exit (99); + } + + while ((bytes = ACE_OS::fread (buffer, sizeof (char), BUFSIZ, preproc)) != 0) + { + buffer[bytes] = 0; // Null char + + ACE_DEBUG ((LM_DEBUG, buffer)); + } + + ACE_OS::fclose (preproc); + } if (ACE_OS::unlink (tmp_ifile) == -1) { |