31 #if defined (HAVE_CONFIG_H)
68 static bool have_blksize
70 static bool have_blocks
77 m.assign (
"dev",
static_cast<double> (fs.
dev ()));
78 m.assign (
"ino", fs.
ino ());
79 m.assign (
"mode", fs.
mode ());
81 m.assign (
"nlink", fs.
nlink ());
82 m.assign (
"uid", fs.
uid ());
83 m.assign (
"gid", fs.
gid ());
84 m.assign (
"rdev", have_rdev ?
static_cast<double> (fs.
rdev ()) : nan);
85 m.assign (
"size", fs.
size ());
86 m.assign (
"atime", fs.
atime ());
87 m.assign (
"mtime", fs.
mtime ());
88 m.assign (
"ctime", fs.
ctime ());
93 m.assign (
"blksize", nan);
96 m.assign (
"blocks", fs.
blocks ());
98 m.assign (
"blocks", nan);
123 if (args.length () != 2)
135 if (i_old >= 0 && i_new >= 0)
141 return ovl (status, msg);
168 int nargin = args.length ();
170 if (nargin < 1 || nargin > 2)
173 std::string exec_file = args(0).xstring_value (
"exec: FILE must be a string");
179 string_vector tmp = args(1).xstring_vector_value (
"exec: all arguments must be strings");
185 exec_args[0] = exec_file;
187 for (
int i = 0; i <
len; i++)
188 exec_args[i+1] = tmp[i];
194 exec_args[0] = exec_file;
208 return ovl (status, msg);
258 int nargin = args.length ();
260 if (nargin < 1 || nargin > 3)
263 std::string exec_file = args(0).xstring_value (
"popen2: COMMAND argument must be a string");
269 string_vector tmp = args(1).xstring_vector_value (
"popen2: all arguments must be strings");
275 arg_list[0] = exec_file;
277 for (
int i = 0; i <
len; i++)
278 arg_list[i+1] = tmp[i];
284 arg_list[0] = exec_file;
287 bool sync_mode = (nargin == 3 ? args(2).bool_value () :
false);
296 error (
"%s", msg.c_str ());
298 FILE *ifile = fdopen (filedesc[1],
"r");
299 FILE *ofile = fdopen (filedesc[0],
"w");
439 if (args.length () != 3)
450 int req = args(1).int_value (
true);
451 int arg = args(2).int_value (
true);
455 error (
"fcntl: invalid file id");
461 return ovl (status, msg);
487 if (args.length () != 0)
490 if (interp.at_top_level ())
491 error (
"fork: cannot be called from command line");
497 return ovl (pid, msg);
506 if (args.length () != 0)
513 return ovl (pid, msg);
523 if (args.length () != 0)
536 if (args.length () != 0)
549 if (args.length () != 0)
562 if (args.length () != 0)
575 if (args.length () != 0)
588 if (args.length () != 0)
616 if (args.length () != 2)
619 pid_t pid = args(0).int_value (
true);
621 int sig = args(1).int_value (
true);
627 return ovl (status, msg);
641 if (args.length () != 1)
644 std::string fname = args(0).xstring_value (
"lstat: NAME must be a string");
661 error (
"mkfifo: invalid digit");
665 while ((
x = (
x - tmp) / obase))
670 error (
"mkfifo: invalid digit");
694 if (args.length () != 2)
697 std::string
name = args(0).xstring_value (
"mkfifo: FILE must be a string");
699 int octal_mode = args(1).xint_value (
"mkfifo: MODE must be an integer");
702 error (
"mkfifo: MODE must be a positive integer value");
704 int mode =
convert (octal_mode, 8, 10);
710 return ovl (status, msg);
738 if (args.length () != 0)
747 return ovl (-1, -1, -1, msg);
750 FILE *ifile = fdopen (fid[0],
"r");
751 FILE *ofile = fdopen (fid[1],
"w");
861 if (args.length () != 1)
866 if (args(0).is_scalar_type ())
878 std::string fname = args(0).xstring_value (
"stat: NAME must be a string");
898 if (args.length () != 1)
901 double mode = args(0).xdouble_value (
"S_ISREG: invalid MODE value");
916 if (args.length () != 1)
919 double mode = args(0).xdouble_value (
"S_ISDIR: invalid MODE value");
934 if (args.length () != 1)
937 double mode = args(0).xdouble_value (
"S_ISCHR: invalid MODE value");
952 if (args.length () != 1)
955 double mode = args(0).xdouble_value (
"S_ISBLK: invalid MODE value");
970 if (args.length () != 1)
973 double mode = args(0).xdouble_value (
"S_ISFIFO: invalid MODE value");
988 if (args.length () != 1)
991 double mode = args(0).xdouble_value (
"S_ISLNK: invalid MODE value");
1006 if (args.length () != 1)
1009 double mode = args(0).xdouble_value (
"S_ISSOCK: invalid MODE value");
1014 DEFUN (gethostname, args, ,
1020 if (args.length () != 0)
1026 DEFUN (uname, args, ,
1051 if (args.length () != 0)
1058 m.assign (
"sysname", sysinfo.
sysname ());
1059 m.assign (
"nodename", sysinfo.
nodename ());
1060 m.assign (
"release", sysinfo.
release ());
1061 m.assign (
"version", sysinfo.
version ());
1062 m.assign (
"machine", sysinfo.
machine ());
1087 if (args.length () != 1)
1090 std::string
name = args(0).xstring_value (
"unlink: FILE must be a string");
1102 return ovl (status, msg);
1171 int nargin = args.length ();
1173 if (nargin != 1 && nargin != 2)
1176 pid_t pid = args(0).xint_value (
"waitpid: OPTIONS must be an integer");
1181 options = args(1).xint_value (
"waitpid: PID must be an integer value");
1188 return ovl (result, status, msg);
1199 if (args.length () != 1)
1202 int status = args(0).xint_value (
"WIFEXITED: STATUS must be an integer");
1217 if (args.length () != 1)
1220 int status = args(0).xint_value (
"WEXITSTATUS: STATUS must be an integer");
1233 if (args.length () != 1)
1236 int status = args(0).xint_value (
"WIFSIGNALED: STATUS must be an integer");
1251 if (args.length () != 1)
1254 int status = args(0).xint_value (
"WTERMSIG: STATUS must be an integer");
1271 if (args.length () != 1)
1274 int status = args(0).xint_value (
"WCOREDUMP: STATUS must be an integer");
1290 if (args.length () != 1)
1293 int status = args(0).xint_value (
"WIFSTOPPED: STATUS must be an integer");
1308 if (args.length () != 1)
1311 int status = args(0).xint_value (
"WSTOPSIG: STATUS must be an integer");
1324 if (args.length () != 1)
1327 int status = args(0).xint_value (
"WIFCONTINUED: STATUS must be an integer");
1342 if (args.length () != 1)
1345 std::string
name = args(0).xstring_value (
"canonicalize_file_name: NAME must be a string");
1351 return ovl (result, msg.empty () ? 0 : -1, msg);
static bool ignoring_entries(void)
static void clean_up_and_save(const std::string &="", int=-1)
Provides threadsafe access to octave.
void file_renamed(bool load_new)
void file_remove(const std::string &old_name, const std::string &new_name)
void write_timestamp(void)
int get_file_number(const octave_value &fid) const
stream lookup(int fid, const std::string &who="") const
sys::time mtime(void) const
nlink_t nlink(void) const
std::string mode_as_string(void) const
std::string error(void) const
sys::time atime(void) const
static bool have_struct_stat_st_rdev(void)
static bool have_struct_stat_st_blocks(void)
static bool have_struct_stat_st_blksize(void)
sys::time ctime(void) const
static std::string get_host_name(void)
std::string machine(void) const
std::string release(void) const
std::string nodename(void) const
std::string version(void) const
std::string message(void) const
std::string sysname(void) const
static octave::stream create(const std::string &n, FILE *f=nullptr, std::ios::openmode m=std::ios::in|std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8", c_file_ptr_buf::close_fcn cf=c_file_ptr_buf::file_close)
octave_idx_type length(void) const
void resize(octave_idx_type n, const std::string &rfv="")
octave_idx_type numel(void) const
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
#define DEFUNX(name, fname, args_name, nargout_name, doc)
Macro to define a builtin function with certain internal name.
void error(const char *fmt,...)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
int octave_o_trunc_wrapper(void)
int octave_f_dupfd_wrapper(void)
int octave_o_wronly_wrapper(void)
int octave_o_creat_wrapper(void)
int octave_o_append_wrapper(void)
int octave_o_sync_wrapper(void)
int octave_o_nonblock_wrapper(void)
int octave_o_excl_wrapper(void)
int octave_f_getfd_wrapper(void)
int octave_o_rdonly_wrapper(void)
int octave_f_setfd_wrapper(void)
int octave_o_rdwr_wrapper(void)
int octave_f_setfl_wrapper(void)
int octave_o_async_wrapper(void)
int octave_f_getfl_wrapper(void)
F77_RET_T const F77_DBLE * x
int wexitstatus(int status)
std::string canonicalize_file_name(const std::string &name)
pid_t getpgrp(std::string &msg)
bool wifstopped(int status)
pid_t popen2(const std::string &cmd, const string_vector &args, bool sync_mode, int *fildes)
int execvp(const std::string &file, const string_vector &argv)
bool wifsignaled(int status)
int kill(pid_t pid, int sig)
pid_t waitpid(pid_t pid, int *status, int options)
bool wifcontinued(int status)
int fcntl(int fd, int cmd, long arg)
int dup2(int old_fd, int new_fd)
int unlink(const std::string &name)
bool wifexited(int status)
int mkfifo(const std::string &nm, mode_t md)
int wcoredump(int status)
pid_t fork(std::string &msg)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
DEFMETHODX("quad", Fquad, interp, args,, doc:)
static octave_scalar_map mk_stat_map(const octave::sys::base_file_stat &fs)
OCTAVE_EXPORT octave_value_list Flstat(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fgetpgrp(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fgetgid(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffork(octave::interpreter &interp, const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_WRONLY(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fgetuid(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fgetegid(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FS_ISLNK(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fgetppid(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fpopen2(octave::interpreter &interp, const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FF_DUPFD(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FF_SETFD(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fmkfifo(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_RDWR(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FS_ISSOCK(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fpipe(octave::interpreter &interp, const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FS_ISCHR(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWUNTRACED(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWIFEXITED(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWTERMSIG(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_TRUNC(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_CREAT(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWEXITSTATUS(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Funlink(octave::interpreter &interp, const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fdup2(octave::interpreter &interp, const octave_value_list &args, int)
static octave_value const_value(const octave_value_list &args, int val)
OCTAVE_EXPORT octave_value_list FO_ASYNC(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fgeteuid(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_APPEND(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWIFSTOPPED(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_SYNC(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FS_ISFIFO(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FS_ISREG(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fexec(octave::interpreter &interp, const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWIFCONTINUED(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FF_GETFD(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fcanonicalize_file_name(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fwaitpid(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_NONBLOCK(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWCONTINUE(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffcntl(octave::interpreter &interp, const octave_value_list &args, int)
static int convert(int x, int ibase, int obase)
OCTAVE_EXPORT octave_value_list Fkill(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FS_ISBLK(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FO_RDONLY(const octave_value_list &args, int)
static octave_value_list mk_stat_result(const octave::sys::base_file_stat &fs)
OCTAVE_EXPORT octave_value_list FO_EXCL(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FF_GETFL(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWIFSIGNALED(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FF_SETFL(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWCOREDUMP(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FS_ISDIR(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWNOHANG(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FWSTOPSIG(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fgetpid(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fstat(octave::interpreter &interp, const octave_value_list &args, int)