The parse_output_fields() function provides support for the style of command-line
processing used by dladm and flowadm. However, instead of sharing the code,
the 2 applications needlessly cut/paste the same code. They should instead
share this function via libinetutil (from where it can also be accessed by
other *adm commands for networking that are expected to show up in the future).
Also in the "needless" bucket, the cmdtype argument to parse_output_fields
is needless and should be dropped. 99% of the callers set this to
and the only non-CMD_TYPE_ANY caller is from /sbin/dladm for the show-wifi
and scan-wifi functions. The wifi calls try to be clever about setting up
a common print_field_t array for both show and scan commands, and use the
cmdtype argument as a bitmask to permit/disallow arguments with the -o option
(e.g., 'dladm scan-wifi -o auth' will result in an "unrecognized arg" error)
But the sharing of a common print_field_t can be achieved in a cleaner way
that does not need the confusing cmdtype arg. See Evaluation for details.