]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
rs: Use getopt() and strtol() instead of mannual parsing.
authorJohn Baldwin <jhb@FreeBSD.org>
Wed, 16 Nov 2022 05:19:35 +0000 (21:19 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Wed, 16 Nov 2022 05:19:35 +0000 (21:19 -0800)
commitafb4998dd4de03c2d635faf7db89f3d3f6c3a6ff
tree6157bea54055410068203bb952846b0ceef4edd8
parent838a061417300678f8604abb9fc6ade8d1bf61b8
rs: Use getopt() and strtol() instead of mannual parsing.

This uses the "::" extension to getopt() to handle options which take
an optional argument.

The updated flag tests were all wrong before and only passed because
the manual parser failed to raise errors when a required argument was
missing.  The invalid argument test now gets a better error message.

Reviewed by: brooks, imp, emaste
Differential Revision: https://reviews.freebsd.org/D36834
usr.bin/rs/rs.cc
usr.bin/rs/tests/rs_test.sh