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: Bernhard Voelker
Subject: Re: Invoke a Coreutils routine from another 'main' program
Date: Tue, 21 Jul 2015 23:41:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 07/21/2015 10:17 PM, Zhoulai wrote:
> /for each i of InputSet
> /
> /       echo.main(i);
> /
> /l0:    // do something to store the execution trace  of echo.main
> /
> /end for
> /
> /l1:   //analyze and report the bugs/

I don't think the programs are written to work repeatedly in such a way.
Just think of static variables, not freed resources (partly #if-lint'ed),
etc.  It may work for simpler tools like echo.c, but I'd be surprised
if more than 10 of the tools could be called like that; not to talk about
tools like mv(1) which make changes to the file system which are not
repeatable.

> Also, I just skimmed two of your source code, /echo.c,/ and /base64.c/ from 
> CoreUtil8.23, but  do not find the lines
> that triggers termination of the whole process. Would you show me the 
> relevant code lines ?

A rough search:

  $ grep -n '[^a-z]error (' src/{echo,base64}.c
  src/base64.c:111:        error (EXIT_FAILURE, errno, _("write error"));
  src/base64.c:123:              error (EXIT_FAILURE, errno, _("write error"));
  src/base64.c:129:              error (EXIT_FAILURE, errno, _("write error"));
  src/base64.c:170:    error (EXIT_FAILURE, errno, _("write error"));
  src/base64.c:173:    error (EXIT_FAILURE, errno, _("read error"));
  src/base64.c:210:            error (EXIT_FAILURE, errno, _("read error"));
  src/base64.c:226:            error (EXIT_FAILURE, errno, _("write error"));
  src/base64.c:229:            error (EXIT_FAILURE, 0, _("invalid input"));
  src/base64.c:266:          error (EXIT_FAILURE, 0, _("invalid wrap size: %s"),
  src/base64.c:285:      error (0, 0, _("extra operand %s"), quote 
(argv[optind]));
  src/base64.c:304:        error (EXIT_FAILURE, errno, "%s", infile);
  src/base64.c:317:        error (EXIT_FAILURE, errno, _("closing standard 
input"));
  src/base64.c:319:        error (EXIT_FAILURE, errno, "%s", infile);

Have a nice day,
Berny



reply via email to

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