Definition at line 442 of file parser.cc.
Implements DescRead.
Definition at line 448 of file parser.cc.
References HighParser::GetLineData(), HighParser::GetStringWithDelims(), HighParser::GetYesNoOrBool(), HighParser::IsArg(), HighParser::IsKeyWord(), and MBDYN_EXCEPT_ARGS.
452 silent_cerr(
"Parser error in SetEnvDR::Read(), "
453 "arg(s) expected at line "
461 overwrite = b ? 1 : 0;
466 silent_cerr(
"unable to get AVA for \"setenv\" at line "
471 char *avasep = std::strchr(const_cast<char *>(ava),
'=');
472 if (avasep == NULL) {
475 #elif defined(HAVE_PUTENV)
477 silent_cerr(
"unable to unset the environment variable "
478 "\"" << ava <<
"\" at line "
486 silent_cerr(
"illegal AVA \"" << ava
494 bool bPresent(getenv(ava) != NULL);
495 int rc = setenv(ava, avasep, overwrite);
497 silent_cerr(
"unable to set the environment variable \""
498 << ava <<
"\" to \"" << avasep
504 if (bPresent && overwrite == 0) {
505 silent_cout(
"Environment variable \"" << ava
506 <<
"\" _not_ overwritten with \"" << avasep
507 <<
"\" (current value is \"" << getenv(ava)
511 }
else if (!bPresent) {
512 silent_cout(
"Environment variable \"" << ava
513 <<
"\" set to \"" << avasep
518 silent_cout(
"Environment variable \"" << ava
519 <<
"\" overwritten to \"" << avasep
524 #else // ! HAVE_SETENV
525 silent_cerr(
"SetEnvDR::Read(): warning, setenv() not available; ignored at line "
527 #endif // !HAVE_SETENV
#define MBDYN_EXCEPT_ARGS
virtual HighParser::ErrOut GetLineData(void) const
virtual bool GetYesNoOrBool(bool bDefval=false)
virtual bool IsKeyWord(const char *sKeyWord)
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
The documentation for this struct was generated from the following file: