1/*
2 * write_bb_file.c --- write a list of bad blocks to a FILE *
3 *
4 * Copyright (C) 1994, 1995 Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the GNU Library
8 * General Public License, version 2.
9 * %End-Header%
10 */
11
12#include "config.h"
13#include <stdio.h>
14
15#include "ext2_fs.h"
16#include "ext2fs.h"
17
18errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
19			       unsigned int flags EXT2FS_ATTR((unused)),
20			       FILE *f)
21{
22	badblocks_iterate	bb_iter;
23	blk_t			blk;
24	errcode_t		retval;
25
26	retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter);
27	if (retval)
28		return retval;
29
30	while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) {
31		fprintf(f, "%u\n", blk);
32	}
33	ext2fs_badblocks_list_iterate_end(bb_iter);
34	return 0;
35}
36