3 ms·
I checked the man pages and git history! The Linux man-pages project[1] tends to do a pretty good job of telling you when different libcs got a given function,
by LukeShu 6y ago
I checked the man pages and git history!
The Linux man-pages project[1] tends to do a pretty good job of telling you when different libcs got a given function, or compatibility concerns between different libcs. BSD man pages tend to just tell you where they copied their implementation from. But unfortunately the Linux man-pages getline(3) page only told me that "Both getline() and getdelim() were originally GNU extensions. They were standardized in POSIX.1-2008.". (I guess that saved me from searching my POSIX PDFs to determine the POSIX version. While I was a student and could legally aquire such things for free I hunted down every version of POSIX or SUS prior to 2016).
I checked the GNU libc git[2] to determine when GNU first got the function, but didn't quite get a clear answer, becuase much of the history prior to 1994 was mangled in the conversion from whatever they were using before to RCS (which they used before they converted to CVS, which they used before they converted to git). I didn't bother checking the GNU manual; it doesn't tend to do a good job of saying when things were introduced.
Next I checked macOS; the macOS 10.15 (Catalina) getline(3) man page confirmed that it appeared in POSIX.1-2008, and also told me that "These routines first appeared in FreeBSD 8.0" ("these routines" referring to their specific implementation of those routines.). I checked through opensource.apple.com archives[3] (actually, I used an import of those archives in to git[4]) to determine which version of macOS they first appeared in.
I checked the FreeBSD man page archive[5] to confirm that they first appeared in 8.0 (a getline(3) man page exists in 8.0 but not 7.4).
I checked the OpenBSD man page archive[6] next. In recent versions the "HISTORY" section says "These functions were ported from NetBSD to OpenBSD 5.2.", though that section doesn't exist in the 5.2 version of the man page. And I confirmed that no such man page exists in 5.1.
Finally, I checked the NetBSD man page archive[7], and bisected through the versions to determine when it was introduced.
I used Wikipedia to determine the release year for each of those versions.
[1]: https://www.kernel.org/doc/man-pages/ https://www.kernel.org/doc/man-pages/
[2]: git://sourceware.org/git/glibc.git
[3]: https://opensource.apple.com/ https://opensource.apple.com/
[4]: https://github.com/apple-open-source/macos https://github.com/apple-open-source/macos
[5]: https://www.freebsd.org/cgi/man.cgi https://www.freebsd.org/cgi/man.cgi
[6]: https://man.openbsd.org/ https://man.openbsd.org/
[7]: https://man.netbsd.org/ https://man.netbsd.org/