@@ -15,6 +15,7 @@ struct doveadm_print_pager_context {
15
15
unsigned int header_idx ;
16
16
17
17
unsigned int streaming :1 ;
18
+ unsigned int first_page :1 ;
18
19
};
19
20
20
21
static struct doveadm_print_pager_context * ctx ;
@@ -32,7 +33,6 @@ static void pager_next_hdr(void)
32
33
{
33
34
if (++ ctx -> header_idx == array_count (& ctx -> headers )) {
34
35
ctx -> header_idx = 0 ;
35
- o_stream_nsend (doveadm_print_ostream , "\f\n" , 2 );
36
36
}
37
37
}
38
38
@@ -41,6 +41,10 @@ static void doveadm_print_pager_print(const char *value)
41
41
const struct doveadm_print_pager_header * hdr =
42
42
array_idx (& ctx -> headers , ctx -> header_idx );
43
43
44
+ if (ctx -> header_idx == 0 && !ctx -> first_page ) {
45
+ o_stream_nsend (doveadm_print_ostream , "\f\n" , 2 );
46
+ }
47
+ ctx -> first_page = FALSE;
44
48
o_stream_nsend_str (doveadm_print_ostream , hdr -> title );
45
49
o_stream_nsend (doveadm_print_ostream , ": " , 2 );
46
50
o_stream_nsend_str (doveadm_print_ostream , value );
@@ -73,6 +77,7 @@ static void doveadm_print_pager_init(void)
73
77
pool = pool_alloconly_create ("doveadm print pager" , 1024 );
74
78
ctx = p_new (pool , struct doveadm_print_pager_context , 1 );
75
79
ctx -> pool = pool ;
80
+ ctx -> first_page = TRUE;
76
81
p_array_init (& ctx -> headers , pool , 16 );
77
82
}
78
83
0 commit comments