diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-06-29 21:04:28 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-06-29 21:04:28 +0000 |
commit | b898dbd864e764cdb173e8d8548d31efdb485ac0 (patch) | |
tree | f6a0f2194d4d19fc5acc13defb8cd135c92b42ad /src | |
parent | fe0816fa8a3e1c54a7a10ea621a936ad5a029a9c (diff) |
(Nasty) little hack to add the old Cactus 3 nameofparfile functionality ...
anywhere that $PARAMETER_FILE appears it will be replaced by the name of
the parameter file that was used, without the last 4 characters.
This is so you can say
IO::outdir = $PARAMETER_FILE
so that ./cactus_exe mypar.par
will put output in a directory mypar (using the standard IO thorns).
This feature won't be documented until it is added properly, and the notation may change slightly.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1707 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r-- | src/util/ParseFile.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/util/ParseFile.c b/src/util/ParseFile.c index b18432af..40be9a83 100644 --- a/src/util/ParseFile.c +++ b/src/util/ParseFile.c @@ -69,7 +69,8 @@ static int lineno = 1; int ParseFile(FILE *ifp, - int (*set_function)(const char *, const char *)) + int (*set_function)(const char *, const char *), + tFleshConfig *ConfigData) { /* Buffers for parsing from the file */ char tokens[BUF_SZ], value[BUF_SZ]; @@ -212,11 +213,26 @@ int ParseFile(FILE *ifp, tokens,value); #endif set_function(tokens,value); - - } - else + else if (c == '$') + { + /* We got a define */ + /* FIXME: Assume it is a parameter file for now */ + int lpar=(strlen(ConfigData->parameter_file_name)-4)*sizeof(char); + + while (!(c==' ' || c=='\t' || c == '\n' || c == EOF)) + { + c = fgetc(ifp); +#ifdef DEBUG + printf("%c",c); +#endif + } + strncpy(value,ConfigData->parameter_file_name,lpar); + set_function(tokens,value); + } + else { + int p = 0; value[p++] = c; if (ntokens == 1) |