Esempio n. 1
0
File: html.c Progetto: kilobyte/dfc
/*
 * Display the sum (useful when -s option is used
 * @stot: total size of "total"
 * @atot: total size of "available"
 * @utot: total size of "used"
 * @ifitot: total number of inodes
 * @ifatot: total number of available inodes
 */
static void
html_disp_sum(double stot, double atot, double utot,
              double ifitot, double ifatot)
{
	double ptot = 0;

	if ((int)stot == 0)
		ptot = 100.0;
	else
		ptot = (utot / stot) * 100.0;

	(void)puts("\t</tr>\n\t<tfoot>\n\t<tr>\n\t  <td><strong>SUM</strong></td>");

	if (Tflag)
		(void)puts("\t  <td>N/A</td>");

	if (!bflag)
		html_disp_bar(ptot);

	html_disp_perct(ptot);

	if (uflag) {
		stot = cvrt(stot);
		atot = cvrt(atot);
		if (dflag)
			utot = cvrt(utot);
	}

	if (dflag)
		html_disp_uat(utot, ptot, 0);

	html_disp_uat(atot, ptot, 0);
	html_disp_uat(stot, ptot, 0);

	if (iflag)
		html_disp_inodes((uint64_t)ifitot, (uint64_t)ifatot);

	/* keep same amount of columns in table */
	(void)puts("\t  <td>N/A</td>");
	if (oflag)
		(void)puts("\t  <td>N/A</td>");
}
Esempio n. 2
0
/*
 * Display the sum (useful when -s option is used
 * @stot: total size of "total"
 * @atot: total size of "available"
 * @utot: total size of "used"
 * @ifitot: total number of inodes
 * @ifatot: total number of available inodes
 */
static void
text_disp_sum(double stot, double atot, double utot,
              double ifitot, double ifatot)
{
	double ptot = 0;
	int width;

	width = Tflag ? max.fsname + max.fstype : max.fsname;

	if ((int)stot == 0)
		ptot = 100.0;
	else
		ptot = (utot / stot) * 100.0;

	/* use color option if triggered */
	if (cflag)
		(void)printf("\033[;%dm", cnf.chead);
	(void)printf("%-*s", width, _("SUM:"));
	reset_color();

	if (!bflag)
		text_disp_bar(ptot);

	text_disp_perct(ptot);

	if (uflag) {
		stot = cvrt(stot);
		atot = cvrt(atot);
		if (dflag)
			utot = cvrt(utot);
	}

	if (dflag)
		text_disp_uat(utot, ptot, max.used);
	text_disp_uat(atot, ptot, max.avail);
	text_disp_uat(stot, ptot, max.total);

	if (iflag)
		text_disp_inodes((uint64_t)ifitot, (uint64_t)ifatot);

	(void)printf("\n");
}