Re: Calling BSD from Cocoa and/or CFM?
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 00:12:40 -0700
on 1/21/02 5:37 PM, James Montgomerie at email@hidden wrote:
>
This works for me...
>
>
#include <stdio.h>
>
#include <pwd.h>
>
>
int main (int argc, const char * argv[]) {
>
struct passwd *pwd;
>
do {
>
pwd = getpwent();
>
if(pwd && pwd->pw_name) {
>
printf("User: %s\n", pwd->pw_name);
>
}
>
} while(pwd);
>
return 0;
>
}
Wow! Thanx for the quick reply! I got it all working in PB and CW.
The CFM importing is trivial after looking at CallMachOFramework. I am
stuck on one last problem, which is how to search the frameworks for a
function ptr. The example says to load the bundle for "System.framework"
but evidently that's not where getpwent is stored. I was able to import a
bunch of other bsd commands, so I know it's almost working. The example
says to use "nm" from the command line to see which functions are in which
libraries, and I did get it to work for single libraries, but I really need
to search the whole frameworks folder for "getpwent". I even tried a trial
and error by adding IOKit.framework, and others (instead of
System.framework). I am looking for a solution other than changing
permissions to get sherlock to work. Oh, and man works now, I just had
never tried it after the dev tools install. Thank you for your time,
Zack Morris
Z Sculpt Entertainment
email@hidden
http://www.zsculpt.com