PROPHET/OS
NAME
longest: writes the length of the longest line that comes through in
SYNOPSIS
longest [-f] [-z] longest selbsttest
DESCRIPTION
Writes the length of the longest line that comes through in.
With -f it measures the last field of a line instead, so what stands behind the last blank. With -z the line itself follows the length.
Written is the length and not the line, because that is what the caller computes with. It exists because the build asks this four times, every time as awk '{print length}' | sort -rn | head -1, and that is the whole use of awk in this build (R10-SELF-06).
longest selbsttest drives seven cases, without a keyboard: the length of a line, the length of its last field, the line without a field separator and the line that ends with one. A filter has to be checkable this way, because a filter without input waits for input (R11-BEREICH-02).
EXAMPLE
$ longest --help longest [-f] [-z] writes the length of the longest line from in -f the length of its last field instead -z writes the line itself behind the length selbsttest drives its own seven cases