ctdb-tests: Avoid use of non-portable getopt in stubs
authorMartin Schwenke <martin@meltin.net>
Sun, 1 Jul 2018 09:58:02 +0000 (19:58 +1000)
committerMartin Schwenke <martins@samba.org>
Sat, 28 Jul 2018 01:50:10 +0000 (03:50 +0200)
commit896c77df1ce2645c6dd7898b59ea802e204dc7d9
tree7bc968a458bae48fe38bb2ee044748dff931cddc
parent56ffca3e79923a028ff96fbd50706d808b9dd215
ctdb-tests: Avoid use of non-portable getopt in stubs

getopt is being used with non-portable options.  In most cases use
simpler, POSIX-compliant getopts instead.

In the case of the ctdb test stub command, options can appear after
other arguments, so this requires an additional nested loop.

In the case of smnotify, there are no short options, so handle the
long options manually.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/eventscripts/stubs/ctdb
ctdb/tests/eventscripts/stubs/rpcinfo
ctdb/tests/eventscripts/stubs/smnotify
ctdb/tests/eventscripts/stubs/ss