23 #if defined (HAVE_CONFIG_H)
36 #if defined (HAVE_UNISTD_H)
37 # if defined (HAVE_SYS_TYPES_H)
38 # include <sys/types.h>
55 #if ! defined (SHELL_PATH)
56 # define SHELL_PATH "/bin/sh"
64 #if ! defined (BUFSIZ)
71 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)
76 f =
octave_popen (command, (mode & std::ios::in) ?
"r" :
"w");
87 if (mode & std::ios::out)
88 ::setvbuf (
f, 0, _IOLBF,
BUFSIZ);
92 #elif defined (HAVE_UNISTD_H)
96 volatile int child_std_end = (mode & std::ios::in) ? 1 : 0;
98 volatile int parent_end, child_end;
106 if (mode & std::ios::in)
108 parent_end = pipe_fds[0];
109 child_end = pipe_fds[1];
113 parent_end = pipe_fds[1];
114 child_end = pipe_fds[0];
123 if (child_end != child_std_end)
129 while (octave_procbuf_list)
131 FILE *fp = octave_procbuf_list->
f;
139 octave_procbuf_list = octave_procbuf_list->
next;
142 execl (
SHELL_PATH,
"sh",
"-c", command, static_cast<void *> (0));
155 f = ::fdopen (parent_end, (mode & std::ios::in) ?
"r" :
"w");
157 if (mode & std::ios::out)
158 ::setvbuf (
f, 0, _IOLBF,
BUFSIZ);
163 octave_procbuf_list =
this;
177 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)
189 #elif defined (HAVE_UNISTD_H)
217 while (wait_pid == -1 && errno == EINTR);
FILE * octave_popen(const char *command, const char *mode)
int octave_pclose(FILE *f)
octave_procbuf * open(const char *command, int mode)
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any simply delete all the lines from the buffer before leaving the editor When invoked with no edit the previously executed command
pid_t waitpid(pid_t pid, int *status, int options)
octave_procbuf * close(void)
static octave_procbuf * octave_procbuf_list
int octave_close_wrapper(int fd)
pid_t fork(std::string &msg)
int octave_dup2_wrapper(int fd1, int fd2)