Re: Executing A Shell Script...
Re: Executing A Shell Script...
- Subject: Re: Executing A Shell Script...
- From: Chris Ridd <email@hidden>
- Date: Fri, 30 Aug 2002 17:17:48 +0100
On 30/8/02 4:27 pm, ber <email@hidden> wrote:
>
When do you use obj-c interfaces like NSTask/NSString methods and when
>
do you use plain old Unix interfaces
>
like popen("") and strcpy? Is there room for choosing when to use
>
which or would the cocoa programming
>
philosophy dictate always going through the obj-c methods?
>
>
I now use variable names like bufferLenth instead of buflen because I'm
>
sure that helps me to be a better
>
obj-c programmer. Should I avoid using libc and section 2 of the
>
manual when a foundation method is available?
>
>
For instance, I would have told the original poster about popen(3) but
>
I don't want to lead people down the wrong
>
path so I generally keep my mouth shut.
Popen()'s about as risky as system() because it invokes a shell, so you've
got the potential for misparsing arguments again.
It's a good question though. I'd say look at Foundation first and if nothing
seems to be useful, go for the (POSIX) standard library. If you're going the
POSIX route, read up on secure Unix programming techniques first. Hope that
Apple have done a good secure job inside Foundation...
Here's a secure Unix programming FAQ that Google found for me:
<
http://www.whitefang.com/sup/>
There's probably others.
>
brian redman
>
>
PS - need to close that '"' in the arg to mkdir?
Oops. Not my code :-)
>
On Friday, August 30, 2002, at 11:08 AM, Chris Ridd wrote:
>
>
> Andrew Pinski <email@hidden> wrote:
>
>> I do:
>
>> mkdir("dir/To/Make);
>
>>
>
>> Look at mkdir(2)
>
>>
>
>> one step and no need to launch a separate process and is safer because
>
>> you can see what the problem is by the return value.
>
>
>
> Absolutely and it is clearly much cheaper to run as well, but I
>
> thought the
>
> original poster was trying to do something more general.
>
>
>
> Cheers,
>
>
>
> Chris
Cheers,
Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.