/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that prints all the username */
#include <stdio.h>
#include <pwd.h>

int main() {
    struct passwd *user;
    
    while((user = getpwent()) != NULL) {
      printf(" the user name is '%s' \n",user->pw_name);
    } 
    setpwent();  // rewind  the file to reread the group
    user = getpwent();
    printf(" the first user name is '%s' \n",user->pw_name);
    endpwent();
}
