PS:
+ tempbuf = (char *) realloc (tempbuf, tempbufsize);
the cast is redundant - realloc returns (void *).
Yeah, well, call it a personal quirk, call it an act of rebellion.
But when I see an ISO standard that tells me I don't need this conversion
by saying that
"A pointer to void shall have the same representation and
alignment requirements as a pointer to a character type."
and then tells me IN A FOOTNOTE that
"The same representation and alignment requirements are meant to
imply interchangeability as arguments to functions, return values
from functions, and members of unions."
the horror I feel at this shameless confusion of abstraction layers is such
that I feel compelled to ignore the passages altogether (:->).