source file of the GNU LilyPond music typesetter
- (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
char *s = strdup (combine.c_str ());
if (be_verbose_global)
- progress_indication (_f ("Setting %s to %s\n" , key, value.c_str ()));
+ progress_indication (_f ("Setting %s to %s" , key, value.c_str ())
+ + "\n");
- return putenv (s);
+ int retval = putenv (s);
+ /*
+ unfortunately, we can't portably free S here,
+ due to various bugs in glibc prior to 2.1.1
+ */
+ return retval;
}
return -1;
#endif /* __MINGW32__ */
if (argv0_abs.empty ())
- programming_error ("can't find absolute argv0.");
+ programming_error ("cannot find absolute argv0");
}
string bindir = dir_name (argv0_abs);
/*
When running from build dir, a full LILYPOND_PREFIX is set-up at
- $(OUTBASE)/share/lilypond/TOPLEVEL_VERSION
-
- This historical hack will allow the shorthand
-
- LILYPONDPREFIX=out lily/out/lilypond ...
+ $(OUTBASE)/{share, lib}/lilypond/current
*/
string
expand_environment_variables (string orig)
{
- const char *start_ptr = orig.c_str();
- const char *ptr = orig.c_str();
- size_t len = orig.length();
+ const char *start_ptr = orig.c_str ();
+ const char *ptr = orig.c_str ();
+ size_t len = orig.length ();
string out;
while (ptr < start_ptr + len)
if (start_var < end_var)
{
string var_name (start_var, end_var - start_var);
- const char *value = getenv (var_name.c_str());
+ const char *value = getenv (var_name.c_str ());
if (value != NULL)
out += string (value);
read_relocation_file (string filename)
{
if (be_verbose_global)
- progress_indication (_f ("Relocation file %s\n", filename.c_str ()));
+ progress_indication (_f ("Relocation file: %s", filename.c_str ())
+ + "\n");
char const *cname = filename.c_str ();
FILE *f = fopen (cname, "r");
if (!f)
- error (_f ("can't open file %s", cname));
+ error (_f ("cannot open file: `%s'", cname));
while (!feof (f))
{
value = expand_environment_variables (value);
if (command == "set")
- sane_putenv (variable.c_str(), value, true);
+ sane_putenv (variable.c_str (), value, true);
else if (command == "setdir")
- set_env_dir (variable.c_str(), value);
+ set_env_dir (variable.c_str (), value);
else if (command == "setfile")
- set_env_file (variable.c_str(), value);
+ set_env_file (variable.c_str (), value);
else if (command == "prependdir")
prepend_env_path (variable.c_str (), value);
else
- error ( _f("Unknown relocation command %s", command));
+ error (_f ("Unknown relocation command %s", command));
}
fclose (f);