Page 165 of The C Programming Language, 1st ed. describes some of the workings of the UNIX stdio implementation. In particular, it describes the function of _ptr and _cnt. Section 8 of The C Programming Language, 2nd ed. provides more detail. In particular, page 176 publishes a stdio.h, likely derived from some UNIX version.