[applying,to,mainline] abidw: Add a -o short option for --out-file

Message ID 87o7bo4oab.fsf@redhat.com
State New
Headers
Series [applying,to,mainline] abidw: Add a -o short option for --out-file |

Commit Message

Dodji Seketeli March 8, 2024, 5:38 p.m. UTC
  Hello,

This patch adds a shortcut -o shortcut option for the --out-file option
of abidw.

	* doc/manuals/abidw.rst: Document the -o option.
	* tools/abidw.cc (display_usage): Update doc string for the
	--out-file|-o option.
	(parse_command): Support the -o short option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 doc/manuals/abidw.rst | 2 +-
 tools/abidw.cc        | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/doc/manuals/abidw.rst b/doc/manuals/abidw.rst
index 1e308e66..13db912f 100644
--- a/doc/manuals/abidw.rst
+++ b/doc/manuals/abidw.rst
@@ -107,7 +107,7 @@  Options
     installed by your system's package manager because then
     ``abidw`` knows where to find it.
 
-  * ``--out-file`` <*file-path*>
+  * ``--out-file | -o`` <*file-path*>
 
     This option instructs ``abidw`` to emit the XML representation of
     *path-to-elf-file* into the file *file-path*, rather than emitting
diff --git a/tools/abidw.cc b/tools/abidw.cc
index c8a44dda..fe977b1d 100644
--- a/tools/abidw.cc
+++ b/tools/abidw.cc
@@ -208,7 +208,7 @@  display_usage(const string& prog_name, ostream& out)
     << "  --debug-info-dir|-d <dir-path>  look for debug info under 'dir-path'\n"
     << "  --headers-dir|--hd <path> the path to headers of the elf file\n"
     << "  --header-file|--hf <path> the path one header of the elf file\n"
-    << "  --out-file <file-path>  write the output to 'file-path'\n"
+    << "  --out-file|-o  <file-path>  write the output to 'file-path'\n"
     << "  --noout  do not emit anything after reading the binary\n"
     << "  --suppressions|--suppr <path> specify a suppression file\n"
     << "  --no-architecture  do not emit architecture info in the output\n"
@@ -331,7 +331,8 @@  parse_command_line(int argc, char* argv[], options& opts)
 	  opts.header_files.push_back(argv[j]);
 	  ++i;
 	}
-      else if (!strcmp(argv[i], "--out-file"))
+      else if (!strcmp(argv[i], "--out-file")
+	       || !strcmp(argv[i], "-o"))
 	{
 	  if (argc <= i + 1
 	      || argv[i + 1][0] == '-'