ci_environment/src/env_lib.cxx
// Open the given file and search for the definition of the name "var".
Open the given file and search for the definition of the name "var".
Open the given file and search for the definition of the name " var " .
int lookup_config(string fname, string var, string &val) {
    ifstream f;
    f.open(fname.c_str());
    if (!f.good()) {
	return 1;
    }
    bool in_key = 1;
    string key;
    string value;
    for (;;) {
	char ch;
	f.get(ch);
	if (!(f.eof() || f.good())) {
	    break;
	}
	if (f.eof() || ch == '\x0d' || ch == '\x0a') {
	    if (in_key) {
	    }
	    else {
		if (var == trimmed(key)) {
		    val = trimmed(value);
		    f.close();
		    return 0;
		}
	    }
	    key = "";
        }
	if (f.eof()) {
	    break;
	}
	if (in_key && ch != '=') {
	    key += ch;
	}
	else if (in_key) {
	    in_key = false;
	    value = "";
	}
	else {
	    value += ch;
	}
    }
    f.close();
    return 1;
}
int lookup_config ( string fname , string var , string & val ) { ifstream f ; f . open ( fname . c_str ( ) ) ; if ( ! f . good ( ) ) { return 1 ; } bool in_key = 1 ; string key ; string value ; for ( ; ; ) { char ch ; f . get ( ch ) ; if ( ! ( f . eof ( ) || f . good ( ) ) ) { break ; } if ( f . eof ( ) || ch == ' \x0d ' || ch == ' \x0a ' ) { if ( in_key ) { } else { if ( var == trimmed ( key ) ) { val = trimmed ( value ) ; f . close ( ) ; return 0 ; } } key = " " ; } if ( f . eof ( ) ) { break ; } if ( in_key && ch != ' ' ) { key += ch ; } else if ( in_key ) { in_key = false ; value = " " ; } else { value += ch ; } } f . close ( ) ; return 1 ; }
Open the given file and search for the definition of the name "var".
Open the given file and search for the definition of the name " var " .
// Reached end of line with no value. // Reached end of line with value.