37 lines
831 B
C
37 lines
831 B
C
#include<stdio.h>
|
|
#include<time.h>
|
|
#include<stdbool.h>
|
|
|
|
#ifndef _DISPLAY_BAR_H_
|
|
#define _DISPLAY_BAR_H_
|
|
|
|
typedef unsigned raw_progress_bar_t;
|
|
|
|
void lock_scrolled();
|
|
|
|
void unlock_scrolled();
|
|
|
|
void ready_progress_bar();
|
|
|
|
void add_scrolled_unlocked(unsigned int i);
|
|
|
|
raw_progress_bar_t create_raw_progress_bar();
|
|
|
|
void RawDisplayProgressBar(raw_progress_bar_t bar,size_t offset,size_t total,const char * filename);
|
|
|
|
bool isatty_file(FILE * file);
|
|
|
|
void myd_perror(const char * msg);
|
|
|
|
typedef struct {
|
|
raw_progress_bar_t bar;
|
|
//millisecond unit
|
|
int update_rate;
|
|
struct timespec last_update;
|
|
} progress_bar_t;
|
|
//update rate is millsecond unit
|
|
void init_progress_bar(progress_bar_t * bar,int update_rate);
|
|
|
|
void DisplayProgressBar(progress_bar_t * bar,size_t offset,size_t total,const char * filename, bool sync);
|
|
|
|
#endif |