tshark: Deprecate -G with no argument

We've been planning on removing -G with no argument for
18 years (2f7fd680e2); start
warning users that it is deprecated.

Single letter options with optional arguments are tricky and
deprecated, see Guideline 12 of the POSIX Utility Syntax Guidelines.
( https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html )
We have special handling for -G as a result which forces it to the
first argument. -G with no argument can't be mixed with other options,
unlike the other reports. Removing this would allow relaxation of that
restriction.

Related to #17924
This commit is contained in:
John Thacker 2023-12-22 00:01:00 -05:00 committed by AndersBroman
parent 685ea4f15d
commit 0fc2359812
3 changed files with 10 additions and 4 deletions

View File

@ -114,7 +114,10 @@ The following features are new (or have been significantly updated) since versio
* The binary plugins folder path no longer uses an X.Y version component. Plugins
are required to add the ABI version to the file name.
//=== Removed Features and Support
=== Removed Features and Support
* The tshark `-G` option with no argument is deprecated and will be removed in
a future version. Use `tshark -G fields` to produce the same report.
// === Removed Dissectors

View File

@ -413,7 +413,8 @@ user's group).
--
The *-G* option will cause *TShark* to dump one of several types of glossaries
and then exit. If no glossary type is specified, then the *fields* report
will be generated by default. The *-G* option must be the first option given.
will be generated by default; this is deprecated and a future version will
require the report type argument. The *-G* option must be the first option given.
Using the report type of *help* lists all the current report types.
The available report types include:

View File

@ -1262,9 +1262,11 @@ main(int argc, char *argv[])
if (argc >= 2 && strcmp(argv[1], "-G") == 0) {
proto_initialize_all_prefixes();
if (argc == 2)
if (argc == 2) {
cmdarg_err("-G with no argument is deprecated and will removed in a future version.");
cmdarg_err_cont("Generating fields glossary.");
proto_registrar_dump_fields();
else {
} else {
if (strcmp(argv[2], "column-formats") == 0)
column_dump_column_formats();
else if (strcmp(argv[2], "currentprefs") == 0) {