FreeBSD/usr.sbin/edquota/edquota.c
/*
 * Convert a quotause list to an ASCII file.
 */
Convert a quotause list to an ASCII file.
Convert a quotause list to an ASCII file .
int
writeprivs(struct quotause *quplist, int outfd, char *name, int quotatype)
{
	struct quotause *qup;
	FILE *fd;
	ftruncate(outfd, 0);
	lseek(outfd, 0, L_SET);
	if ((fd = fdopen(dup(outfd), "w")) == NULL)
		err(1, "%s", tmpfil);
	fprintf(fd, "Quotas for %s %s:\n", qfextension[quotatype], name);
	for (qup = quplist; qup; qup = qup->next) {
		fprintf(fd, "%s: in use: %s, ", qup->fsname,
		    fmthumanvalblks(qup->dqblk.dqb_curblocks));
		fprintf(fd, "limits (soft = %s, ",
		    fmthumanvalblks(qup->dqblk.dqb_bsoftlimit));
		fprintf(fd, "hard = %s)\n",
		    fmthumanvalblks(qup->dqblk.dqb_bhardlimit));
		fprintf(fd, "\tinodes in use: %s, ",
		    fmthumanvalinos(qup->dqblk.dqb_curinodes));
		fprintf(fd, "limits (soft = %s, ",
		    fmthumanvalinos(qup->dqblk.dqb_isoftlimit));
		fprintf(fd, "hard = %s)\n",
		    fmthumanvalinos(qup->dqblk.dqb_ihardlimit));
	}
	fclose(fd);
	return (1);
}
int writeprivs ( struct quotause * quplist , int outfd , char * name , int quotatype ) { struct quotause * qup ; FILE * fd ; ftruncate ( outfd , 0 ) ; lseek ( outfd , 0 , L_SET ) ; if ( ( fd = fdopen ( dup ( outfd ) , " " ) ) == NULL ) err ( 1 , " " , tmpfil ) ; fprintf ( fd , " \n " , qfextension [ quotatype ] , name ) ; for ( qup = quplist ; qup ; qup = qup -> next ) { fprintf ( fd , " " , qup -> fsname , fmthumanvalblks ( qup -> dqblk . dqb_curblocks ) ) ; fprintf ( fd , " " , fmthumanvalblks ( qup -> dqblk . dqb_bsoftlimit ) ) ; fprintf ( fd , " \n " , fmthumanvalblks ( qup -> dqblk . dqb_bhardlimit ) ) ; fprintf ( fd , " \t " , fmthumanvalinos ( qup -> dqblk . dqb_curinodes ) ) ; fprintf ( fd , " " , fmthumanvalinos ( qup -> dqblk . dqb_isoftlimit ) ) ; fprintf ( fd , " \n " , fmthumanvalinos ( qup -> dqblk . dqb_ihardlimit ) ) ; } fclose ( fd ) ; return ( 1 ) ; }
Convert a quotause list to an ASCII file.
Convert a quotause list to an ASCII file .