diff options
author | eschnett <eschnett@83718e91-0e4f-0410-abf4-91180603181f> | 2014-03-27 18:02:44 +0000 |
---|---|---|
committer | eschnett <eschnett@83718e91-0e4f-0410-abf4-91180603181f> | 2014-03-27 18:02:44 +0000 |
commit | 93ce33e282f5c94624fb23422b5973ff1707fbc8 (patch) | |
tree | 9ba2ee37fd4ba2462f828a2e82c632cc9d1b51d8 | |
parent | f26e37c7b6605ee4e7839389c0e595a80cd2ca94 (diff) |
Correct usage of CCTK_CommandLine
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@245 83718e91-0e4f-0410-abf4-91180603181f
-rw-r--r-- | src/announce.cc | 11 | ||||
-rw-r--r-- | src/make.configuration.deps | 17 | ||||
-rw-r--r-- | src/rdf.cc | 4 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/announce.cc b/src/announce.cc index 8a46c68..0c1b1ed 100644 --- a/src/announce.cc +++ b/src/announce.cc @@ -290,9 +290,7 @@ namespace Formaline { char ** argv; - int argc; - CCTK_CommandLine (& argv); - for (argc = 0; argv [argc]; ++ argc); + int const argc = CCTK_CommandLine (& argv); stores.store ("executable", argc == 0 ? "" : argv[0]); } @@ -435,12 +433,9 @@ namespace Formaline { char ** argv; - int argc; - int n; - CCTK_CommandLine (& argv); - for (argc = 0; argv [argc]; ++ argc); + int const argc = CCTK_CommandLine (& argv); stores.store ("argc", argc); - for (n = 0; n < argc; ++ n) + for (int n = 0; n < argc; ++ n) { char buffer [1000]; snprintf (buffer, sizeof buffer, "argv[%d]", n); diff --git a/src/make.configuration.deps b/src/make.configuration.deps index 313fc24..b585a8f 100644 --- a/src/make.configuration.deps +++ b/src/make.configuration.deps @@ -98,7 +98,8 @@ $(TARBALL_DIR)/build-id.c: $(TOP)/BUILD-ID echo 'char const * const build_id = "'$$build_id'";' && \ config_id="$$(cat $(TOP)/CONFIG-ID || echo 'NO-CONFIG-ID')" && \ echo 'char const * const config_id = "'$$config_id'";'; \ - } > $@ + } > $@.tmp + mv $@.tmp $@ @@ -107,7 +108,8 @@ $(TARBALL_DIR)/cactus-meta.o: $(TARBALL_DIR)/cactus-meta.c cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c -o $@ $^ $(TARBALL_DIR)/cactus-meta.c: $(TARBALL_DIR)/config-Cactus.c $(TARBALL_DIR)/flesh-Cactus.c $(patsubst %,$(TARBALL_DIR)/thorn-%.c,$(notdir $(THORNS))) | $(FORMALINE-UTILS) - $(FORMALINE_BIN_DIR)/makemetablob.pl CactusConfig Cactus $(notdir $(THORNS)) > $@ + $(FORMALINE_BIN_DIR)/makemetablob.pl CactusConfig Cactus $(notdir $(THORNS)) > $@.tmp + mv $@.tmp $@ .PRECIOUS: $(TARBALL_DIR)/cactus-meta.c $(TARBALL_DIR)/cactus-meta.o @@ -140,7 +142,7 @@ $(TARBALL_DIR)/config-Cactus.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNA mkdir -p $(TARBALL_DIR)/configs/$(notdir $(TOP)) { \ cd $(CACTUS_CONFIGS_DIR)/$(notdir $(TOP)) && \ - cp -r OptionList properties.ini RunScript ScriptFile SubmitScript ThornList config-data config-info $(TARBALL_DIR)/configs/$(notdir $(TOP)); \ + cp -r OptionList properties.ini RunScript ScriptFile SubmitScript ThornList config-data config-info $(TARBALL_DIR)/configs/$(notdir $(TOP)) 2>/dev/null; \ } || true cd $(TARBALL_DIR) && \ find configs/$(notdir $(TOP))/ \ @@ -169,7 +171,8 @@ $(TARBALL_DIR)/config-Cactus.ccldeps: echo " $(CCTK_HOME)/src/interface.ccl \\"; \ echo " $(CCTK_HOME)/src/param.ccl \\"; \ echo " $(CCTK_HOME)/src/schedule.ccl"; \ - } > $@ + } > $@.tmp + mv $@.tmp $@ .PRECIOUS: $(TARBALL_DIR)/config-Cactus.ccldeps $(TARBALL_DIR)/config-Cactus.files $(TARBALL_DIR)/config-Cactus.tar.gz $(TARBALL_DIR)/config-Cactus.c $(TARBALL_DIR)/config-Cactus.o @@ -226,7 +229,8 @@ $(TARBALL_DIR)/flesh-Cactus.ccldeps: echo " $(CCTK_HOME)/src/interface.ccl \\"; \ echo " $(CCTK_HOME)/src/param.ccl \\"; \ echo " $(CCTK_HOME)/src/schedule.ccl"; \ - } > $@ + } > $@.tmp + mv $@.tmp $@ .PRECIOUS: $(TARBALL_DIR)/flesh-Cactus.ccldeps $(TARBALL_DIR)/flesh-Cactus.files $(TARBALL_DIR)/flesh-Cactus.tar.gz $(TARBALL_DIR)/flesh-Cactus.c $(TARBALL_DIR)/flesh-Cactus.o @@ -283,7 +287,8 @@ $(TARBALL_DIR)/thorn-%.ccldeps: echo " $(CCTK_HOME)/arrangements/$(filter %/$*,$(THORNS))/interface.ccl \\"; \ echo " $(CCTK_HOME)/arrangements/$(filter %/$*,$(THORNS))/param.ccl \\"; \ echo " $(CCTK_HOME)/arrangements/$(filter %/$*,$(THORNS))/schedule.ccl"; \ - } > $@ + } > $@.tmp + mv $@.tmp $@ .PRECIOUS: $(TARBALL_DIR)/thorn-%.ccldeps $(TARBALL_DIR)/thorn-%.files $(TARBALL_DIR)/thorn-%.tar.gz $(TARBALL_DIR)/thorn-%.c $(TARBALL_DIR)/thorn-%.o @@ -103,8 +103,8 @@ namespace Formaline const string user = clean (getenv ("USER")); #endif char** argv; - CCTK_CommandLine (&argv); - const string executable = clean (argv[0]); + const int argc = CCTK_CommandLine (&argv); + const string executable = clean (argc >= 1 ? argv[0] : ""); const string version = clean (CCTK_FullVersion ()); const string compiled_at (clean (CCTK_CompileDateTime ())); char* rundatebuf = Util_CurrentDateTime (); |