28 #if defined (HAVE_CONFIG_H)
36 #include <sys/types.h>
39 #if defined (__WIN32__) && ! defined (__CYGWIN__)
72 return access (nm, mode);
90 #if defined (HAVE_CTERMID)
100 return dup2 (fd1, fd2);
103 #if defined (__WIN32__) && ! defined (__CYGWIN__)
137 #define SHELL_SPECIAL_CHARS \
138 "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
140 #define SHELL_SPACE_CHARS \
141 " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
144 prepare_spawn (
char **
argv)
151 for (argc = 0; argv[
argc] != NULL; argc++)
155 new_argv = (
char **)
malloc (argc + 1);
158 for (i = 0; i <
argc; i++)
160 const char *
string = argv[
i];
162 if (
string[0] ==
'\0')
163 new_argv[
i] = strdup (
"\"\"");
164 else if (strpbrk (
string, SHELL_SPECIAL_CHARS) != NULL)
166 int quote_around = (strpbrk (
string, SHELL_SPACE_CHARS) != NULL);
168 unsigned int backslashes;
177 for (s =
string; *s !=
'\0'; s++)
181 length += backslashes + 1;
189 length += backslashes + 1;
191 quoted_string = (
char *)
malloc (length + 1);
197 for (s =
string; *s !=
'\0'; s++)
203 for (j = backslashes + 1; j > 0; j--)
215 for (j = backslashes; j > 0; j--)
221 new_argv[
i] = quoted_string;
224 new_argv[
i] = strdup (
string);
227 new_argv[
argc] = NULL;
237 #if defined (__WIN32__) && ! defined (__CYGWIN__)
239 char **sanitized_argv = prepare_spawn (argv);
241 int status = spawnv (P_OVERLAY, file, sanitized_argv);
245 char **p = sanitized_argv;
248 free (sanitized_argv);
254 return execv (file, argv);
262 return execvp (file, argv);
268 #if defined (HAVE_FORK)
278 return ftruncate (fd, sz);
290 #if defined (HAVE_GETEGID)
300 #if defined (HAVE_GETEUID)
310 #if defined (HAVE_GETGID)
320 return gethostname (nm, len);
326 #if defined (HAVE_GETPGRP)
336 #if defined (HAVE_GETPID)
346 #if defined (HAVE_GETPPID)
356 #if defined (HAVE_GETUID)
372 return link (nm1, nm2);
390 #if defined (HAVE_SETSID)
406 return STDOUT_FILENO;
424 #if defined (HAVE_VFORK)
434 #if defined (HAVE_FORK)
444 #if defined (HAVE_VFORK)
int dup2(int old_fd, int new_fd)
uid_t octave_geteuid_wrapper(void)
For example cd octave end example noindent changes the current working directory to file
pid_t octave_vfork_wrapper(void)
int octave_link_wrapper(const char *nm1, const char *nm2)
int unlink(const std::string &name)
int octave_rmdir_wrapper(const char *nm)
pid_t octave_getpid_wrapper(void)
int symlink(const std::string &old_name, const std::string &new_name)
int octave_ftruncate_wrapper(int fd, off_t sz)
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
uid_t octave_getuid_wrapper(void)
int octave_stdout_fileno(void)
int octave_pipe_wrapper(int *fd)
int octave_access_wrapper(const char *nm, int mode)
int octave_access_r_ok(void)
int octave_access_f_ok(void)
int octave_symlink_wrapper(const char *nm1, const char *nm2)
static octave_idx_type link(octave_idx_type s, octave_idx_type t, octave_idx_type *pp)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
int octave_isatty_wrapper(int fd)
gid_t octave_getgid_wrapper(void)
int octave_access_x_ok(void)
int octave_unlink_wrapper(const char *nm)
gid_t octave_getegid_wrapper(void)
bool octave_have_vfork(void)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
pid_t octave_fork_wrapper(void)
pid_t octave_setsid_wrapper(void)
int octave_execvp_wrapper(const char *file, char *const *argv)
bool octave_have_fork(void)
int rmdir(const std::string &name)
=val(i)}if ode{val(i)}occurs in table i
int octave_stdin_fileno(void)
int execvp(const std::string &file, const string_vector &argv)
int octave_gethostname_wrapper(char *nm, size_t len)
int chdir(const std::string &path_arg)
int octave_close_wrapper(int fd)
pid_t octave_getppid_wrapper(void)
int octave_execv_wrapper(const char *file, char *const *argv)
pid_t fork(std::string &msg)
const char * octave_ctermid_wrapper(void)
pid_t octave_getpgrp_wrapper(void)
char * octave_getcwd_wrapper(char *nm, size_t len)
int octave_chdir_wrapper(const char *nm)
int octave_dup2_wrapper(int fd1, int fd2)
int octave_access_w_ok(void)
pid_t getpgrp(std::string &msg)
pid_t vfork(std::string &msg)