diff liboctave/system/oct-env.cc @ 21891:3ca0a5b1b313

hide gnulib progname.h header * liboctave/wrappers/set-program-name-wrapper.c, liboctave/wrappers/set-program-name-wrapper.h: New files. Wrap gnulib set_program_name function and hide gnulib header. * liboctave/wrappers/module.mk: Update. * oct-env.cc: Use new wrapper function.
author John W. Eaton <jwe@octave.org>
date Mon, 13 Jun 2016 20:06:51 -0400
parents a99c2407f930
children 4d723ba06b4a
line wrap: on
line diff
--- a/liboctave/system/oct-env.cc	Mon Jun 13 18:42:02 2016 -0400
+++ b/liboctave/system/oct-env.cc	Mon Jun 13 20:06:51 2016 -0400
@@ -49,8 +49,6 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "progname.h"
-
 #include "file-ops.h"
 #include "lo-error.h"
 #include "lo-sysdep.h"
@@ -58,6 +56,7 @@
 #include "oct-env.h"
 #include "oct-passwd.h"
 #include "oct-syscalls.h"
+#include "set-program-name-wrapper.h"
 #include "singleton-cleanup.h"
 
 namespace octave
@@ -269,16 +268,17 @@
 
       if (! initialized)
         {
+          // octave_set_program_name_wrapper returns a cleaned up
+          // version of the program name (stripping libtool's "lt-"
+          // prefix, for example).
+
           // The string passed to gnulib's ::set_program_name function must
           // exist for the duration of the program so allocate a copy here
           // instead of passing S.c_str () which only exists as long as the
           // string object S.
 
-          // For gnulib.
-          ::set_program_name (strsave (s.c_str ()));
-
-          // Let gnulib strip off things like the "lt-" prefix from libtool.
-          prog_invocation_name = program_name;
+          prog_invocation_name
+            = octave_set_program_name_wrapper (strsave (s.c_str ()));
 
           size_t pos
             = prog_invocation_name.find_last_of (octave::sys::file_ops::dir_sep_chars ());