coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invoke a Coreutils routine from another 'main' program


From: Eric Blake
Subject: Re: Invoke a Coreutils routine from another 'main' program
Date: Mon, 20 Jul 2015 09:28:11 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 07/20/2015 09:19 AM, Assaf Gordon wrote:
> 
> However, it's important to remember that coreutils' programs as not
> designed to be
> incorporated into bigger programs. One issue is that all the programs
> terminate
> on any errors - if there was an error in the parameters (or during
> runtime),
> the called function  (e.g. your "echo.main()") will not return to your
> 'main' with an error code - it will terminate your program.
> 
> Alternatively,
> since coreutils is GPL'd, it might be simpler to just reuse to code in
> your project instead of trying to force the programs to work the way you
> want (assuming your project is also GPL'd).

Or use fork()/exec() (or system() or popen() or posix_spawn()...) to
call the coreutils program externally from within your program, rather
than trying to code things directly into your executable.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]