The wc command is often touted as the fastest way to count the number of lines in a file, https://unix.stackexchange.com/questions/504892/what-is-a-quick-way-to-count-lines-in-a-4tb-file
When I tried to look for the source code of wc.c that let uses do something like wc -l or wc -c, I've found the code from https://www.gnu.org/software/cflow/manual/html_node/Source-of-wc-command.html but
- Q (part a): Is this the actual source code for the wc command?
- Q (part b): Is there some mirror on github / gitlab / bitbucket for the code?
- Q (part c): If the
wc.cfile is different for different unix versions, how do file the source of thewc.c? When I triedwhich wc, it only points me to the binary.
Tracking a specific binary source for a specific distro:
find the binary:
find the package that provided the binary
Google the package with "src" to find the src package used to build specifically the package that you have.
In the above example its: http://vault.centos.org/8-stream/BaseOS/Source/SPackages/coreutils-8.30-13.el8.src.rpm
Download the src package and unpack it to reveal the actual source used to build wc in your distro
Compare it to the official wc.c in coreutil's github: https://github.com/coreutils/coreutils/tree/master/src