aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2014-10-13 13:26:21 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2014-10-13 18:48:35 +0000
commit9ce5ca581d30074c2c02eca0f51dbe840bf9411b (patch)
treec97575dbfbffcd9105deff08d2fc892925bfcfc9
parent631834ff51ff7ac361352e9109befccffa738d80 (diff)
extcap: Catch unknown arguments to fix spaces
- If boolflags are being used, an extra space is added to the call of the extcap filter. This leads to the argumentparser of python to exit with an error-code, and the extcap filter will not start. This patch instead catches the unknown arguments and prints them on stdout, as well as running the dissection with the rest of the arguments list. Basically this is a work-around, for a behaviour not yet fixed in extcap, but it stabilizes the usage of the demo Change-Id: I7589292692b0b3c839909fd09d62a4714cbe869e Reviewed-on: https://code.wireshark.org/review/4638 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Tomasz Moń <desowin@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rwxr-xr-xdoc/extcap_example.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/extcap_example.py b/doc/extcap_example.py
index f920bd7618..dcd7ebbd41 100755
--- a/doc/extcap_example.py
+++ b/doc/extcap_example.py
@@ -236,7 +236,7 @@ if __name__ == '__main__':
parser.add_argument("--remote", help="Demonstrates a selector choice", default="if1", choices=["if1", "if2"] )
parser.add_argument("--message", help="Demonstrates string variable", nargs='?', default="" )
- args = parser.parse_args()
+ args, unknown = parser.parse_known_args()
if ( len(sys.argv) <= 1 ):
parser.exit("No arguments given!")
@@ -247,6 +247,9 @@ if __name__ == '__main__':
extcap_interfaces()
sys.exit(0)
+ if ( len(unknown) > 1 ):
+ print("Extcap Example %d unknown arguments given" % len(unknown) )
+
m = re.match ( 'example(\d+)', args.extcap_interface )
if not m:
sys.exit(ERROR_INTERFACE)