Hello,

I did in the past some small C programms using self defined header .h
files. Usually, I was using a .h file for #define and function
prototypes together with a same name but .c extension file where I was
putting my functions' bodies (inline implemention). The main program
included the previous .h file and that was it. Of course, the standard
headers were included, I don't remember in which of the two .c files,
but I did include them only once.

As some folks recommand on the list, I was looking on cvsweb for code,
starting with bin utilities. I was confused about splitting source
code in .c and .h files.
For src/bin/cat, there is one .c file, no .h file, and the functions
are in .c file, prototypes and bodies;
For src/bin/dd, there are multiple .c and .h files. Of course, dd.c
has the main() function, the rest of the .c files are containing
functions used in dd.c. The only hint those files are related is in
the Makefile.

I read in style(9) about splitting code in files, and I did some
google search. I was amased to see that the choice of splitting code
in files is very wide, some talking even about #include .c files (not
a good practice).

>From the most advanced ones, is there a paper or a link where I can
find details about OpenBSD style of splitting C code in .c and .h
files? I mean, where to put what? OR maybe some rules of thumb.
If one is using multiple .c files with no associated .h headers, is
Makefile (and compiler's options) the only way to relate them?

I'm sorry if it is a little bit offtopic and I thank you.

Reply via email to