Xref: utzoo comp.unix.programmer:690 comp.unix.questions:27561 comp.unix.internals:1448 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!uw-beaver!zephyr.ens.tek.com!tektronix!sequent!crg5!crg8.sequent.com!krader From: krader@crg8.sequent.com (Kurtis D. Rader) Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.internals Subject: Re: What do I do wrong? Message-ID: <20723@crg5.UUCP> Date: 13 Dec 90 19:36:14 GMT References: <1990Dec13.023035.19793@IRO.UMontreal.CA> Sender: root@crg5.UUCP Reply-To: krader@crg8.UUCP (Kurtis D. Rader) Organization: Sequent Computer Systems, Inc Lines: 42 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 %#include % %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