* mkheaders.c 1.5 81/02/26
* Make all the .h files for the optional entries
* This macro reads a line of the form
* #define STRING <number>
* and assigns STRING to wd and <number> to count
#define rdln(f, wd, count) {\
if ((wd = get_word(f)) != NULL && wd != EOF)\
if ((wd = get_word(f)) != NULL && wd != EOF) {\
if ((wd = get_word(f)) != NULL && wd != EOF) {\
register struct file_list
*fl
;
for (fl
= ftab
; fl
!= NULL
; fl
= fl
->f_next
)
do_count(fl
->f_needs
, fl
->f_needs
, TRUE
);
* 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
!= NULL
; dp
= dp
->d_next
)
if (dp
->d_unit
!= -1 && eq(dp
->d_name
, dev
))
if (mp
!= NULL
&& mp
!= -1 && mp
->d_conn
!= -1)
do_count(mp
->d_name
, hname
, FALSE
);
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
);
fl
= (struct file_list
*) malloc(sizeof *fl
);
for (fl
= fl_head
; fl
!= NULL
; fl
= fl
->f_next
)
fl
= (struct file_list
*) malloc(sizeof *fl
);
for (fl
= fl_head
; fl
!= NULL
; fl
= fl
->f_next
)
fprintf(outf
, "#define %s %d\n", fl
->f_fn
, fl
->f_type
);
* Convert a dev name to a .h file nae
* Convert a dev name to a macro name