usr.sbin/config.new/files.c
/*
 * We have finished reading everything.  Tack the files down: calculate
 * selection and counts as needed.
 */
We have finished reading everything.  Tack the files down: calculate
selection and counts as needed.
We have finished reading everything . Tack the files down : calculate selection and counts as needed .
int
fixfiles()
{
	register struct files *fi;
	register struct nvlist *nv;
	register struct devbase *dev;
	int sel, err;
	err = 0;
	for (fi = allfiles; fi != NULL; fi = fi->fi_next) {
		if (fi->fi_flags & FI_HIDDEN)
			continue;
		if ((nv = fi->fi_opt) == NULL) {	
			fi->fi_flags |= FI_SEL;
			continue;
		}
		sel = 0;
		if (fi->fi_flags & FI_NEEDSCOUNT) {
			do {
				dev = ht_lookup(devbasetab, nv->nv_name);
				if (dev == NULL) {
					xerror(fi->fi_srcfile, fi->fi_srcline,
					    "`%s' is not a countable device",
					    nv->nv_name);
					err = 1;
				} else {
					if (dev->d_umax)
						sel = 1;
					nv->nv_int = dev->d_umax;
					(void)ht_insert(needcnttab,
					    nv->nv_name, nv);
				}
			} while ((nv = nv->nv_next) != NULL);
		} else {
			do {
				if (ht_lookup(selecttab, nv->nv_name)) {
					sel = 1;
					break;
				}
			} while ((nv = nv->nv_next) != NULL);
			if (fi->fi_flags & FI_NEEDSFLAG)
				for (nv = fi->fi_opt; nv; nv = nv->nv_next)
					nv->nv_int = sel;
		}
		if (sel)
			fi->fi_flags |= FI_SEL;
	}
	return (err);
}
int fixfiles ( ) { register struct files * fi ; register struct nvlist * nv ; register struct devbase * dev ; int sel , err ; err = 0 ; for ( fi = allfiles ; fi != NULL ; fi = fi -> fi_next ) { if ( fi -> fi_flags & FI_HIDDEN ) continue ; if ( ( nv = fi -> fi_opt ) == NULL ) { fi -> fi_flags |= FI_SEL ; continue ; } sel = 0 ; if ( fi -> fi_flags & FI_NEEDSCOUNT ) { do { dev = ht_lookup ( devbasetab , nv -> nv_name ) ; if ( dev == NULL ) { xerror ( fi -> fi_srcfile , fi -> fi_srcline , " " , nv -> nv_name ) ; err = 1 ; } else { if ( dev -> d_umax ) sel = 1 ; nv -> nv_int = dev -> d_umax ; ( void ) ht_insert ( needcnttab , nv -> nv_name , nv ) ; } } while ( ( nv = nv -> nv_next ) != NULL ) ; } else { do { if ( ht_lookup ( selecttab , nv -> nv_name ) ) { sel = 1 ; break ; } } while ( ( nv = nv -> nv_next ) != NULL ) ; if ( fi -> fi_flags & FI_NEEDSFLAG ) for ( nv = fi -> fi_opt ; nv ; nv = nv -> nv_next ) nv -> nv_int = sel ; } if ( sel ) fi -> fi_flags |= FI_SEL ; } return ( err ) ; }
We have finished reading everything.
We have finished reading everything .
/* standard */ /* figure out whether it is selected */ /* ... and compute counts too */ /* if selected, we are go */