[clug] BUFSIZ - how do you look it up?

Hal Ashburner hal at ashburner.info
Sun Jan 13 20:28:05 MST 2013


Hi CLUG,

I couldn't recall how big it is and the subtleties of it.
And then I couldn't work out how to find out from the documentation.

Ok so I can write a one line C program like you can. But surely I'm missing
something and you can look up defined constants in man pages?

How are you guys doing it? via an internet search engine as a way of
indexing the content of the manpages? Is there something local that can
tell you:

"Yay and this string "stdio.h" appears in the following man pages where it
lists them:
Or in this case give me (3) setbuf if that's really all there is.*

cd /usr/share/man/man3


printf("BUSFIZ is %d", BUFSIZ); // isn't the point, at least I think it's
not.


best I have so far is:
for page in /usr/share/man/man3/*; do zcat $page | grep -rn BUFSIZ >
/dev/null; if [[ $? == 0 ]]; then echo ${${page%%.*}##/*/}; fi; done

*(getpas, setbuf, setbuffer, setlinebuf, setvbuf, stdio, strlcpy is
apparently the list, but that would include duplicates eg setbuf,
setbuffer, setvbuf, setlinebuf are all the same - bleh)

so if I extract BUFSIZ as a script paramater and make man3 man${section}
and it'll do for my ~/bin/ but I'm sure this must come up all the time and
you've all hit it on a day where you had enough time to give it thought in
general terms.

Please share your solution or insight into how I've missed something
important.

The idea was to find the linux documentation that tells me how many bytes
of output are buffered by default before they're flushed for each of the
relevant cases.

Cheers,
Hal


More information about the linux mailing list