News for hackers. Stuff that matters.
Re:Following the Unix philosophy without getting left-pad by kazinator on Thursday November 10, 2022 @03:00PM (#33552320)
Each one-job Unix program has to do about four things:

1. parse command line arguments

2. parse an input format

3. do its one job

4. format output

Two or three out of these are superfluous and could be shared with a larger program if it were just a function in it.

For instance, regarding (1) if the program just has a "dry run -n" and "verbose debugging -v" flag, and it becomes a function in the larger program which already has those flags, all the function has to do is refer to the configuration.

Regarding (2), the function probably has access to some data structure constructed by the larger program rather than raw text.

Regarding (4), the function may be able to put out a data structure for whose type the larger program already has an output format.

Unix itself showed that the one-program-for-one-task is a weak idea when Awk was developed: a programmable utility that allows a single program running in one process to avoid using numerous Unix tools.

Re:Following the Unix philosophy without getting left-pad by bombolo on Thursday November 10, 2022 @07:19PM (#33555695)
> Two or three out of these are superfluous and could be shared with a larger program if it were just a function in it.

They don't "parse" command line. They use getopt/getopt_long, which does the parsing. Besides using library functions, GNU coreutils commands do share code.