Mercurial > octave-nkf
diff liboctave/oct-syscalls.cc @ 10411:479cc8a0a846
use gnulib namespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 15 Mar 2010 15:57:23 -0400 |
parents | 07ebe522dac2 |
children | fd0a3ac60b0e |
line wrap: on
line diff
--- 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; }