# HG changeset patch # User John W. Eaton # Date 1265668223 18000 # Node ID 4a278982c0fea4073d54474a1d68dd6e8360954d # Parent 703038d648f1fd76bc58131a4f53039a7d7ccdcd use gnulib progname module diff -r 703038d648f1 -r 4a278982c0fe ChangeLog --- a/ChangeLog Mon Feb 08 15:24:42 2010 +0100 +++ b/ChangeLog Mon Feb 08 17:30:23 2010 -0500 @@ -1,3 +1,7 @@ +2010-02-08 John W. Eaton + + * bootstrap.conf (gnulib_modules): Include progname in the list. + 2010-02-08 Jaroslav Hajek * NEWS: Update. diff -r 703038d648f1 -r 4a278982c0fe bootstrap.conf --- a/bootstrap.conf Mon Feb 08 15:24:42 2010 +0100 +++ b/bootstrap.conf Mon Feb 08 17:30:23 2010 -0500 @@ -34,6 +34,7 @@ sleep nanosleep pathmax + progname readlink rename rmdir diff -r 703038d648f1 -r 4a278982c0fe liboctave/ChangeLog --- a/liboctave/ChangeLog Mon Feb 08 15:24:42 2010 +0100 +++ b/liboctave/ChangeLog Mon Feb 08 17:30:23 2010 -0500 @@ -1,3 +1,11 @@ +2010-02-08 John W. Eaton + + * oct-env.cc (octave_env::prog_invocation_name): Rename from + program_invocation_name. Change all uses. + (octave_env::prog_name): Rename from program_name. Change all uses. + (octave_env::do_set_program_name): Call ::set_program_name + function from gnulib. + 2010-02-08 Jaroslav Hajek * idx-vector.h (idx_vector::idx_base_rep::sort_idx): New pure virtual diff -r 703038d648f1 -r 4a278982c0fe liboctave/oct-env.cc --- a/liboctave/oct-env.cc Mon Feb 08 15:24:42 2010 +0100 +++ b/liboctave/oct-env.cc Mon Feb 08 17:30:23 2010 -0500 @@ -50,6 +50,8 @@ #include #include +#include "progname.h" + #include "file-ops.h" #include "lo-error.h" #include "lo-sysdep.h" @@ -60,7 +62,7 @@ octave_env::octave_env (void) : follow_symbolic_links (true), verbatim_pwd (true), - current_directory (), program_name (), program_invocation_name (), + current_directory (), prog_name (), prog_invocation_name (), user_name (), host_name () { // Get a real value for the current directory. @@ -146,14 +148,14 @@ octave_env::get_program_name (void) { return (instance_ok ()) - ? instance->program_name : std::string (); + ? instance->prog_name : std::string (); } std::string octave_env::get_program_invocation_name (void) { return (instance_ok ()) - ? instance->program_invocation_name : std::string (); + ? instance->prog_invocation_name : std::string (); } void @@ -212,13 +214,18 @@ void octave_env::do_set_program_name (const std::string& s) const { - program_invocation_name = s; + // For gnulib. + ::set_program_name (s.c_str ()); + + // Let gnulib strip off things like the "lt-" prefix from libtool. + prog_invocation_name = program_name; size_t pos - = program_invocation_name.find_last_of (file_ops::dir_sep_chars ()); + = prog_invocation_name.find_last_of (file_ops::dir_sep_chars ()); - program_name = (pos == std::string::npos) - ? program_invocation_name : program_invocation_name.substr (pos+1); + // Also keep a shortened version of the program name. + prog_name = (pos == std::string::npos) + ? prog_invocation_name : prog_invocation_name.substr (pos+1); } // Return a pretty pathname. If the first part of the pathname is the diff -r 703038d648f1 -r 4a278982c0fe liboctave/oct-env.h --- a/liboctave/oct-env.h Mon Feb 08 15:24:42 2010 +0100 +++ b/liboctave/oct-env.h Mon Feb 08 17:30:23 2010 -0500 @@ -127,9 +127,9 @@ mutable std::string current_directory; // Etc. - mutable std::string program_name; + mutable std::string prog_name; - mutable std::string program_invocation_name; + mutable std::string prog_invocation_name; mutable std::string user_name;