changeset 10411:479cc8a0a846

use gnulib namespace
author John W. Eaton <jwe@octave.org>
date Mon, 15 Mar 2010 15:57:23 -0400
parents b3ec24dc305a
children d2ac9433cd09
files ChangeLog configure.ac liboctave/ChangeLog liboctave/cmd-edit.cc liboctave/cmd-hist.cc liboctave/dir-ops.cc liboctave/file-ops.cc liboctave/file-stat.cc liboctave/kpse.cc liboctave/lo-mappers.cc liboctave/lo-sysdep.cc liboctave/lo-utils.cc liboctave/oct-env.cc liboctave/oct-glob.cc liboctave/oct-syscalls.cc liboctave/oct-time.cc liboctave/oct-uname.cc liboctave/sparse-util.cc src/ChangeLog src/c-file-ptr-stream.cc src/c-file-ptr-stream.h src/dirfns.cc src/file-io.cc src/input.cc src/lex.ll src/mex.cc src/oct-fstrm.cc src/oct-hist.cc src/oct-parse.yy src/oct-procbuf.cc src/sighandlers.cc src/sighandlers.h src/toplev.cc
diffstat 33 files changed, 279 insertions(+), 223 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Mar 12 19:15:39 2010 -0500
+++ b/ChangeLog	Mon Mar 15 15:57:23 2010 -0400
@@ -1,3 +1,7 @@
+2010-03-15  John W. Eaton  <jwe@octave.org>
+
+	* configure.ac (AH_BOTTOM): Define GNULIB_NAMESPACE.
+
 2010-03-09  Jaroslav Hajek  <highegg@gmail.com>
 
 	* NEWS: Update.
