dqblk.dqb_bsoftlimit = btodb(dqblk.dqb_bsoftlimit * 1024); dqblk.dqb_bhardlimit = btodb(dqblk.dqb_bhardlimit * 1024);
dqblk.dqb_bsoftlimit = btodb((off_t)dqblk.dqb_bsoftlimit * 1024); dqblk.dqb_bhardlimit = btodb((off_t)dqblk.dqb_bhardlimit * 1024);
readprivs(quplist, infd)	struct quotause *quplist;	int infd;{	register struct quotause *qup;	FILE *fd;	int cnt;	register char *cp;	struct dqblk dqblk;	char *fsp, line1[BUFSIZ], line2[BUFSIZ];	lseek(infd, 0, SEEK_SET);	fd = fdopen(dup(infd), "r");	if (fd == NULL) {		warnx("can't re-read temp file!!");		return(0);	}	/*	 * Discard title line, then read pairs of lines to process.	 */	(void)fgets(line1, sizeof (line1), fd);	while (fgets(line1, sizeof (line1), fd) != NULL &&	       fgets(line2, sizeof (line2), fd) != NULL) {		if ((fsp = strtok(line1, " \t:")) == NULL) {			warnx("%s: bad format", line1);			return(0);		}		if ((cp = strtok((char *)0, "\n")) == NULL) {			warnx("%s: %s: bad format", fsp, &fsp[strlen(fsp) + 1]);			return(0);		}		cnt = sscanf(cp,		    " blocks in use: %d, limits (soft = %d, hard = %d)",		    &dqblk.dqb_curblocks, &dqblk.dqb_bsoftlimit,		    &dqblk.dqb_bhardlimit);		if (cnt != 3) {			warnx("%s:%s: bad format", fsp, cp);			return(0);		}		dqblk.dqb_curblocks = btodb(dqblk.dqb_curblocks * 1024);		dqblk.dqb_bsoftlimit = btodb(dqblk.dqb_bsoftlimit * 1024);		dqblk.dqb_bhardlimit = btodb(dqblk.dqb_bhardlimit * 1024);		if ((cp = strtok(line2, "\n")) == NULL) {			warnx("%s: %s: bad format", fsp, line2);			return(0);		}		cnt = sscanf(cp,		    "\tinodes in use: %d, limits (soft = %d, hard = %d)",		    &dqblk.dqb_curinodes, &dqblk.dqb_isoftlimit,		    &dqblk.dqb_ihardlimit);		if (cnt != 3) {			warnx("%s: %s: bad format", fsp, line2);			return(0);		}		for (qup = quplist; qup; qup = qup->next) {			if (strcmp(fsp, qup->fsname))				continue;			/*			 * Cause time limit to be reset when the quota			 * is next used if previously had no soft limit			 * or were under it, but now have a soft limit			 * and are over it.			 */			if (dqblk.dqb_bsoftlimit &&			    qup->dqblk.dqb_curblocks >= dqblk.dqb_bsoftlimit &&			    (qup->dqblk.dqb_bsoftlimit == 0 ||			     qup->dqblk.dqb_curblocks <			     qup->dqblk.dqb_bsoftlimit))				qup->dqblk.dqb_btime = 0;			if (dqblk.dqb_isoftlimit &&			    qup->dqblk.dqb_curinodes >= dqblk.dqb_isoftlimit &&			    (qup->dqblk.dqb_isoftlimit == 0 ||			     qup->dqblk.dqb_curinodes <			     qup->dqblk.dqb_isoftlimit))				qup->dqblk.dqb_itime = 0;			qup->dqblk.dqb_bsoftlimit = dqblk.dqb_bsoftlimit;			qup->dqblk.dqb_bhardlimit = dqblk.dqb_bhardlimit;			qup->dqblk.dqb_isoftlimit = dqblk.dqb_isoftlimit;			qup->dqblk.dqb_ihardlimit = dqblk.dqb_ihardlimit;			qup->flags |= FOUND;			if (dqblk.dqb_curblocks == qup->dqblk.dqb_curblocks &&			    dqblk.dqb_curinodes == qup->dqblk.dqb_curinodes)				break;			warnx("%s: cannot change current allocationn", fsp);			break;		}	}	fclose(fd);	/*	 * Disable quotas for any filesystems that have not been found.	 */	for (qup = quplist; qup; qup = qup->next) {		if (qup->flags & FOUND) {			qup->flags &= ~FOUND;			continue;		}		qup->dqblk.dqb_bsoftlimit = 0;		qup->dqblk.dqb_bhardlimit = 0;		qup->dqblk.dqb_isoftlimit = 0;		qup->dqblk.dqb_ihardlimit = 0;	}	return(1);}