Operating System - HP-UX
1833776 Members
2334 Online
110063 Solutions
New Discussion

Reading passwd structures from a file other then /etc/passwd

 
Stefan Rahm
Occasional Contributor

Reading passwd structures from a file other then /etc/passwd

I am writing a program that will read passwd structs, but I do not wish to play with /etc/passwd just yet for obvious reasons. So how do I "redirect" getpwent() to read from my "safe" copy?
2 REPLIES 2
Vincenzo Restuccia
Honored Contributor

Re: Reading passwd structures from a file other then /etc/passwd

cp -p /etc/passwd /etc/passwd.old,
ln -s /etc/passwd /path/newfile.
Stefan Rahm
Occasional Contributor

Re: Reading passwd structures from a file other then /etc/passwd

I already have a copy of the file. I've been looking for something like the utmpname() function, but fgetpwent() doesn't quite seem to do it.