libite 2.6.1
progress.c File Reference
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include "conio.h"

Go to the source code of this file.

Macros

#define SPINNER_THROB   ".oOo"
 
#define SPINNER_PULSAR   ".oO°Oo."
 
#define SPINNER_ARROW   "v<^>"
 
#define SPINNER_STAR   ".oO@*"
 
#define SPINNER_DEFAULT   "|/-\\"
 

Functions

void progress (int percent, int max_width)
 
void progress_simple (int percent)
 

Detailed Description

Author
Joachim Wiberg
Date
2012-2021

Definition in file progress.c.

Macro Definition Documentation

◆ SPINNER_ARROW

#define SPINNER_ARROW   "v<^>"

Definition at line 33 of file progress.c.

◆ SPINNER_DEFAULT

#define SPINNER_DEFAULT   "|/-\\"

Definition at line 35 of file progress.c.

◆ SPINNER_PULSAR

#define SPINNER_PULSAR   ".oO°Oo."

Definition at line 32 of file progress.c.

◆ SPINNER_STAR

#define SPINNER_STAR   ".oO@*"

Definition at line 34 of file progress.c.

◆ SPINNER_THROB

#define SPINNER_THROB   ".oOo"

Definition at line 31 of file progress.c.

Function Documentation

◆ progress()

void progress ( int percent,
int max_width )

Advanced ASCII progress bar with spinner

Parameters
percentStart first call with this set to 0, end with 100
max_widthMax width of progress bar, in total characters.

This function draws an advanced ASCII progressbar at the current line. It always start from the first column.

The progress bar will hide the cursor if started with percent 0 and show it again at the end, when called with percent 100.

While being called with the same percentage the spinner will spin, to show the user the process hasn't frozen.

If the output TTY cannot interpret control characters, like \r, it is advised to instead used the progress_simple() function.

Definition at line 66 of file progress.c.

◆ progress_simple()

void progress_simple ( int percent)

Alternative progress bar on systems where progress() doesn't work

Parameters
percentStart first call with this set to 0, end with 100

Definition at line 99 of file progress.c.