31 #if defined (HAVE_CONFIG_H)
37 #include <sys/types.h>
40 #if defined (__WIN32__) && ! defined (__CYGWIN__)
44 #if defined (OCTAVE_USE_WINDOWS_API)
49 #if defined (__WIN32__) && ! defined (__CYGWIN__)
50 # include "windows-spawn.h"
83 return access (nm, mode);
89 #if defined (OCTAVE_USE_WINDOWS_API)
91 int status = _wchdir (wnm);
108 #if defined (HAVE_CTERMID)
118 return dup2 (fd1, fd2);
124 #if defined (__WIN32__) && ! defined (__CYGWIN__)
126 char *argv_mem_to_free;
127 const char **sanitized_argv = prepare_spawn ((
const char *
const *) argv,
130 # if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE)
134 for (argc = 0; sanitized_argv[argc] != NULL; argc++)
138 const wchar_t **wargv =
malloc ((argc + 1) *
sizeof (
wchar_t *));
141 for (
size_t i_arg = 0; i_arg < argc; i_arg++)
142 wargv[i_arg] =
u8_to_wchar (sanitized_argv[i_arg]);
146 free (sanitized_argv);
147 free (argv_mem_to_free);
149 int status = _wspawnv (P_WAIT, wfile, wargv+1);
154 const wchar_t **wp = wargv;
157 free ((
wchar_t *) *wp++);
162 int status = spawnv (P_OVERLAY, file, sanitized_argv);
166 free (sanitized_argv);
167 free (argv_mem_to_free);
175 return execv (file, argv);
183 return execvp (file, argv);
189 #if defined (HAVE_FORK)
199 return ftruncate (fd, sz);
205 #if defined (OCTAVE_USE_WINDOWS_API)
206 wchar_t *tmp = _wgetcwd (NULL, 0);
220 memcpy (nm, retval,
len);
232 #if defined (HAVE_GETEGID)
242 #if defined (HAVE_GETEUID)
252 #if defined (HAVE_GETGID)
262 return gethostname (nm,
len);
268 #if defined (HAVE_GETPGRP)
278 #if defined (HAVE_GETPID)
288 #if defined (HAVE_GETPPID)
298 #if defined (HAVE_GETUID)
314 return link (nm1, nm2);
326 #if defined (OCTAVE_USE_WINDOWS_API)
328 int status = _wrmdir (wnm);
339 #if defined (HAVE_SETSID)
355 return STDOUT_FILENO;
367 #if defined (OCTAVE_USE_WINDOWS_API)
371 DWORD file_attributes = GetFileAttributesW (wnm);
372 if (file_attributes != INVALID_FILE_ATTRIBUTES
373 && file_attributes & FILE_ATTRIBUTE_READONLY)
374 SetFileAttributesW (wnm, file_attributes & ~FILE_ATTRIBUTE_READONLY);
376 int status = _wunlink (wnm);
388 #if defined (HAVE_VFORK)
398 #if defined (HAVE_FORK)
408 #if defined (HAVE_VFORK)
int chdir(const std::string &path_arg)
int symlink(const std::string &old_name, const std::string &new_name)
int link(const std::string &old_name, const std::string &new_name)
int unlink(const std::string &name)
int rmdir(const std::string &name)
T::size_type strlen(const typename T::value_type *str)
pid_t fork(std::string &msg)
int execvp(const std::string &file, const string_vector &argv)
pid_t getpgrp(std::string &msg)
pid_t vfork(std::string &msg)
int dup2(int old_fd, int new_fd)
wchar_t * u8_to_wchar(const char *u8)
char * u8_from_wchar(const wchar_t *wc)
int octave_access_f_ok(void)
pid_t octave_setsid_wrapper(void)
gid_t octave_getgid_wrapper(void)
uid_t octave_geteuid_wrapper(void)
int octave_ftruncate_wrapper(int fd, off_t sz)
int octave_gethostname_wrapper(char *nm, size_t len)
int octave_rmdir_wrapper(const char *nm)
pid_t octave_fork_wrapper(void)
pid_t octave_getpgrp_wrapper(void)
pid_t octave_getppid_wrapper(void)
int octave_access_r_ok(void)
bool octave_have_vfork(void)
int octave_execvp_wrapper(const char *file, char *const *argv)
gid_t octave_getegid_wrapper(void)
int octave_execv_wrapper(const char *file, char *const *argv)
pid_t octave_getpid_wrapper(void)
int octave_close_wrapper(int fd)
int octave_access_wrapper(const char *nm, int mode)
int octave_unlink_wrapper(const char *nm)
int octave_chdir_wrapper(const char *nm)
int octave_symlink_wrapper(const char *nm1, const char *nm2)
uid_t octave_getuid_wrapper(void)
int octave_access_x_ok(void)
int octave_link_wrapper(const char *nm1, const char *nm2)
int octave_access_w_ok(void)
const char * octave_ctermid_wrapper(void)
int octave_stdout_fileno(void)
char * octave_getcwd_wrapper(char *nm, size_t len)
pid_t octave_vfork_wrapper(void)
int octave_isatty_wrapper(int fd)
bool octave_have_fork(void)
int octave_dup2_wrapper(int fd1, int fd2)
int octave_stdin_fileno(void)
int octave_pipe_wrapper(int *fd)