Adding %g 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

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.