tchrist@convex.COM (Tom Christiansen) (12/14/90)
In article <1990Dec13.023035.19793@IRO.UMontreal.CA> quennevi@IRO.UMontreal.CA (Charles Quenneville) writes:
:Hello!
:Could you tell me what is wrong with this program? All I'm trying to do
:is simply to print the username.
You didn't lint it. I'll leave the flames to someone else.
--tom
--
Tom Christiansen tchrist@convex.com convex!tchrist
"With a kernel dive, all things are possible, but it sure makes it hard
to look at yourself in the mirror the next morning." -me
krader@crg8.sequent.com (Kurtis D. Rader) (12/14/90)
In article <1990Dec13.023035.19793@IRO.UMontreal.CA> quennevi@IRO.UMontreal.CA (Charles Quenneville) writes:
%Could you tell me what is wrong with this program? All I'm trying to do
%is simply to print the username.
%
%#include <pwd.h>
%#include <stdio.h>
%
%main ()
% {
% struct passwd *pwd;
% struct passwd *getpwent();
Doesn't pwd.h include a declaration for getpwent(3)?
%
% setpwent("/etc/passwd");
At least in BSD 4.2 setpwent(3) doesn't take any arguments, so this
should be
setpwent();
% while ((pwd = getpwent()) != 0)
% {
% printf("\n", pwd->pw_name);
Try
printf ("%s\n", pwd->pw_name);
% fflush(stdout);
% }
% endpwent("/etc/passwd");
Likewise, endpwent(3) doesn't take any arguments either.
% }
--
Kurtis D. Rader, Technical Support Engineer voice: 503/578-3714
Service Hotline, Sequent Computer Systems fax: 503/578-3731
15450 SW Koll Parkway, M/S UMP2-502 UUCP: ...uunet!sequent!krader
Beaverton, OR 97006-6063 internet: krader@sequent.com