/* cssh - parallel secure shell Copyright (C) 2015 Andreas Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ // rougly based on https://github.com/doches/progressbar // but changed in API, multi-line support and some interna // also simplified to exactly what we need for cssh #ifndef _PROGRESSBAR_HEADER_INCLUDED #define _PROGRESSBAR_HEADER_INCLUDED #include #include #define DEFAULT_COLS 80 #define TERMBUF_SIZE 2048 struct cssh_progressbar_pool_t; typedef struct cssh_progressbar_t { uint64_t min_value; uint64_t max_value; char *label; uint64_t value; unsigned int total_steps; unsigned int current_step; struct cssh_progressbar_pool_t *pool; char *buf; } cssh_progressbar_t; typedef struct cssh_progressbar_pool_t { size_t capacity; size_t N; cssh_progressbar_t **progressbar; char *termbuf; unsigned char cols; } cssh_progressbar_pool_t; int create_progressbar( cssh_progressbar_t *progressbar, uint64_t min_value, uint64_t max_value, size_t size, const char *label_fmt, ... ); void free_progressbar( cssh_progressbar_t *progressbar ); void set_value_of_progressbar( cssh_progressbar_t *progressbar, uint64_t value ); void redraw_progressbar( cssh_progressbar_t *progressbar ); int create_progressbar_pool( cssh_progressbar_pool_t *pool, size_t initial_size ); void free_progressbar_pool( cssh_progressbar_pool_t *pool ); int append_progressbar_to_pool( cssh_progressbar_pool_t *pool, cssh_progressbar_t *progressbar ); int remove_progressbar_from_pool( cssh_progressbar_pool_t *pool, cssh_progressbar_t *progressbar ); void redraw_progressbars( cssh_progressbar_pool_t *pool ); #endif