users
This commit is contained in:
parent
573887adce
commit
3e202bc314
12
src/users.c
12
src/users.c
@ -0,0 +1,12 @@
|
||||
#include "users.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
|
||||
void list_users(FILE *output) {
|
||||
struct passwd *pw;
|
||||
while ((pw = getpwent()) != NULL) {
|
||||
fprintf(output, "%s: %s\n", pw->pw_name, pw->pw_dir);
|
||||
}
|
||||
endpwent();
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
#ifndef USERS_H
|
||||
#define USERS_H
|
||||
#include <stdio.h>
|
||||
void list_users(FILE *output);
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user