3 ms·
https://www.freebsd.org/cgi/man.cgi?getopt_long(3) https://www.freebsd.org/cgi/man.cgi?getopt_long(3) > HISTORY > The getopt_long() and getopt_long_only() fun
by account42 5y ago
https://www.freebsd.org/cgi/man.cgi?getopt_long(3) https://www.freebsd.org/cgi/man.cgi?getopt_long(3)
> HISTORY
> The getopt_long() and getopt_long_only() functions first appeared in the GNU libiberty library. The first BSD implementation of getopt_long() appeared in NetBSD 1.5, the first BSD implementation of getopt_long_only() in OpenBSD 3.3. FreeBSD first included getopt_long() in FreeBSD 5.0, getopt_long_only() in FreeBSD 5.2.
So the parsing support is there. And it is used, e.g. tar aka bsdtar:
https://www.freebsd.org/cgi/man.cgi?tar(1) https://www.freebsd.org/cgi/man.cgi?tar(1)
So long options were popularized by GNU but have since become common across different POSIX operating systems.
- anjbe 5y ago> So the parsing support is there. And it is used, e.g. tar Yes, the parsing support is there, so software written in the GNU style does build and run correctly on BSD systems. But although you bring up tar (a command that is well known for its unusual and unconventional flag handling), it is generally the case that commands on BSD operating systems do not use long options. Representative examples of prominent 21st century BSD software that do not use long options: mandoc: https://mandoc.bsd.lv/man/mandoc.1.html https://mandoc.bsd.lv/man/mandoc.1.html jail: https://www.freebsd.org/cgi/man.cgi?jail(8) https://www.freebsd.org/cgi/man.cgi?jail(8) zfs: https://www.freebsd.org/cgi/man.cgi?zfs(8) https://www.freebsd.org/cgi/man.cgi?zfs(8) acme-client: https://man.openbsd.org/acme-client.1 https://man.openbsd.org/acme-client.1 signify: https://man.openbsd.org/signify.1 https://man.openbsd.org/signify.1 doas: https://man.openbsd.org/doas.1 https://man.openbsd.org/doas.1 smtpd: https://man.openbsd.org/smtpd.8 https://man.openbsd.org/smtpd.8 And of course old classics like ssh: https://man.openbsd.org/ssh.1 https://man.openbsd.org/ssh.1 kazinator’s point, that there is no POSIX convention of using -h for help, is correct. That convention came from GNU, and while the idea has spread due to GNU’s influence, there are other prominent schools of thought in the POSIX or Unix‐like ecosystem. I would certainly not agree that long options are the common case on BSD systems.