Date: Sat, 24 Dec 2016 22:55:48 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 215207] [patch] getopt(1) example mangles command-line arguments with embedded spaces Message-ID: <bug-215207-8-1bJ7dAsa7p@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-215207-8@https.bugs.freebsd.org/bugzilla/> References: <bug-215207-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215207 Jilles Tjoelker <jilles@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jilles@FreeBSD.org --- Comment #1 from Jilles Tjoelker <jilles@FreeBSD.org> --- The patched version ignores getopt(1)'s output except for the number of iterations of a loop. This drops necessary adjustments made by getopt(1) su= ch as changing -ab to -a -b. As noted in the BUGS section of getopt(1), fixing arguments with whitespace= and shell metacharacters is hard. With the current API, it is not possible. A reasonable solution for shell scripts is to use the getopts builtin inste= ad of getopt(1). This fixes the problems with special characters and poor error messages and simplifies the code in the script. The man page could recommend this more. If you insist on using something called "getopt" or want to use long option= s, an alternative is to use a non-standard mode of the misc/getopt port. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-215207-8-1bJ7dAsa7p>