if (ui == UINT_MAX)
if (ui == UINT_MAX - 1) { fputs("Command aborted\n", stderr); *lp = oldlabel;		 return; } else if (ui == UINT_MAX)
edit_parms(lp, freep)	struct disklabel *lp;	u_int32_t *freep;{	char *p;	u_int32_t ui;	printf("Changing device parameters for %s:\n", specname);	/* disk type */	for (;;) {		p = getstring(lp, "disk type",		    "What kind of disk is this?  Usually SCSI, ST506, or "		    "floppy (use ST506 for IDE).", dktypenames[lp->d_type]);		for (ui = 1; ui < DKMAXTYPES && strcasecmp(p, dktypenames[ui]);		    ui++)			;		if (ui < DKMAXTYPES) {			break;		} else {			printf("\"%s\" is not a valid disk type.\n", p);			fputs("Valid types are: ", stdout);			for (ui = 1; ui < DKMAXTYPES; ui++) {				printf("\"%s\"", dktypenames[ui]);				if (ui < DKMAXTYPES - 1)					fputs(", ", stdout);			}			putchar('\n');		}	}	lp->d_type = ui;	/* pack/label id */	p = getstring(lp, "label name",	    "15 char string that describes this label, usually the disk name.",	    lp->d_packname);	strncpy(lp->d_packname, p, sizeof(lp->d_packname) - 1);	lp->d_packname[sizeof(lp->d_packname) - 1] = '\0';	/* sectors/track */	for (;;) {		ui = getuint(lp, 0, "sectors/track",		    "The Numer of sectors per track.", lp->d_nsectors,		    lp->d_nsectors, 0);		if (ui == UINT_MAX)			fputs("Invalid entry\n", stderr);		else			break;	}	lp->d_nsectors = ui;	/* tracks/cylinder */	for (;;) {		ui = getuint(lp, 0, "tracks/cylinder",		    "The number of tracks per cylinder.", lp->d_ntracks,		    lp->d_ntracks, 0);		if (ui == UINT_MAX)			fputs("Invalid entry\n", stderr);		else			break;	}	lp->d_ntracks = ui;	/* sectors/cylinder */	for (;;) {		ui = getuint(lp, 0, "sectors/cylinder",		    "The number of sectors per cylinder (Usually sectors/track "		    "* tracks/cylinder).", lp->d_secpercyl, lp->d_secpercyl, 0);		if (ui == UINT_MAX)			fputs("Invalid entry\n", stderr);		else			break;	}	lp->d_secpercyl = ui;	/* number of cylinders */	for (;;) {		ui = getuint(lp, 0, "number of cylinders",		    "The total number of cylinders on the disk.",		    lp->d_ncylinders, lp->d_ncylinders, 0);		if (ui == UINT_MAX)			fputs("Invalid entry\n", stderr);		else			break;	}	lp->d_ncylinders = ui;	/* total sectors */	for (;;) {		ui = getuint(lp, 0, "total sectors",		    "The total number of sectors on the disk.",		    lp->d_secperunit ? lp->d_secperunit :		    lp->d_ncylinders * lp->d_ncylinders,		    lp->d_ncylinders * lp->d_ncylinders, 0);		if (ui == UINT_MAX)			fputs("Invalid entry\n", stderr);		else if (ui > lp->d_secperunit) {			/* grow free count */			*freep += ui - lp->d_secperunit;			puts("You may want to increase the 'c' partition.");			break;		} else if (ui < lp->d_secperunit) {			/* shrink free count */			if (lp->d_secperunit - ui > *freep)				fprintf(stderr,				    "Not enough free space to shrink by %u "				    "sectors (only %u sectors left)\n",				    lp->d_secperunit - ui, *freep);			else {				*freep -= lp->d_secperunit - ui;				break;			}		} else			break;	}	lp->d_secperunit = ui;	/* rpm */	for (;;) {		ui = getuint(lp, 0, "rpm",		  "The rotational speed of the disk in revolutions per minute.",		  lp->d_rpm, lp->d_rpm, 0);		if (ui == UINT_MAX)			fputs("Invalid entry\n", stderr);		else			break;	}	lp->d_rpm = ui;}