posix :: Passwd :: defaultinit
# Information on a user account
extern class Passwd `{struct passwd*`}
# Get the `Passwd` of the user with the `uid`
new from_uid(uid: Int) `{ return getpwuid(uid); `}
# Get the `Passwd` of the user with the `name`
new from_name(name: String) import String.to_cstring `{ return getpwnam( String_to_cstring(name) ); `}
# Username
fun name: String import CString.to_s `{ return CString_to_s(self->pw_name); `}
# User password
fun passwd: String import CString.to_s `{ return CString_to_s(self->pw_passwd); `}
# User ID
fun uid: Int `{ return self->pw_uid; `}
# Group ID
fun gid: Int `{ return self->pw_gid; `}
# Home directory
fun dir: String import CString.to_s `{ return CString_to_s(self->pw_dir); `}
# Shell program
fun shell: String import CString.to_s `{ return CString_to_s(self->pw_shell); `}
end
lib/posix/posix.nit:51,1--76,3