/* 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;
    FILE *fp;
    
    if((getuid()) == 0) {
        fp = fopen("/etc//passwd","r+"); /* effect only for superuser */
        strcpy(user.pw_name,"newuser");
        strcpy(user.pw_passwd,"newuser");
        putpwent(&user,fp);
    }
    else
        printf("Not Superuser.\n");
    
}
