29 #include <sys/types.h>
54 m.
assign (
"uid", static_cast<double> (pw.
uid ()));
55 m.
assign (
"gid", static_cast<double> (pw.
gid ()));
68 DEFUN (getpwent, args, ,
70 @deftypefn {Built-in Function} {@var{pw_struct} =} getpwent ()\n\
71 Return a structure containing an entry from the password database,\n\
72 opening it if necessary.\n\
74 Once the end of the data has been reached, @code{getpwent} returns 0.\n\
75 @seealso{setpwent, endpwent}\n\
80 retval(1) = std::string ();
83 int nargin = args.
length ();
98 DEFUN (getpwuid, args, ,
100 @deftypefn {Built-in Function} {@var{pw_struct} =} getpwuid (@var{uid}).\n\
101 Return a structure containing the first entry from the password database\n\
102 with the user ID @var{uid}.\n\
104 If the user ID does not exist in the database, @code{getpwuid} returns 0.\n\
105 @seealso{getpwnam}\n\
110 retval(1) = std::string ();
113 int nargin = args.
length ();
117 double dval = args(0).double_value ();
121 if (
D_NINT (dval) == dval)
123 uid_t uid =
static_cast<uid_t
> (dval);
131 error (
"getpwuid: UID must be an integer");
140 DEFUN (getpwnam, args, ,
142 @deftypefn {Built-in Function} {@var{pw_struct} =} getpwnam (@var{name})\n\
143 Return a structure containing the first entry from the password database\n\
144 with the user name @var{name}.\n\
146 If the user name does not exist in the database, @code{getpwname} returns 0.\n\
147 @seealso{getpwuid}\n\
152 retval(1) = std::string ();
155 int nargin = args.
length ();
159 std::string s = args(0).string_value ();
175 DEFUN (setpwent, args, ,
177 @deftypefn {Built-in Function} {} setpwent ()\n\
178 Return the internal pointer to the beginning of the password database.\n\
179 @seealso{getpwent, endpwent}\n\
184 retval(1) = std::string ();
187 int nargin = args.
length ();
202 DEFUN (endpwent, args, ,
204 @deftypefn {Built-in Function} {} endpwent ()\n\
205 Close the password database.\n\
206 @seealso{getpwent, setpwent}\n\
211 retval(1) = std::string ();
214 int nargin = args.
length ();
std::string gecos(void) const
OCTINTERP_API void print_usage(void)
octave_idx_type length(void) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
static int setpwent(void)
std::string dir(void) const
static int endpwent(void)
std::string shell(void) const
OCTAVE_API double D_NINT(double x)
std::string name(void) const
static octave_value mk_pw_map(const octave_passwd &pw)
static octave_passwd getpwent(void)
void assign(const std::string &k, const octave_value &val)
std::string passwd(void) const
static octave_passwd getpwuid(uid_t uid)
static octave_passwd getpwnam(const std::string &nm)