26 #if defined (HAVE_CONFIG_H)
32 #include <sys/types.h>
49 mk_gr_map (
const sys::group& gr)
55 m.assign (
"name", gr.name ());
56 m.assign (
"passwd", gr.passwd ());
57 m.assign (
"gid",
static_cast<double> (gr.gid ()));
66 DEFUN (getgrent, args, ,
75 if (args.length () != 0)
81 octave_value val = mk_gr_map (sys::group::getgrent (msg));
83 return ovl (val, msg);
86 DEFUN (getgrgid, args, ,
96 if (args.length () != 1)
99 double dval = args(0).double_value ();
102 error (
"getgrgid: GID must be an integer");
104 gid_t gid =
static_cast<gid_t
> (dval);
109 octave_value val = mk_gr_map (sys::group::getgrgid (gid, msg));
111 return ovl (val, msg);
114 DEFUN (getgrnam, args, ,
124 if (args.length () != 1)
127 std::string s = args(0).string_value ();
132 octave_value val = mk_gr_map (sys::group::getgrnam (s.c_str (), msg));
134 return ovl (val, msg);
137 DEFUN (setgrent, args, ,
144 if (args.length () != 0)
150 int status = sys::group::setgrent (msg);
152 return ovl (
static_cast<double> (status), msg);
155 DEFUN (endgrent, args, ,
162 if (args.length () != 0)
168 int status = sys::group::endgrent (msg);
170 return ovl (
static_cast<double> (status), msg);
173 OCTAVE_END_NAMESPACE(
octave)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void() error(const char *fmt,...)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.