diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-02-02 11:30:36 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-02-02 15:27:33 -0800 |
commit | 649faef32416e6d87ec2dcad5b0142d3b7ff04d7 (patch) | |
tree | 996677a775a790ed4acc3d28659947f243436ea6 | |
parent | 8a59f14ff4a87b96ce763dd6565d776f8ac3b087 (diff) |
Properly honor -nocpp
Previously, if the user passed -nocpp and there was a cpp present,
cpp would be used. This patch fixes that case.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xrdb.c | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -798,6 +798,23 @@ main(int argc, char *argv[]) /* initialize the includes String struct */ addstring(&includes, ""); + /* Pick the default cpp to use. This needs to be done before + * we parse the command line in order to honor -nocpp which sets + * it back to NULL. + */ + if (cpp_program == NULL) { + int number_of_elements + = (sizeof cpp_locations) / (sizeof cpp_locations[0]); + int j; + + for (j = 0; j < number_of_elements; j++) { + if (access(cpp_locations[j], X_OK) == 0) { + cpp_program = cpp_locations[j]; + break; + } + } + } + /* needs to be replaced with XrmParseCommand */ for (i = 1; i < argc; i++) { @@ -892,19 +909,6 @@ main(int argc, char *argv[]) filename = arg; } /* end for */ - /* If cpp to use was not specified, check for ones in default locations */ - if (cpp_program == NULL) { - int number_of_elements - = (sizeof cpp_locations) / (sizeof cpp_locations[0]); - int j; - - for (j = 0; j < number_of_elements; j++) { - if (access(cpp_locations[j], X_OK) == 0) { - cpp_program = cpp_locations[j]; - break; - } - } - } #ifndef WIN32 while ((i = open("/dev/null", O_RDONLY)) < 3) ; /* make sure later freopen won't clobber things */ |