coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] basename/dirname can't handle stdin?


From: Jeff Blaine
Subject: Re: [coreutils] basename/dirname can't handle stdin?
Date: Thu, 13 Jan 2011 09:20:41 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 1/13/2011 2:53 AM, Jim Meyering wrote:
Jeff Blaine wrote:
Eric, now that I've got the prereqs in place,
built coreutils from git successfully, and read the
coreutils HACKING file, let's make sure I am on your
page:

In no order:

* Snarf getopt_long arg processing from wc.c or other
   you mentioned

getopt_long?  There will be some of that (for the new options),
but most of the new code will be to process stdin, and you can
use code nearly identical to what wc uses:

   int i;
   ok = true;
   for (i = 0; /* */; i++)
     {
       bool skip_file = false;
       enum argv_iter_err ai_err;
       char *file_name = argv_iter (ai,&ai_err);
       ...

Yup, already copied and reusing it.

The preceding set-up code can be mostly-reused, too,

   bool read_tokens = false;
   struct argv_iterator *ai;
   if (files_from)
     {

with the exception that the "else"-block that sets up
to get names from argv.  I.e., while wc, du, sort can take
many arguments from argv, basename cannot.

Yup, already copied and reusing it.

* Add --filter (combined with the lack of file args) to handle
   processing of stdin
* Add --files-from0 per wc.c code (found it there)

it's --files0-from

Yes, sorry.

* Add --suffix [suffix] to enable suffix killing (using
   SUFFIX as the 2nd arg will no longer work going forward)
* Update usage() obviously

Correct?  Anything else?

   * Update NEWS to mention the new functionality.
   * Update doc/coreutils.texi
   * add tests to exercise the new behavior (as I mentioned earlier)

That goes without saying as it's in the HACKING file :)

This query to the list was to make sure we agreed on the
scope of what I was adding/changing.



reply via email to

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