/* mkheaders.c 1.13 82/12/09 */
* Make all the .h files for the optional entries
register struct file_list
*fl
;
for (fl
= ftab
; fl
!= 0; fl
= fl
->f_next
)
do_count(fl
->f_needs
, fl
->f_needs
, 1);
* count all the devices of a certain type and recurse to count
* whatever the device is connected to
do_count(dev
, hname
, search
)
register char *dev
, *hname
;
register struct device
*dp
, *mp
;
for (count
= 0,dp
= dtab
; dp
!= 0; dp
= dp
->d_next
)
if (dp
->d_unit
!= -1 && eq(dp
->d_name
, dev
)) {
if (dp
->d_type
== PSEUDO_DEVICE
) {
dp
->d_slave
!= UNKNOWN
? dp
->d_slave
: 1;
* Allow holes in unit numbering,
* assumption is unit numbering starts
if (dp
->d_unit
+ 1 > count
)
if (mp
!= 0 && mp
!= (struct device
*)-1 &&
mp
->d_conn
!= (struct device
*)-1) {
do_count(mp
->d_name
, hname
, 0);
do_header(dev
, hname
, count
);
do_header(dev
, hname
, count
)
char *file
, *name
, *inw
, *toheader(), *tomacro();
struct file_list
*fl
, *fl_head
;
fprintf(outf
, "#define %s %d\n", name
, count
);
if ((inw
= get_word(inf
)) == 0 || inw
== (char *)EOF
)
if ((inw
= get_word(inf
)) == 0 || inw
== (char *)EOF
)
if (cp
== 0 || cp
== (char *)EOF
)
fl
= (struct file_list
*) malloc(sizeof *fl
);
for (fl
= fl_head
; fl
!= 0; fl
= fl
->f_next
)
fl
= (struct file_list
*) malloc(sizeof *fl
);
for (fl
= fl_head
; fl
!= 0; fl
= fl
->f_next
) {
fprintf(outf
, "#define %s %d\n",
fl
->f_fn
, count
? fl
->f_type
: 0);
* convert a dev name to a .h file name
(void) strcpy(hbuf
, path(dev
));
(void) strcat(hbuf
, ".h");
* convert a dev name to a macro name