misc/getopt - The NetBSD Packages Collection

Program to help shell scripts parse command-line parameters

Getopt(1) is a program to help shell scripts parse command-line
parameters. It is for example included in the util-linux distribution
(versions up to 2.7.1) for Linux. But, there were some problems
with that getopt(1) implementation, as listed in the 'BUGS' section
of its man-page:
     * Whatever getopt(3) has.
     * Arguments containing white space or imbedded shell metacharacters
       generally will not survive intact; this looks easy to fix but
       isn't.
     * The error message for an invalid option is identified as
       coming from getopt rather than from the shell procedure
       containing the invocation of getopt; this again is hard to
       fix.
     * The precise best way to use the set command to set the
       arguments without disrupting the value(s) of shell options
       varies from one shell version to another.
Additionally, the example in the manual-page does not run correctly
(at least not with any bash shell I have tried).

This implementation of getopt(1) solves some of these problems,
while still staying (for all practical purposes) completely compatible
with other getopt(1) implementations. It has replaced the old
util-linux version, but it should be useful for other Unixes too.

Build dependencies

pkgtools/mktools devel/gmake pkgtools/cwrappers

Runtime dependencies

(none)

Binary packages

OSArchitectureVersion
NetBSD 10.0aarch64getopt-1.1.6.tgz
NetBSD 10.0aarch64getopt-1.1.6.tgz
NetBSD 10.0aarch64ebgetopt-1.1.6.tgz
NetBSD 10.0aarch64ebgetopt-1.1.6.tgz
NetBSD 10.0alphagetopt-1.1.6.tgz
NetBSD 10.0alphagetopt-1.1.6.tgz
NetBSD 10.0earmv4getopt-1.1.6.tgz
NetBSD 10.0earmv4getopt-1.1.6.tgz
NetBSD 10.0earmv6hfgetopt-1.1.6.tgz
NetBSD 10.0earmv6hfgetopt-1.1.6.tgz
NetBSD 10.0earmv6hfgetopt-1.1.6.tgz
NetBSD 10.0earmv7hfgetopt-1.1.6.tgz
NetBSD 10.0earmv7hfgetopt-1.1.6.tgz
NetBSD 10.0earmv7hfgetopt-1.1.6.tgz
NetBSD 10.0i386getopt-1.1.6.tgz
NetBSD 10.0i386getopt-1.1.6.tgz
NetBSD 10.0m68kgetopt-1.1.6.tgz
NetBSD 10.0m68kgetopt-1.1.6.tgz
NetBSD 10.0m68kgetopt-1.1.6.tgz
NetBSD 10.0m68kgetopt-1.1.6.tgz
NetBSD 10.0mips64ebgetopt-1.1.6.tgz
NetBSD 10.0mips64ebgetopt-1.1.6.tgz
NetBSD 10.0powerpcgetopt-1.1.6.tgz
NetBSD 10.0powerpcgetopt-1.1.6.tgz
NetBSD 10.0powerpcgetopt-1.1.6.tgz
NetBSD 10.0sh3elgetopt-1.1.6.tgz
NetBSD 10.0sh3elgetopt-1.1.6.tgz
NetBSD 10.0sparc64getopt-1.1.6.tgz
NetBSD 10.0sparc64getopt-1.1.6.tgz
NetBSD 10.0sparcgetopt-1.1.6.tgz
NetBSD 10.0sparcgetopt-1.1.6.tgz
NetBSD 10.0vaxgetopt-1.1.6.tgz
NetBSD 10.0vaxgetopt-1.1.6.tgz
NetBSD 10.0vaxgetopt-1.1.6.tgz
NetBSD 10.0x86_64getopt-1.1.6.tgz
NetBSD 10.0x86_64getopt-1.1.6.tgz
NetBSD 9.0aarch64getopt-1.1.6.tgz
NetBSD 9.0aarch64getopt-1.1.6.tgz
NetBSD 9.0alphagetopt-1.1.6.tgz
NetBSD 9.0alphagetopt-1.1.6.tgz
NetBSD 9.0earmv4getopt-1.1.6.tgz
NetBSD 9.0earmv4getopt-1.1.6.tgz
NetBSD 9.0earmv4getopt-1.1.6.tgz
NetBSD 9.0earmv6hfgetopt-1.1.6.tgz
NetBSD 9.0earmv6hfgetopt-1.1.6.tgz
NetBSD 9.0earmv6hfgetopt-1.1.6.tgz
NetBSD 9.0earmv7hfgetopt-1.1.6.tgz
NetBSD 9.0earmv7hfgetopt-1.1.6.tgz
NetBSD 9.0earmv7hfgetopt-1.1.6.tgz
NetBSD 9.0i386getopt-1.1.6.tgz
NetBSD 9.0i386getopt-1.1.6.tgz
NetBSD 9.0m68kgetopt-1.1.6.tgz
NetBSD 9.0m68kgetopt-1.1.6.tgz
NetBSD 9.0m68kgetopt-1.1.6.tgz
NetBSD 9.0m68kgetopt-1.1.6.tgz
NetBSD 9.0powerpcgetopt-1.1.6.tgz
NetBSD 9.0powerpcgetopt-1.1.6.tgz
NetBSD 9.0powerpcgetopt-1.1.6.tgz
NetBSD 9.0sparc64getopt-1.1.6.tgz
NetBSD 9.0sparc64getopt-1.1.6.tgz
NetBSD 9.0x86_64getopt-1.1.6.tgz
NetBSD 9.0x86_64getopt-1.1.6.tgz
NetBSD 9.3x86_64getopt-1.1.6.tgz

Binary packages can be installed with the high-level tool pkgin (which can be installed with pkg_add) or pkg_add(1) (installed by default). The NetBSD packages collection is also designed to permit easy installation from source.

Available build options

(none)

Known vulnerabilities

The pkg_admin audit command locates any installed package which has been mentioned in security advisories as having vulnerabilities.

Please note the vulnerabilities database might not be fully accurate, and not every bug is exploitable with every configuration.


Problem reports, updates or suggestions for this package should be reported with send-pr.