doveadm-print-table.c revision f7ecb87b93487f7d68d6dc5e76dc93af36eb6d89
/* Copyright (c) 2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "doveadm-print-private.h"
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#define DEFAULT_COLUMNS 80
#define MIN_COLUMNS 30
#define MAX_BUFFER_LINES 100
struct doveadm_print_table_header {
const char *key;
const char *title;
};
struct doveadm_print_table_context {
unsigned int hdr_idx;
unsigned int columns;
unsigned int lengths_set:1;
};
static struct doveadm_print_table_context *ctx;
static void
{
struct doveadm_print_table_header *thdr;
}
static void doveadm_calc_header_length(void)
{
struct doveadm_print_table_header *headers;
/* find min and max lengths of fields */
for (i = 0; i < hdr_count; i++) {
}
}
}
/* +1 for space between fields */
max_length = 0;
for (i = 0; i < hdr_count; i++)
max_length--;
/* shrink something so we'll fit */
for (i = hdr_count - 1;; i--) {
/* we can finish with this */
max_length -= diff;
break;
}
if (diff > 0) {
/* take a bit off from it */
}
if (i == 0)
break;
}
if (max_length == orig_length) {
/* can't shrink it any more */
break;
}
}
}
static void doveadm_print_next(const char *value)
{
const struct doveadm_print_table_header *hdr;
else
printf("\n");
} else {
printf(" ");
}
}
static void doveadm_buffer_flush(void)
{
const struct doveadm_print_table_header *headers;
const char *const *valuep;
unsigned int i, count;
for (i = 0; i < count; i++) {
} else {
}
}
}
static void doveadm_print_table_print(const char *value)
{
if (!ctx->lengths_set) {
return;
}
}
}
static void doveadm_print_table_init(void)
{
}
}
static void doveadm_print_table_deinit(void)
{
}
struct doveadm_print_vfuncs doveadm_print_table_vfuncs = {
"table",
};