fprintf(fp, "%s%c %s %s rw 1 %d\n", bdev, 'a' + mi[i].partno,
j =  mi[i].partno; fprintf(fp, "%s%c %s %s rw 1 %d\n", bdev, 'a' + j,
mpsave(lp, mp, cdev, fstabfile)	struct disklabel *lp;	char **mp;	char *cdev;	char *fstabfile;{	int i, mpset;	char bdev[MAXPATHLEN], *p;	struct mountinfo mi[MAXPARTITIONS];	FILE *fp;	memset(&mi, 0, sizeof(mi));	for (i = 0, mpset = 0; i < MAXPARTITIONS; i++) {		if (mp[i] != NULL) {			mi[i].mountpoint = mp[i];			mi[i].partno = i;			mpset = 1;		}	}	/* Exit if there is nothing to do... */	if (!mpset)		return(0);	/* Convert cdev to bdev */	if (strncmp(_PATH_DEV, cdev, sizeof(_PATH_DEV) - 1) == 0 &&	    cdev[sizeof(_PATH_DEV) - 1] == 'r') {		snprintf(bdev, sizeof(bdev), "%s%s", _PATH_DEV,		    &cdev[sizeof(_PATH_DEV)]);	} else {		if ((p = strrchr(cdev, '/')) == NULL || *(++p) != 'r')			return(1);		*p = '\0';		snprintf(bdev, sizeof(bdev), "%s%s", cdev, p + 1);		*p = 'r';	}	bdev[strlen(bdev) - 1] = '\0';	/* Sort mountpoints so we don't try to mount /usr/local before /usr */ 	qsort((void *)mi, MAXPARTITIONS, sizeof(struct mountinfo), micmp);	if ((fp = fopen(fstabfile, "w")) == NULL)		return(1);	for (i = 0; i < MAXPARTITIONS && mi[i].mountpoint != NULL; i++) {		fprintf(fp, "%s%c %s %s rw 1 %d\n", bdev, 'a' + mi[i].partno,		    mi[i].mountpoint,		    fstypesnames[lp->d_partitions[i].p_fstype],		    i == 0 ? 1 : 2);	}	fclose(fp);	printf("Wrote fstab entries to %s\n", fstabfile);	return(0);}