Post #2135315
2026-05-06 23:02 UTC
@lindsey @dougmerritt @dan @regehr FILE and the associated buffered I/O methods were introduced in V7. Before then, you’d restate the buffer struct definition instead of including a header, often naming only the fields you use. Here’s an example from diff in V5:
struct buf {
int fdes;
char data[516];
} *buf1, *buf2;
The buffer is actually only 512 bytes; the other 4 bytes that are lumped in are fields they don’t use here.
https://github.com/dspinellis/unix-history-repo/blob/Research-V5/usr/source/s1/diff1.c#L66
Replies (1)
-
@dougmerritt@mathstodon.xyz 2026-05-07 01:10
@thalia Thanks. Apparently diff did not use the thing I was referring to, which was the a Mike Lesk library that was the immediate ancestor of stdio: M. E. Lesk, ‘A Portable I/O Package,’ AT&T Bell Laboratories internal memorandum ca. 1973. I see one reference to it here: https://retrocomputing.stackexchange.com/questions/25471/where-is-mike-lesks-circa-1973-portable-i-o-package-for-c I remember that v7 forced me to rewrite some of my C code to switch from that to stdio, and that at the time I was irritated at the task, and it took me a bit to see the advantages. :) @lindsey @dan @regehr