Adding %g and %() syntax

Adding a new flag that expands to the glob expansion match.
The main use case for this is if the command to run changes the basename
of the file:

    : foreach *_master.c |> foo %f |> %g_minor.out

This also adds a new syntax for flags: `%(<flagname>)`, ex: `%(f)`.
This is useful to allow for modifiers on a particular flag. For
instance, with the `%g` flag it can be useful to add an index.

    : foreach *_*.c |> foo %f |> %(g0)_%(g1)_new.out

The semantics change if foreach isn't used. In that case the glob
expansions are concatenated for the `%g` flag.

    a_text.txt b_text.txt c_text.txt
    : *_text.txt |> foo %f |> %g_binary.bin
    a_b_c_binary.bin

The separator can also be selected by using the 's' option to the `%g`
flag:

    : *_text.txt |> foo %f |> %(gs-)_binary.bin
    a-b-c_binary.bin

This commit also includes three tests for `%g` and an updated manpage
describing the flag.

I implemented it by adding on to the `basenamelen`, `basenametotlen`, etc.
infrastructure with an array that gets updated to the index and length
of each portion of the expanded filename. `tup_printf()` then uses this
array to substitute in for the `%g` flag.