if (mult > 1) {
if (mult != 1) {
getuint(lp, partno, prompt, helpstring, oval, maxval, flags)	struct disklabel *lp;	int partno;	char *prompt;	char *helpstring;	u_int32_t oval;	u_int32_t maxval;		/* XXX - used inconsistently */	int flags;{	char buf[BUFSIZ], *endptr, *p, operator = '\0';	u_int32_t rval = oval;	size_t n;	int mult = 1;	u_long ul;	buf[0] = '\0';	do {		printf("%s: [%u] ", prompt, oval);		fflush(stdout);		rewind(stdin);		if (fgets(buf, sizeof(buf), stdin) == NULL) {			putchar('\n');			buf[0] = '\0';		}		n = strlen(buf);		if (n > 0 && buf[n-1] == '\n')			buf[--n] = '\0';		if (buf[0] == '?')			puts(helpstring);	} while (buf[0] == '?');	if (buf[0] == '*' && buf[1] == '\0') {		rval = maxval;	} else {		/* deal with units */		if (buf[0] != '\0' && n > 0) {			if ((flags & DO_CONVERSIONS)) {				switch (buf[n-1]) {				case 'c':					mult = lp->d_secpercyl;					buf[--n] = '\0';					break;				case 'b':					mult = -lp->d_secsize;					buf[--n] = '\0';					break;				case 'k':					mult = 1024 / lp->d_secsize;					buf[--n] = '\0';					break;				case 'm':					mult = 1048576 / lp->d_secsize;					buf[--n] = '\0';					break;				case 'g':					mult = 1073741824 / lp->d_secsize;					buf[--n] = '\0';					break;				}			} else				mult = 1;			/* Did they give us an operator? */			p = &buf[0];			if (*p == '+' || *p == '-')				operator = *p++;			endptr = p;			if (mult > 0)				ul = strtoul(p, &endptr, 10) * mult;			else				/* Negative mult means divide (ooh, fancy) */				ul = strtoul(p, &endptr, 10) / (-mult);			/* Sanity check the return val */			if (ul == ULONG_MAX || ul >= UINT_MAX) {				errno = ERANGE;		/* too big */				rval = UINT_MAX;			} else if (*endptr != '\0') {				errno = EINVAL;		/* non-numbers in str */				rval = UINT_MAX;			} else {				rval = ul;				/* Apply the operator (XXX - check for oflow) */				if (operator == '+')					rval += oval;				else if (operator == '-')					rval = oval - rval;			}		}	}	if ((flags & DO_ROUNDING) && rval < UINT_MAX) {		u_int32_t cyls;		/* XXX - should use maxsize and round down if too big */#ifdef CYLCHECK		/* Always round to nearest cylinder, regardless of units */		cyls = (u_int32_t)((rval / (double)lp->d_secpercyl) + 0.5);		if (rval != cyls * lp->d_secpercyl) {			rval = cyls * lp->d_secpercyl;			printf("Rounding to nearest cylinder: %u\n", rval);		}#else		/* Round to nearest cylinder unless given in blocks */		if (mult > 1) {			cyls = (u_int32_t)((rval / (double)lp->d_secpercyl)			    + 0.5);			if (rval != cyls * lp->d_secpercyl) {				rval = cyls * lp->d_secpercyl;				printf("Rounding to nearest cylinder: %u\n",				    rval);			}		}#endif	}	return(rval);}