Initial public busybox upstream commit
[busybox4maemo] / e2fsprogs / old_e2fsprogs / ext2fs / write_bb_file.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * write_bb_file.c --- write a list of bad blocks to a FILE *
4  *
5  * Copyright (C) 1994, 1995 Theodore Ts'o.
6  *
7  * %Begin-Header%
8  * This file may be redistributed under the terms of the GNU Public
9  * License.
10  * %End-Header%
11  */
12
13 #include <stdio.h>
14
15 #include "ext2_fs.h"
16 #include "ext2fs.h"
17
18 errcode_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, "%d\n", blk);
32         }
33         ext2fs_badblocks_list_iterate_end(bb_iter);
34         return 0;
35 }