pwd

Safe interface to pwd.h


Keywords
ffi, linux, unix, pwd, passwd
License
CC-PDDC

Documentation

pwd module for unix-y systems

crates.io
dependency status

This is a small veneer over pwd.h, mostly just hides away the unsafe parts.

Installation

In the [dependencies] section of your Cargo.toml, add the following line:

[dependencies]
pwd = "1"

Usage

In your crate root, add:

extern crate pwd;

Example

extern crate pwd;

use pwd::Passwd;

fn main() {
    let me = Passwd::current_user();
    println!("my username is {}, home directory is {}, and my shell is {}. My uid/gid are {}/{}",
             me.name, me.dir, me.shell, me.uid, me.gid);
}