• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calling BSD from Cocoa and/or CFM?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling BSD from Cocoa and/or CFM?


  • Subject: Re: Calling BSD from Cocoa and/or CFM?
  • From: Zack Morris <email@hidden>
  • Date: Wed, 23 Jan 2002 13:53:02 -0700

on 1/23/02 1:32 PM, Rainer Brockerhoff at email@hidden wrote:

> I found the System.framework to be incomplete. In Project Builder, what I
> eventually hit on was to:
> 1) In my target, Build Settings -> Search Paths -> Headers I included
> "/usr/include"
> 2) In my source files, I put:
> #include </usr/include/pwd.h>
> and so forth, wherever appropriate.
> This will make all the UNIX headers searchable...

This sounds like an important thing to remember. Also, geeezzzz, sorry
guys, I found out the answer to my problem. I was trying to look up
getpwent which apparently is not in the system framework (same problem??).
I ended up using getpassent( 0 ) which is the same thing. The code was
bombing on that and never actually getting to getpwent. This is a classic
example of how the answer is always 2 steps farther ahead than what you can
conceive of in the moment. Here is my final code, thank you for all of your
help!

Boolean IsUser( char *name, Boolean useShortName )
{
struct passwd *pwd;
OSErr err;
Boolean result = false;

if( (err = InitBSD()) != noErr ) // load bundle and lookup functions
ErrorDialog( "\pUnable to access unix password routines.", err );
if( !setpassent( 0 ) ) // same as setpwent()
ErrorDialog( "\pUnable to access the user list." );

do
{
if( (pwd = getpwent()) != nil )
if( strcmp( name,
useShortName ? pwd->pw_name : pwd->pw_gecos ) == 0 )
{
result = true;
break;
}
}
while( pwd );

endpwent(); // keep list current

return( result );
}

Zack Morris
Z Sculpt Entertainment
email@hidden
http://www.zsculpt.com


References: 
 >Re: Calling BSD from Cocoa and/or CFM? (From: Rainer Brockerhoff <email@hidden>)

  • Prev by Date: Re: Calling BSD from Cocoa and/or CFM?
  • Next by Date: Re: removing selection-highlight from NSTableView
  • Previous by thread: Re: Calling BSD from Cocoa and/or CFM?
  • Next by thread: SplitView probbs, hmm...
  • Index(es):
    • Date
    • Thread