-
-static void
-printval(bp, v)
- char *bp;
- VAR *v;
-{
- static char ofmt[32] = "%";
- register char *fcp, *cp;
-
- cp = ofmt + 1;
- fcp = v->fmt;
- if (v->flag & LJUST)
- *cp++ = '-';
- *cp++ = '*';
- while (*cp++ = *fcp++);
-
- switch (v->type) {
- case CHAR:
- (void)printf(ofmt, v->width, *(char *)bp);
- break;
- case UCHAR:
- (void)printf(ofmt, v->width, *(u_char *)bp);
- break;
- case SHORT:
- (void)printf(ofmt, v->width, *(short *)bp);
- break;
- case USHORT:
- (void)printf(ofmt, v->width, *(u_short *)bp);
- break;
- case LONG:
- (void)printf(ofmt, v->width, *(long *)bp);
- break;
- case ULONG:
- (void)printf(ofmt, v->width, *(u_long *)bp);
- break;
- case KPTR:
- (void)printf(ofmt, v->width, *(u_long *)bp &~ KERNBASE);
- break;
- default:
- errx(1, "unknown type %d", v->type);
- }
-}