26 #if defined (HAVE_CONFIG_H)
32 #include <sys/types.h>
55 m.assign (
"name", pw.
name ());
56 m.assign (
"passwd", pw.
passwd ());
57 m.assign (
"uid",
static_cast<double> (pw.
uid ()));
58 m.assign (
"gid",
static_cast<double> (pw.
gid ()));
59 m.assign (
"gecos", pw.
gecos ());
60 m.assign (
"dir", pw.
dir ());
61 m.assign (
"shell", pw.
shell ());
69 DEFUN (getpwent, args, ,
79 if (args.length () != 0)
87 return ovl (val, msg);
90 DEFUN (getpwuid, args, ,
100 if (args.length () != 1)
103 double dval = args(0).double_value ();
106 error (
"getpwuid: UID must be an integer");
108 uid_t uid =
static_cast<uid_t
> (dval);
115 return ovl (val, msg);
118 DEFUN (getpwnam, args, ,
128 if (args.length () != 1)
131 std::string s = args(0).string_value ();
138 return ovl (val, msg);
141 DEFUN (setpwent, args, ,
148 if (args.length () != 0)
156 return ovl (
static_cast<double> (status), msg);
159 DEFUN (endpwent, args, ,
166 if (args.length () != 0)
174 return ovl (
static_cast<double> (status), msg);
std::string passwd(void) const
static int endpwent(void)
std::string gecos(void) const
static password getpwuid(uid_t uid)
std::string dir(void) const
static password getpwent(void)
std::string name(void) const
static int setpwent(void)
static password getpwnam(const std::string &nm)
std::string shell(void) const
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
static octave_value mk_pw_map(const octave::sys::password &pw)
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.