1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <shadow.h> #include <string.h> #include <stdlib.h> struct spwd *getspnam(const char * name) { struct spwd *tmp; setspent(); for (;;) { tmp=getspent(); if (!tmp) return 0; if (!strcmp(tmp->sp_namp,name)) return tmp; } }