--- a/configure.ac	Fri Mar 12 19:15:39 2010 -0500
+++ b/configure.ac	Mon Mar 15 15:57:23 2010 -0400
@@ -1869,6 +1869,10 @@
 ### Some things to add to the bottom of config.h.
 
 AH_BOTTOM([
+#if !defined (GNULIB_NAMESPACE)
+#define GNULIB_NAMESPACE gnulib
+#endif
+
 #if defined (__GNUC__)
 #define GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
 #define GCC_ATTR_NORETURN __attribute__ ((__noreturn__))
--- a/liboctave/ChangeLog	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/ChangeLog	Mon Mar 15 15:57:23 2010 -0400
@@ -1,3 +1,79 @@
+2010-03-15  John W. Eaton  <jwe@octave.org>
+
+	* oct-glob.cc (octave_glob): Tag calls to glob and globfree with
+	gnulib::.
+
+	* kpse.cc (DEBUG_START, DEBUGF, FATAL_PERROR, FATAL, KPSE_DEBUG,
+	log_search, find_first_of): Tag calls to
+	fputs with gnulib::.
+	(DEBUGF1, DEBUGF2, DEBUGF3, DEBUGF4, log_search, find_first_of,
+	kpse_element_dirs): Tag calls to fprintf with gnulib::.
+	(hash_lookup, search, find_first_of, kpse_element_dirs):
+	Tag calls to putc with gnulib::.
+	(do_subdir): Tag call to opendir with gnulib::.
+	(xclosedir): Tag call to closedir with gnulib::.  Assume closedir
+	returns int value.
+
+	* cmd-hist.cc (gnu_history::do_append): Tag calls to open and
+	close with gnulib::.
+	(command_history::error): Tag call to strerror with gnulib::.
+
+	* cmd-edit.cc (gnu_readline::command_generator,
+	gnu_readline::command_quoter, gnu_readline::command_dequoter):
+	Tag call to malloc with gnulib::.
+	(default_command_editor::do_readline): Tag call to fputs with gnulib::.
+	(command_editor::error): Tag call to strerror with gnulib::.
+
+	* sparse-util.cc (SparseCholPrint): Tag call to vfprintf with gnulib::.
+
+	* oct-uname.cc (octave_uname::init): Tag call to strerror with gnulib::.
+
+	* oct-time.cc (octave_time::stamp): Tag call to gettimeofday
+	with gnulib::.
+	(octave_strptime::init): Tag call to strptime with gnulib::.
+
+	* oct-syscalls.cc (octave_syscalls::dup2,
+	octave_syscalls::execvp, octave_syscalls::fork,
+	octave_syscalls::vfork, octave_syscalls::getpgrp,
+	octave_syscalls::pipe, octave_syscalls::waitpid,
+	octave_syscalls::kill, octave_fcntl):
+	Tag call to strerror with gnulib::.
+	(octave_syscalls::dup2): Tag call to dup2 with gnulib::.
+	(octave_syscalls::popen2): Tag calls to close with gnulib::.
+	(octave_fcntl): Tag call to fcntl with gnulib::.
+
+	* oct-env.cc (octave_env::error): Tag call to strerror with gnulib::.
+
+	* lo-utils.cc (octave_putenv): Tag call to malloc with gnulib::.
+	(octave_fgets): Tag calls to malloc and realloc with gnulib::.
+
+	* lo-sysdep.cc (octave_getcwd): Tag call to getcwd with gnulib::.
+
+	* lo-mappers.cc (xround): Tag call to round with gnulib::.
+
+	* file-stat.cc (file_stat::update_internal): Tag calls to lstat
+	and strerror with gnulib::.
+	(file_fstat::update_internal): Tag calls to fstat and strerror
+	with gnulib::.
+
+	* file-ops.cc (octave_mkdir): Tag call to mkdir with gnulib::.
+	(octave_mkfifo): Tag call to mkfifo with gnulib::.
+	(octave_link): Tag call to link with gnulib::.
+	(octave_symlink): Tag call to symlink with gnulib::.
+	(octave_readlink): Tag call to readlink with gnulib::.
+	(octave_rename): Tag call to rename with gnulib::.
+	(octave_rmdir): Tag call to rmdir with gnulib::.
+	(octave_unlink): Tag call to unlink with gnulib::.
+	(octave_canonicalize_file_name): Tag call to
+	canonicalize_file_name with gnulib::.
+	(octave_mkdir, octave_mkfifo, octave_link, octave_symlink,
+	octave_readlink, octave_rename, octave_rmdir, octave_unlink,
+	octave_tempnam, octave_canonicalize_file_name): Tag calls to
+	strerror with gnulib::.
+
+	* dir-ops.cc (dir_entry::close): Tag closedir call with gnulib::.
+	(dir_entry::open): Tag opendir and strerror calls with gnulib::.
+
 2010-03-09  Jaroslav Hajek  <highegg@gmail.com>
 
 	* oct-inttypes.h (octave_int_base::ftrunc, octave_int_base::fnon_int,
--- a/liboctave/cmd-edit.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/cmd-edit.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -637,7 +637,7 @@
 
   if (len > 0)
     {
-      retval = static_cast<char *> (malloc (len+1));
+      retval = static_cast<char *> (gnulib::malloc (len+1));
 
       strcpy (retval, tmp.c_str ());
     }
@@ -658,7 +658,7 @@
 
   if (len > 0)
     {
-      retval = static_cast<char *> (malloc (len+1));
+      retval = static_cast<char *> (gnulib::malloc (len+1));
 
       strcpy (retval, tmp.c_str ());
     }
@@ -679,7 +679,7 @@
 
   if (len > 0)
     {
-      retval = static_cast<char *> (malloc (len+1));
+      retval = static_cast<char *> (gnulib::malloc (len+1));
 
       strcpy (retval, tmp.c_str ());
     }
@@ -759,7 +759,7 @@
 std::string
 default_command_editor::do_readline (const std::string& prompt, bool& eof)
 {
-  fputs (prompt.c_str (), output_stream);
+  gnulib::fputs (prompt.c_str (), output_stream);
   fflush (output_stream);
 
   return octave_fgetl (input_stream, eof);
@@ -1540,7 +1540,7 @@
 void
 command_editor::error (int err_num)
 {
-  current_liboctave_error_handler ("%s", strerror (err_num));
+  current_liboctave_error_handler ("%s", gnulib::strerror (err_num));
 }
 
 void
--- a/liboctave/cmd-hist.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/cmd-hist.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -291,8 +291,8 @@
                 {
                   int tem;
 
-                  tem = open (f.c_str (), O_CREAT, 0666);
-                  close (tem);
+                  tem = gnulib::open (f.c_str (), O_CREAT, 0666);
+                  gnulib::close (tem);
                 }
 
               int status
@@ -807,7 +807,7 @@
 void
 command_history::error (int err_num)
 {
-  (*current_liboctave_error_handler) ("%s", strerror (err_num));
+  (*current_liboctave_error_handler) ("%s", gnulib::strerror (err_num));
 }
 
 void
--- a/liboctave/dir-ops.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/dir-ops.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -53,15 +53,12 @@
       
       std::string fullname = file_ops::tilde_expand (name);
 
-      dir = static_cast<void *> (opendir (fullname.c_str ()));
+      dir = static_cast<void *> (gnulib::opendir (fullname.c_str ()));
 
       if (dir)
         fail = false;
       else
-        {
-          using namespace std;
-          errmsg = strerror (errno);
-        }
+        errmsg = gnulib::strerror (errno);
     }
   else
     errmsg = "dir_entry::open: empty file name";
@@ -98,7 +95,7 @@
 dir_entry::close (void)
 {
   if (dir)
-    closedir (static_cast<DIR *> (dir));
+    gnulib::closedir (static_cast<DIR *> (dir));
 
   dir = 0;
 }
--- a/liboctave/file-ops.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/file-ops.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -373,13 +373,10 @@
 
   int status = -1;
 
-  status = mkdir (name.c_str (), mode);
+  status = gnulib::mkdir (name.c_str (), mode);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
@@ -402,13 +399,10 @@
   // don't have working mkfifo functions.  On those systems, mkfifo will
   // always return -1 and set errno.
 
-  status = mkfifo (name.c_str (), mode);
+  status = gnulib::mkfifo (name.c_str (), mode);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
@@ -428,13 +422,10 @@
 
   int status = -1;
 
-  status = link (old_name.c_str (), new_name.c_str ());
+  status = gnulib::link (old_name.c_str (), new_name.c_str ());
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
@@ -454,13 +445,10 @@
 
   int status = -1;
 
-  status = symlink (old_name.c_str (), new_name.c_str ());
+  status = gnulib::symlink (old_name.c_str (), new_name.c_str ());
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
@@ -482,13 +470,10 @@
 
   char buf[MAXPATHLEN+1];
 
-  status = readlink (path.c_str (), buf, MAXPATHLEN);
+  status = gnulib::readlink (path.c_str (), buf, MAXPATHLEN);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
   else
     {
       buf[status] = '\0';
@@ -514,13 +499,10 @@
 
   msg = std::string ();
 
-  status = rename (from.c_str (), to.c_str ());
+  status = gnulib::rename (from.c_str (), to.c_str ());
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
@@ -539,13 +521,10 @@
 
   int status = -1;
 
-  status = rmdir (name.c_str ());
+  status = gnulib::rmdir (name.c_str ());
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
@@ -651,13 +630,10 @@
 
   int status = -1;
 
-  status = unlink (name.c_str ());
+  status = gnulib::unlink (name.c_str ());
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
@@ -690,10 +666,7 @@
       free (tmp);
     }
   else
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return retval;
 }
@@ -714,7 +687,7 @@
 
 #if defined (HAVE_CANONICALIZE_FILE_NAME)
 
-  char *tmp = ::canonicalize_file_name (name.c_str ());
+  char *tmp = gnulib::canonicalize_file_name (name.c_str ());
 
   if (tmp)
     {
@@ -815,10 +788,7 @@
 #endif
 
   if (retval.empty ())
-    {
-      using namespace std;
-      msg = strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return retval;
 }
--- a/liboctave/file-stat.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/file-stat.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -200,14 +200,13 @@
 
       struct stat buf;
 
-      int status = follow_links ? stat (cname, &buf) : lstat (cname, &buf);
+      int status = follow_links
+        ? stat (cname, &buf) : gnulib::lstat (cname, &buf);
 
       if (status < 0)
         {
-          using namespace std;
-
           fail = true;
-          errmsg = strerror (errno);
+          errmsg = gnulib::strerror (errno);
         }
       else
         {
@@ -249,14 +248,12 @@
 
       struct stat buf;
 
-      int status = fstat (fid, &buf);
+      int status = gnulib::fstat (fid, &buf);
 
       if (status < 0)
         {
-          using namespace std;
-
           fail = true;
-          errmsg = strerror (errno);
+          errmsg = gnulib::strerror (errno);
         }
       else
         {
--- a/liboctave/kpse.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/kpse.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -183,19 +183,19 @@
 #define KPSE_LAST_DEBUG KPSE_DEBUG_VARS
 
 /* A printf for the debugging.  */
-#define DEBUGF_START() do { fputs ("kdebug:", stderr)
+#define DEBUGF_START() do { gnulib::fputs ("kdebug:", stderr)
 #define DEBUGF_END()        fflush (stderr); } while (0)
 
 #define DEBUGF(str)                                                     \
-  DEBUGF_START (); fputs (str, stderr); DEBUGF_END ()
+  DEBUGF_START (); gnulib::fputs (str, stderr); DEBUGF_END ()
 #define DEBUGF1(str, e1)                                                \
-  DEBUGF_START (); fprintf (stderr, str, e1); DEBUGF_END ()
+  DEBUGF_START (); gnulib::fprintf (stderr, str, e1); DEBUGF_END ()
 #define DEBUGF2(str, e1, e2)                                            \
-  DEBUGF_START (); fprintf (stderr, str, e1, e2); DEBUGF_END ()
+  DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2); DEBUGF_END ()
 #define DEBUGF3(str, e1, e2, e3)                                        \
-  DEBUGF_START (); fprintf (stderr, str, e1, e2, e3); DEBUGF_END ()
+  DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2, e3); DEBUGF_END ()
 #define DEBUGF4(str, e1, e2, e3, e4)                                    \
-  DEBUGF_START (); fprintf (stderr, str, e1, e2, e3, e4); DEBUGF_END ()
+  DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2, e3, e4); DEBUGF_END ()
 
 #undef fopen
 #define fopen kpse_fopen_trace
@@ -258,7 +258,7 @@
 #define FATAL_PERROR(str) \
   do \
     { \
-      fputs ("pathsearch: ", stderr); \
+      gnulib::fputs ("pathsearch: ", stderr); \
       perror (str); exit (EXIT_FAILURE); \
     } \
   while (0)
@@ -266,9 +266,9 @@
 #define FATAL(str) \
   do \
     { \
-      fputs ("pathsearch: fatal: ", stderr); \
-      fputs (str, stderr); \
-      fputs (".\n", stderr); \
+      gnulib::fputs ("pathsearch: fatal: ", stderr); \
+      gnulib::fputs (str, stderr); \
+      gnulib::fputs (".\n", stderr); \
       exit (1); \
     } \
   while (0)
@@ -389,16 +389,16 @@
     {
       DEBUGF1 ("hash_lookup (%s) =>", key.c_str ());
       if (ret.empty ())
-        fputs (" (nil)\n", stderr);
+        gnulib::fputs (" (nil)\n", stderr);
       else
         {
           int len = ret.length ();
           for (int i = 0; i < len; i++)
             {
-              putc (' ', stderr);
-              fputs (ret[i].c_str (), stderr);
+              gnulib::putc (' ', stderr);
+              gnulib::fputs (ret[i].c_str (), stderr);
             }
-          putc ('\n', stderr);
+          gnulib::putc ('\n', stderr);
         }
       fflush (stderr);
     }
@@ -675,7 +675,7 @@
 
           /* Only record absolute filenames, for privacy.  */
           if (log_file && kpse_absolute_p (filename.c_str (), false))
-            fprintf (log_file, "%lu %s\n",
+            gnulib::fprintf (log_file, "%lu %s\n",
                      static_cast<unsigned long> (time (0)),
                      filename.c_str ());
 
@@ -683,7 +683,7 @@
              the debugging line in `search', where this is called, so
              just print the filename here, don't use DEBUGF.  */
           if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
-            fputs (filename.c_str (), stderr);
+            gnulib::fputs (filename.c_str (), stderr);
         }
     }
 }
@@ -873,7 +873,7 @@
       log_search (ret_list);
 
       if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
-        putc ('\n', stderr);
+        gnulib::putc ('\n', stderr);
     }
 
   return ret_list;
@@ -1040,20 +1040,20 @@
 
   if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
     {
-      fputs ("start find_first_of ((", stderr);
+      gnulib::fputs ("start find_first_of ((", stderr);
 
       int len = names.length ();
 
       for (int i = 0; i < len; i++)
         {
           if (i == 0)
-            fputs (names[i].c_str (), stderr);
+            gnulib::fputs (names[i].c_str (), stderr);
           else
-            fprintf (stderr, ", %s", names[i].c_str ());
+            gnulib::fprintf (stderr, ", %s", names[i].c_str ());
         }
 
-      fprintf (stderr, "), path=%s, must_exist=%d).\n",
-               path.c_str (), must_exist);
+      gnulib::fprintf (stderr, "), path=%s, must_exist=%d).\n",
+                       path.c_str (), must_exist);
     }
 
   for (int i = 0; i < names.length (); i++)
@@ -1089,24 +1089,25 @@
 
       if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
         {
-          fputs ("find_first_of (", stderr);
+          gnulib::fputs ("find_first_of (", stderr);
 
           int len = names.length ();
 
           for (int i = 0; i < len; i++)
             {
               if (i == 0)
-                fputs (names[i].c_str (), stderr);
+                gnulib::fputs (names[i].c_str (), stderr);
               else
-                fprintf (stderr, ", %s", names[i].c_str ());
+                gnulib::fprintf (stderr, ", %s", names[i].c_str ());
             }
-          fputs (") =>", stderr);
+
+          gnulib::fputs (") =>", stderr);
         }
 
       log_search (ret_list);
 
       if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
-        putc ('\n', stderr);
+        gnulib::putc ('\n', stderr);
     }
 
   return ret_list;
@@ -2220,7 +2221,7 @@
 #else /* not WIN32 */
 
   /* If we can't open it, quit.  */
-  dir = opendir (name.c_str ());
+  dir = gnulib::opendir (name.c_str ());
 
   if (! dir)
     return;
@@ -2381,9 +2382,9 @@
         {
           str_llist_elt_type *e;
           for (e = *ret; e; e = STR_LLIST_NEXT (*e))
-            fprintf (stderr, " %s", (STR_LLIST (*e)).c_str ());
+            gnulib::fprintf (stderr, " %s", (STR_LLIST (*e)).c_str ());
         }
-      putc ('\n', stderr);
+      gnulib::putc ('\n', stderr);
       fflush (stderr);
     }
 #endif /* KPSE_DEBUG */
@@ -2395,14 +2396,10 @@
 void
 xclosedir (DIR *d)
 {
-#ifdef CLOSEDIR_VOID
-  closedir (d);
-#else
-  int ret = closedir (d);
+  int ret = gnulib::closedir (d);
 
   if (ret != 0)
     FATAL ("closedir failed");
-#endif
 }
 #endif
 
--- a/liboctave/lo-mappers.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/lo-mappers.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -73,7 +73,7 @@
 xround (double x)
 {
 #if defined (HAVE_ROUND)
-  return round (x);
+  return gnulib::round (x);
 #else
   if (x >= 0)
     {
@@ -377,7 +377,7 @@
 xround (float x)
 {
 #if defined (HAVE_ROUND)
-  return round (x);
+  return gnulib::round (x);
 #else
   if (x >= 0)
     {
--- a/liboctave/lo-sysdep.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/lo-sysdep.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -54,7 +54,7 @@
   // will allocate a buffer as large as necessary if buf and size are
   // both 0.
 
-  char *tmp = getcwd (0, 0);
+  char *tmp = gnulib::getcwd (0, 0);
 
   if (tmp)
     {
--- a/liboctave/lo-utils.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/lo-utils.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -136,7 +136,7 @@
 {
   int new_len = name.length () + value.length () + 2;
 
-  char *new_item = static_cast<char*> (malloc (new_len));
+  char *new_item = static_cast<char*> (gnulib::malloc (new_len));
 
   sprintf (new_item, "%s=%s", name.c_str (), value.c_str ());
 
@@ -164,7 +164,7 @@
   int grow_size = 1024;
   int max_size = grow_size;
 
-  char *buf = static_cast<char *> (malloc (max_size));
+  char *buf = static_cast<char *> (gnulib::malloc (max_size));
   char *bufptr = buf;
   int len = 0;
 
@@ -179,7 +179,7 @@
               int tmp = bufptr - buf + grow_size - 1;
               grow_size *= 2;
               max_size += grow_size;
-              buf = static_cast<char *> (realloc (buf, max_size));
+              buf = static_cast<char *> (gnulib::realloc (buf, max_size));
               bufptr = buf + tmp;
 
               if (*(bufptr-1) == '\n')
--- a/liboctave/oct-env.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/oct-env.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -537,7 +537,7 @@
 void
 octave_env::error (int err_num) const
 {
-  (*current_liboctave_error_handler) ("%s", strerror (err_num));
+  (*current_liboctave_error_handler) ("%s", gnulib::strerror (err_num));
 }
 
 void
--- a/liboctave/oct-glob.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/oct-glob.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -86,7 +86,7 @@
                                '/'); 
 #endif 
 
-          int err = ::glob (xpat.c_str (), GLOB_NOSORT, 0, &glob_info);
+          int err = gnulib::glob (xpat.c_str (), GLOB_NOSORT, 0, &glob_info);
 
           if (! err)
             {
@@ -121,7 +121,7 @@
                     } 
                 }
 
-              globfree (&glob_info);
+              gnulib::globfree (&glob_info);
             }
         }
     }
--- a/liboctave/oct-syscalls.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/oct-syscalls.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -63,13 +63,10 @@
   int status = -1;
 
 #if defined (HAVE_DUP2)
-  status = ::dup2 (old_fd, new_fd);
+  status = gnulib::dup2 (old_fd, new_fd);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("dup2");
 #endif
@@ -100,10 +97,7 @@
   string_vector::delete_c_str_vec (argv);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("execvp");
 #endif
@@ -120,10 +114,7 @@
   status = ::fork ();
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("fork");
 #endif
@@ -144,10 +135,7 @@
 #endif
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("vfork");
 #endif
@@ -164,10 +152,7 @@
   status = ::getpgrp ();
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("getpgrp");
 #endif
@@ -253,10 +238,7 @@
   status = ::pipe (fildes);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("pipe");
 #endif
@@ -282,10 +264,7 @@
   retval = ::octave_waitpid (pid, status, options);
 
   if (retval < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("waitpid");
 #endif
@@ -311,10 +290,7 @@
   status = ::kill (pid, sig);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 #else
   msg = NOT_SUPPORTED ("kill");
 #endif
@@ -363,15 +339,15 @@
               interactive = false;
 
               // Child process
-              ::close (child_stdin[1]);
-              ::close (child_stdout[0]);
+              gnulib::close (child_stdin[1]);
+              gnulib::close (child_stdout[0]);
 
               if (dup2 (child_stdin[0], STDIN_FILENO) >= 0)
                 {
-                  ::close (child_stdin[0]);
+                  gnulib::close (child_stdin[0]);
                   if (dup2 (child_stdout[1], STDOUT_FILENO) >= 0)
                     {
-                      ::close (child_stdout[1]);
+                      gnulib::close (child_stdout[1]);
                       if (execvp (cmd, args, child_msg) < 0)
                         child_msg = "popen2 (child): unable to start process -- " + child_msg;
                     }
@@ -388,8 +364,9 @@
           else
             {
               // Parent process
-              ::close (child_stdin[0]);
-              ::close (child_stdout[1]);
+              gnulib::close (child_stdin[0]);
+              gnulib::close (child_stdout[1]);
+
 #if defined (F_SETFL) && defined (O_NONBLOCK)
               if (! sync_mode && octave_fcntl (child_stdout[0], F_SETFL, O_NONBLOCK, msg) < 0)
                 msg = "popen2: error setting file mode -- " + msg;
@@ -401,13 +378,14 @@
                   return pid;
                 }
             }
-          ::close (child_stdout[0]);
-          ::close (child_stdout[1]);
+          gnulib::close (child_stdout[0]);
+          gnulib::close (child_stdout[1]);
         }
       else
         msg = "popen2: pipe creation failed -- " + msg;
-      ::close (child_stdin[0]);
-      ::close (child_stdin[1]);
+
+      gnulib::close (child_stdin[0]);
+      gnulib::close (child_stdin[1]);
     }
   else
     msg = "popen2: pipe creation failed -- " + msg;
@@ -430,13 +408,10 @@
 
   int status = -1;
 
-  status = ::fcntl (fd, cmd, arg);
+  status = gnulib::fcntl (fd, cmd, arg);
 
   if (status < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
 
   return status;
 }
--- a/liboctave/oct-time.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/oct-time.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -78,7 +78,7 @@
 {
   struct timeval tp;
 
-  gettimeofday (&tp, 0);
+  gnulib::gettimeofday (&tp, 0);
 
   ot_unix_time = tp.tv_sec;
   ot_usec = tp.tv_usec;
@@ -265,7 +265,7 @@
 
   char *p = strsave (str.c_str ());
 
-  char *q = strptime (p, fmt.c_str (), &t);
+  char *q = gnulib::strptime (p, fmt.c_str (), &t);
 
   // Fill in wday and yday, but only if mday is valid and the mon and year
   // are filled in, avoiding issues with mktime and invalid dates.
--- a/liboctave/oct-uname.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/oct-uname.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -42,10 +42,7 @@
   err = ::uname (&unm);
 
   if (err < 0)
-    {
-      using namespace std;
-      msg = ::strerror (errno);
-    }
+    msg = gnulib::strerror (errno);
   else
     {
       utsname_sysname = unm.sysname;
--- a/liboctave/sparse-util.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/liboctave/sparse-util.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -51,7 +51,7 @@
 {
   va_list args;
   va_start (args, fmt);
-  int ret = vfprintf (stderr, fmt, args);
+  int ret = gnulib::vfprintf (stderr, fmt, args);
   fflush (stderr);
   va_end (args);
   return ret;
--- a/src/ChangeLog	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/ChangeLog	Mon Mar 15 15:57:23 2010 -0400
@@ -1,3 +1,44 @@
+2010-03-15  John W. Eaton  <jwe@octave.org>
+
+	* oct-parse.yy, lex.ll: Undefine GNULIB_NAMESPACE immediately
+	after including <config.h>.
+
+	* toplev.cc (wait_for_input): Tag call to select with gnulib::.
+
+	* sighandlers.h (BLOCK_SIGNAL): Tag calls to sigemptyset,
+	sigaddset, and sigprocmask with gnulib::.
+	(UNBLOCK_CHILD): Tag call to sigprocmask with gnulib::.
+	* sighandlers.cc (octave_set_signal_handler): Tag calls to
+	sigemptyset with gnulib::.
+	(octave_set_signal_handler): Tag call to sigaction with gnulib::.
+
+	* oct-procbuf.cc (octave_procbuf::open): Tag calls to close, dup2,
+	and fclose with gnulib::.
+	(octave_procbuf::close): Tag call to fclose with gnulib::.
+
+	* oct-hist.cc (unlink_cleanup): Tag call to unlink with gnulib::.
+
+	* oct-fstrm.cc (octave_fstream::octave_fstream): Tag call to
+	strerror with gnulib::.
+
+	* mex.cc (mex::malloc_unmarked, mex::realloc, mxArray::malloc,
+	mxMalloc, mxRealloc): Tag call to malloc with gnulib::.
+
+	* input.cc (gnu_readline): Tag call to fputs with gnulib::.
+
+	* file-io.cc (cleanup_tmp_files): Tag call to unlink with gnulib::.
+	(do_stream_open, Ftmpfile, Fmkstemp): Tag call to strerror with
+	gnulib::.
+
+	* dirfns.cc (octave_change_to_directory): Tag call to strerror
+	with gnulib::.
+
+	* c-file-ptr-stream.cc (c_file_ptr_buf::overflow): Tag calls to
+	fputc with gnulib::.
+	(c_file_ptr_buf::xsputn): Tag call to fwrite with gnulib::.
+	(c_file_ptr_buf::file_close): Move here from
+	c-file-ptr-stream.h.  Tag call to fclose with gnulib::.
+
 2010-03-12  Ben Abbott <bpabbott@mac.com>
 
 	* /DLD-FUNCTIONS/chol.cc: Increase tolerance for single precision test.
--- a/src/c-file-ptr-stream.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/c-file-ptr-stream.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -53,12 +53,12 @@
 {
 #if defined (CXX_ISO_COMPLIANT_LIBRARY)
   if (f)
-    return (c != traits_type::eof ()) ? fputc (c, f) : flush ();
+    return (c != traits_type::eof ()) ? gnulib::fputc (c, f) : flush ();
   else
     return traits_type::not_eof (c);
 #else
   if (f)
-    return (c != EOF) ? fputc (c, f) : flush ();
+    return (c != EOF) ? gnulib::fputc (c, f) : flush ();
   else
     return EOF;
 #endif
@@ -104,7 +104,7 @@
 c_file_ptr_buf::xsputn (const char* s, std::streamsize n)
 {
   if (f)
-    return fwrite (s, 1, n, f);
+    return gnulib::fwrite (s, 1, n, f);
   else
     return 0;
 }
@@ -193,6 +193,12 @@
   return retval;
 }
 
+int
+c_file_ptr_buf::file_close (FILE *f)
+{
+  return gnulib::fclose (f);
+}
+
 #ifdef HAVE_ZLIB
 
 c_zfile_ptr_buf::~c_zfile_ptr_buf (void)
--- a/src/c-file-ptr-stream.h	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/c-file-ptr-stream.h	Mon Mar 15 15:57:23 2010 -0400
@@ -82,7 +82,7 @@
 
   void clear (void) { if (f) clearerr (f); }
 
-  static int file_close (FILE *f) { return ::fclose (f); }
+  static int file_close (FILE *f);
 
 protected:
 
--- a/src/dirfns.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/dirfns.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -83,11 +83,7 @@
       load_path::update ();
     }
   else
-    {
-      using namespace std;
-
-      error ("%s: %s", newdir.c_str (), strerror (errno));
-    }
+    error ("%s: %s", newdir.c_str (), gnulib::strerror (errno));
 
   return cd_ok;
 }
--- a/src/file-io.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/file-io.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -126,7 +126,7 @@
     {
       std::string filename = tmp_files.top ();
       tmp_files.pop ();
-      unlink (filename.c_str ());
+      gnulib::unlink (filename.c_str ());
     }
 }
 
@@ -497,10 +497,7 @@
                   if (fptr)
                     retval = octave_zstdiostream::create (fname, fptr, md, flt_fmt);
                   else
-                    {
-                      using namespace std;
-                      retval.error (::strerror (errno));
-                    }
+                    retval.error (gnulib::strerror (errno));
                 }
               else
 #endif
@@ -510,10 +507,7 @@
                   retval = octave_stdiostream::create (fname, fptr, md, flt_fmt);
 
                   if (! fptr)
-                    {
-                      using namespace std;
-                      retval.error (::strerror (errno));
-                    }
+                    retval.error (gnulib::strerror (errno));
                 }
 
             }
@@ -1936,8 +1930,7 @@
         }
       else
         {
-          using namespace std;
-          retval(1) = ::strerror (errno);
+          retval(1) = gnulib::strerror (errno);
           retval(0) = -1;
         }
     }
@@ -2015,8 +2008,7 @@
 
           if (fd < 0)
             {
-              using namespace std;
-              retval(2) = ::strerror (errno);
+              retval(2) = gnulib::strerror (errno);
               retval(0) = fd;
             }
           else
@@ -2046,8 +2038,7 @@
                 }
               else
                 {
-                  using namespace std;
-                  retval(2) = ::strerror (errno);
+                  retval(2) = gnulib::strerror (errno);
                   retval(0) = -1;
                 }
             }
--- a/src/input.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/input.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -213,7 +213,7 @@
         {
           FILE *stream = command_editor::get_output_stream ();
 
-          fputs (s.c_str (), stream);
+          gnulib::fputs (s.c_str (), stream);
           fflush (stream);
         }
 
--- a/src/lex.ll	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/lex.ll	Mon Mar 15 15:57:23 2010 -0400
@@ -28,6 +28,10 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+
+#if defined (GNULIB_NAMESPACE)
+#undef GNULIB_NAMESPACE
+#endif
 }
 
 %s COMMAND_START
--- a/src/mex.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/mex.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -2107,7 +2107,7 @@
   // Allocate memory.
   void *malloc_unmarked (size_t n)
   {
-    void *ptr = ::malloc (n);
+    void *ptr = gnulib::malloc (n);
 
     if (! ptr)
       {
@@ -2163,7 +2163,7 @@
 
     if (ptr)
       {
-        v = ::realloc (ptr, n);
+        v = gnulib::realloc (ptr, n);
         
         std::set<void *>::iterator p = memlist.find (ptr);
         
@@ -2376,7 +2376,7 @@
 void *
 mxArray::malloc (size_t n)
 {
-  return mex_context ? mex_context->malloc_unmarked (n) : ::malloc (n);
+  return mex_context ? mex_context->malloc_unmarked (n) : gnulib::malloc (n);
 }
 
 void *
@@ -2478,13 +2478,13 @@
 void *
 mxMalloc (size_t n)
 {
-  return mex_context ? mex_context->malloc (n) : malloc (n);
+  return mex_context ? mex_context->malloc (n) : gnulib::malloc (n);
 }
 
 void *
 mxRealloc (void *ptr, size_t size)
 {
-  return mex_context ? mex_context->realloc (ptr, size) : realloc (ptr, size);
+  return mex_context ? mex_context->realloc (ptr, size) : gnulib::realloc (ptr, size);
 }
 
 void
--- a/src/oct-fstrm.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/oct-fstrm.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -57,11 +57,7 @@
 #endif
 
   if (! fs)
-    {
-      using namespace std;
-
-      error (strerror (errno));
-    }
+    error (gnulib::strerror (errno));
 }
 
 // Position a stream at OFFSET relative to ORIGIN.
--- a/src/oct-hist.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/oct-hist.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -420,9 +420,10 @@
   return name;
 }
 
-static void unlink_cleanup (const char *file)
+static void
+unlink_cleanup (const char *file)
 {
-  unlink (file);
+  gnulib::unlink (file);
 }
 
 static void
--- a/src/oct-parse.yy	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/oct-parse.yy	Mon Mar 15 15:57:23 2010 -0400
@@ -33,6 +33,10 @@
 #include <config.h>
 #endif
 
+#if defined (GNULIB_NAMESPACE)
+#undef GNULIB_NAMESPACE
+#endif
+
 #include <cassert>
 #include <cstdio>
 
--- a/src/oct-procbuf.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/oct-procbuf.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -105,12 +105,12 @@
 
   if (proc_pid == 0)
     {
-      ::close (parent_end);
+      gnulib::close (parent_end);
 
       if (child_end != child_std_end)
         {
-          ::dup2 (child_end, child_std_end);
-          ::close (child_end);
+          gnulib::dup2 (child_end, child_std_end);
+          gnulib::close (child_end);
         }
 
       while (octave_procbuf_list)
@@ -119,7 +119,7 @@
 
           if (fp)
             {
-              ::fclose (fp);
+              gnulib::fclose (fp);
               fp = 0;
             }
 
@@ -131,11 +131,11 @@
       exit (127);
     }
 
-  ::close (child_end);
+  gnulib::close (child_end);
 
   if (proc_pid < 0)
     {
-      ::close (parent_end);
+      gnulib::close (parent_end);
       return 0;
     }
 
@@ -193,7 +193,7 @@
             }
         }
 
-      if (status == 0 && ::fclose (f) == 0)
+      if (status == 0 && gnulib::fclose (f) == 0)
         {
           using namespace std;
 
--- a/src/sighandlers.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/sighandlers.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -195,10 +195,10 @@
     act.sa_flags |= SA_RESTART;
 #endif
 
-  sigemptyset (&act.sa_mask);
-  sigemptyset (&oact.sa_mask);
+  gnulib::sigemptyset (&act.sa_mask);
+  gnulib::sigemptyset (&oact.sa_mask);
 
-  sigaction (sig, &act, &oact);
+  gnulib::sigaction (sig, &act, &oact);
 
   return oact.sa_handler;
 }
--- a/src/sighandlers.h	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/sighandlers.h	Mon Mar 15 15:57:23 2010 -0400
@@ -52,10 +52,10 @@
 #define BLOCK_SIGNAL(sig, nvar, ovar) \
   do \
     { \
-      sigemptyset (&nvar); \
-      sigaddset (&nvar, sig); \
-      sigemptyset (&ovar); \
-      sigprocmask (SIG_BLOCK, &nvar, &ovar); \
+      gnulib::sigemptyset (&nvar); \
+      gnulib::sigaddset (&nvar, sig); \
+      gnulib::sigemptyset (&ovar); \
+      gnulib::sigprocmask (SIG_BLOCK, &nvar, &ovar); \
     } \
   while (0)
 
@@ -64,7 +64,7 @@
 #endif
 
 #define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
-#define UNBLOCK_CHILD(ovar) sigprocmask (SIG_SETMASK, &ovar, 0)
+#define UNBLOCK_CHILD(ovar) gnulib::sigprocmask (SIG_SETMASK, &ovar, 0)
 
 typedef void sig_handler (int);
 
--- a/src/toplev.cc	Fri Mar 12 19:15:39 2010 -0500
+++ b/src/toplev.cc	Mon Mar 15 15:57:23 2010 -0400
@@ -766,7 +766,7 @@
       FD_ZERO (&set);
       FD_SET (fid, &set);
 
-      retval = select (FD_SETSIZE, &set, 0, 0, 0);
+      retval = gnulib::select (FD_SETSIZE, &set, 0, 0, 0);
     }
 #else
   retval = 1;