/**
 * statstape_printglobal(d, csv_filename):
 * Print global statistics relating to a set of archives.  If ${csv_filename}
 * is not NULL, output will be written in CSV format to that filename.
 */
int
statstape_printglobal(TAPE_S * d, const char * csv_filename)
{
	FILE * output = stdout;
	int csv = 0;

	/* Should we output to a CSV file? */
	if (csv_filename != NULL)
		csv = 1;

	/* Open CSV output file, if requested. */
	if (csv && (output = fopen(csv_filename, "wt")) == NULL)
		goto err0;

	/* Ask the chunk storage layer to do this. */
	if (chunks_stats_printglobal(output, d->C, csv))
		goto err1;

	/* Close CSV output file, if requested. */
	if (csv && fclose(output))
		goto err0;

	/* Success! */
	return (0);

err1:
	if (output != stdout)
		fclose(output);
err0:
	/* Failure! */
	return (-1);
}
示例#2
0
/**
 * statstape_printglobal(d):
 * Print global statistics relating to a set of archives.
 */
int
statstape_printglobal(TAPE_S * d)
{

	/* Ask the chunk storage layer to do this. */
	if (chunks_stats_printglobal(stdout, d->C))
		goto err0;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}