29 #if defined (HAVE_CONFIG_H) 63 static bool have_rdev =
65 static bool have_blksize =
67 static bool have_blocks =
81 m.
assign (
"rdev", have_rdev ? static_cast<double> (
fs.
rdev ()) : nan);
120 if (args.length () != 2)
132 if (i_old >= 0 && i_new >= 0)
138 return ovl (status, msg);
144 DEFUNX (
"exec", Fexec, args, ,
165 int nargin = args.length ();
170 std::string exec_file = args(0).xstring_value (
"exec: FILE must be a string");
176 string_vector tmp = args(1).xstring_vector_value (
"exec: all arguments must be strings");
178 int len =
tmp.numel ();
180 exec_args.
resize (len + 1);
182 exec_args[0] = exec_file;
184 for (
int i = 0;
i < len;
i++)
185 exec_args[
i+1] =
tmp[
i];
191 exec_args[0] = exec_file;
203 return ovl (status, msg);
206 DEFMETHODX (
"popen2", Fpopen2, interp, args, ,
253 int nargin = args.length ();
258 std::string exec_file = args(0).xstring_value (
"popen2: COMMAND argument must be a string");
264 string_vector tmp = args(1).xstring_vector_value (
"popen2: all arguments must be strings");
266 int len =
tmp.numel ();
268 arg_list.
resize (len + 1);
270 arg_list[0] = exec_file;
272 for (
int i = 0;
i < len;
i++)
273 arg_list[
i+1] =
tmp[
i];
279 arg_list[0] = exec_file;
282 bool sync_mode = (
nargin == 3 ? args(2).bool_value () :
false);
291 error (msg.c_str ());
293 FILE *ifile = fdopen (filedesc[1],
"r");
294 FILE *
ofile = fdopen (filedesc[0],
"w");
434 if (args.length () != 3)
445 int req = args(1).int_value (
true);
450 error (
"fcntl: invalid file id");
456 return ovl (status, msg);
482 if (args.length () != 0)
488 error (
"fork: cannot be called from command line");
494 return ovl (pid, msg);
497 DEFUNX (
"getpgrp", Fgetpgrp, args, ,
503 if (args.length () != 0)
510 return ovl (pid, msg);
513 DEFUNX (
"getpid", Fgetpid, args, ,
520 if (args.length () != 0)
526 DEFUNX (
"getppid", Fgetppid, args, ,
533 if (args.length () != 0)
539 DEFUNX (
"getegid", Fgetegid, args, ,
546 if (args.length () != 0)
552 DEFUNX (
"getgid", Fgetgid, args, ,
559 if (args.length () != 0)
565 DEFUNX (
"geteuid", Fgeteuid, args, ,
572 if (args.length () != 0)
578 DEFUNX (
"getuid", Fgetuid, args, ,
585 if (args.length () != 0)
591 DEFUNX (
"kill", Fkill, args, ,
613 if (args.length () != 2)
616 pid_t pid = args(0).int_value (
true);
618 int sig = args(1).int_value (
true);
624 return ovl (status, msg);
627 DEFUNX (
"lstat", Flstat, args, ,
638 if (args.length () != 1)
651 convert (
int x,
int ibase,
int obase)
658 error (
"mkfifo: invalid digit");
662 while ((
x = (
x -
tmp) / obase))
667 error (
"mkfifo: invalid digit");
676 DEFUNX (
"mkfifo", Fmkfifo, args, ,
691 if (args.length () != 2)
694 std::string name = args(0).xstring_value (
"mkfifo: FILE must be a string");
696 int octal_mode = args(1).xint_value (
"mkfifo: MODE must be an integer");
699 error (
"mkfifo: MODE must be a positive integer value");
701 int mode = convert (octal_mode, 8, 10);
707 return ovl (status, msg);
735 if (args.length () != 0)
744 return ovl (-1, -1, -1, msg);
747 FILE *ifile = fdopen (
fid[0],
"r");
858 if (args.length () != 1)
863 if (args(0).is_scalar_type ())
885 DEFUNX (
"S_ISREG", FS_ISREG, args, ,
895 if (args.length () != 1)
898 double mode = args(0).xdouble_value (
"S_ISREG: invalid MODE value");
903 DEFUNX (
"S_ISDIR", FS_ISDIR, args, ,
913 if (args.length () != 1)
916 double mode = args(0).xdouble_value (
"S_ISDIR: invalid MODE value");
921 DEFUNX (
"S_ISCHR", FS_ISCHR, args, ,
931 if (args.length () != 1)
934 double mode = args(0).xdouble_value (
"S_ISCHR: invalid MODE value");
939 DEFUNX (
"S_ISBLK", FS_ISBLK, args, ,
949 if (args.length () != 1)
952 double mode = args(0).xdouble_value (
"S_ISBLK: invalid MODE value");
957 DEFUNX (
"S_ISFIFO", FS_ISFIFO, args, ,
967 if (args.length () != 1)
970 double mode = args(0).xdouble_value (
"S_ISFIFO: invalid MODE value");
975 DEFUNX (
"S_ISLNK", FS_ISLNK, args, ,
985 if (args.length () != 1)
988 double mode = args(0).xdouble_value (
"S_ISLNK: invalid MODE value");
993 DEFUNX (
"S_ISSOCK", FS_ISSOCK, args, ,
1003 if (args.length () != 1)
1006 double mode = args(0).xdouble_value (
"S_ISSOCK: invalid MODE value");
1011 DEFUN (gethostname, args, ,
1017 if (args.length () != 0)
1023 DEFUN (uname, args, ,
1048 if (args.length () != 0)
1073 DEFUNX (
"unlink", Funlink, args, ,
1084 if (args.length () != 1)
1087 std::string name = args(0).xstring_value (
"unlink: FILE must be a string");
1093 return ovl (status, msg);
1096 DEFUNX (
"waitpid", Fwaitpid, args, ,
1143 int nargin = args.length ();
1148 pid_t pid = args(0).xint_value (
"waitpid: OPTIONS must be an integer");
1153 options = args(1).xint_value (
"waitpid: PID must be an integer value");
1163 DEFUNX (
"WIFEXITED", FWIFEXITED, args, ,
1171 if (args.length () != 1)
1174 int status = args(0).xint_value (
"WIFEXITED: STATUS must be an integer");
1179 DEFUNX (
"WEXITSTATUS", FWEXITSTATUS, args, ,
1189 if (args.length () != 1)
1192 int status = args(0).xint_value (
"WEXITSTATUS: STATUS must be an integer");
1197 DEFUNX (
"WIFSIGNALED", FWIFSIGNALED, args, ,
1205 if (args.length () != 1)
1208 int status = args(0).xint_value (
"WIFSIGNALED: STATUS must be an integer");
1213 DEFUNX (
"WTERMSIG", FWTERMSIG, args, ,
1223 if (args.length () != 1)
1226 int status = args(0).xint_value (
"WTERMSIG: STATUS must be an integer");
1231 DEFUNX (
"WCOREDUMP", FWCOREDUMP, args, ,
1243 if (args.length () != 1)
1246 int status = args(0).xint_value (
"WCOREDUMP: STATUS must be an integer");
1251 DEFUNX (
"WIFSTOPPED", FWIFSTOPPED, args, ,
1262 if (args.length () != 1)
1265 int status = args(0).xint_value (
"WIFSTOPPED: STATUS must be an integer");
1270 DEFUNX (
"WSTOPSIG", FWSTOPSIG, args, ,
1280 if (args.length () != 1)
1283 int status = args(0).xint_value (
"WSTOPSIG: STATUS must be an integer");
1288 DEFUNX (
"WIFCONTINUED", FWIFCONTINUED, args, ,
1296 if (args.length () != 1)
1299 int status = args(0).xint_value (
"WIFCONTINUED: STATUS must be an integer");
1304 DEFUNX (
"canonicalize_file_name", Fcanonicalize_file_name, args, ,
1313 if (args.length () != 1)
1316 std::string name = args(0).xstring_value (
"canonicalize_file_name: NAME must be a string");
1322 return ovl (
result, msg.empty () ? 0 : -1, msg);
1334 DEFUNX (
"F_DUPFD", FF_DUPFD, args, ,
1347 return const_value (args,
val);
1350 DEFUNX (
"F_GETFD", FF_GETFD, args, ,
1363 return const_value (args,
val);
1366 DEFUNX (
"F_GETFL", FF_GETFL, args, ,
1379 return const_value (args,
val);
1382 DEFUNX (
"F_SETFD", FF_SETFD, args, ,
1395 return const_value (args,
val);
1398 DEFUNX (
"F_SETFL", FF_SETFL, args, ,
1411 return const_value (args,
val);
1414 DEFUNX (
"O_APPEND", FO_APPEND, args, ,
1430 return const_value (args,
val);
1433 DEFUNX (
"O_ASYNC", FO_ASYNC, args, ,
1448 return const_value (args,
val);
1451 DEFUNX (
"O_CREAT", FO_CREAT, args, ,
1467 return const_value (args,
val);
1470 DEFUNX (
"O_EXCL", FO_EXCL, args, ,
1485 return const_value (args,
val);
1488 DEFUNX (
"O_NONBLOCK", FO_NONBLOCK, args, ,
1504 return const_value (args,
val);
1507 DEFUNX (
"O_RDONLY", FO_RDONLY, args, ,
1522 return const_value (args,
val);
1525 DEFUNX (
"O_RDWR", FO_RDWR, args, ,
1541 return const_value (args,
val);
1544 DEFUNX (
"O_SYNC", FO_SYNC, args, ,
1559 return const_value (args,
val);
1562 DEFUNX (
"O_TRUNC", FO_TRUNC, args, ,
1578 return const_value (args,
val);
1581 DEFUNX (
"O_WRONLY", FO_WRONLY, args, ,
1596 return const_value (args,
val);
1599 DEFUNX (
"WNOHANG", FWNOHANG, args, ,
1613 DEFUNX (
"WUNTRACED", FWUNTRACED, args, ,
1627 DEFUNX (
"WCONTINUE", FWCONTINUE, args, ,
std::string error(void) const
int dup2(int old_fd, int new_fd)
int int_value(bool req_int=false, bool frc_str_conv=false) const
std::string canonicalize_file_name(const std::string &name)
int fcntl(int fd, int cmd, long arg)
int octave_o_creat_wrapper(void)
int kill(pid_t pid, int sig)
int unlink(const std::string &name)
OCTINTERP_API void print_usage(void)
identity matrix If supplied two scalar respectively For allows like xample val
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
octave::stream_list & streams
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
std::string version(void) const
sys::time ctime(void) const
int octave_o_append_wrapper(void)
int octave_f_getfd_wrapper(void)
#define DEFMETHODX(name, fname, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method with certain internal name.
static void clean_up_and_save(const std::string &="", int=-1)
int octave_f_setfl_wrapper(void)
void resize(octave_idx_type n, const std::string &rfv="")
int octave_f_dupfd_wrapper(void)
std::string mode_as_string(void) const
sys::time atime(void) const
bool wifstopped(int status)
static octave_scalar_map mk_stat_map(const octave::sys::base_file_stat &fs)
std::string sysname(void) const
std::string nodename(void) const
stream lookup(int fid, const std::string &who="") const
int octave_f_getfl_wrapper(void)
bool wifsignaled(int status)
nd deftypefn *std::string name
pid_t waitpid(pid_t pid, int *status, int options)
void octave_history_write_timestamp(void)
static octave_value_list mk_stat_result(const octave::sys::base_file_stat &fs)
static bool have_struct_stat_st_blocks(void)
int wexitstatus(int status)
static std::string get_host_name(void)
static bool have_struct_stat_st_rdev(void)
#define DEFUNX(name, fname, args_name, nargout_name, doc)
Macro to define a builtin function with certain internal name.
int octave_o_rdonly_wrapper(void)
int wcoredump(int status)
OCTAVE_EXPORT octave_value_list Fdup2(octave::interpreter &interp, const octave_value_list &args, int) ar
bool wifexited(int status)
With real return the complex result
int octave_o_async_wrapper(void)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
std::ofstream ofile(filename.c_str(), std::ios::out|std::ios::binary)
std::string message(void) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
int octave_o_nonblock_wrapper(void)
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol NaN(Not a Number). NaN is the result of operations which do not produce a well defined 0 result. Common operations which produce a NaN are arithmetic with infinity ex($\infty - \infty$)
int octave_o_trunc_wrapper(void)
void assign(const std::string &k, const octave_value &val)
bool wifcontinued(int status)
int execvp(const std::string &file, const string_vector &argv)
OCTAVE_EXPORT octave_value_list only variables visible in the local scope are displayed The following are valid options
octave_idx_type length(void) const
static bool ignoring_entries(void)
int octave_o_sync_wrapper(void)
int octave_o_wronly_wrapper(void)
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(), c_file_ptr_buf::close_fcn cf=c_file_ptr_buf::file_close)
int octave_o_rdwr_wrapper(void)
octave::sys::file_stat fs(filename)
std::string release(void) const
int octave_o_excl_wrapper(void)
pid_t fork(std::string &msg)
int get_file_number(const octave_value &fid) const
std::string machine(void) const
write the output to stdout if nargout is
nlink_t nlink(void) const
int octave_f_setfd_wrapper(void)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
static bool have_struct_stat_st_blksize(void)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
sys::time mtime(void) const
pid_t getpgrp(std::string &msg)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
int mkfifo(const std::string &nm, mode_t md)
pid_t popen2(const std::string &cmd, const string_vector &args, bool sync_mode, int *fildes)