Skip to content

Pullrequest #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
EXECUTABLE = demo
SHARED_LIB = libprogressbar.so
STATIC_LIB = libprogressbar.a
#SHARED_LIB = libprogressbar.so
#STATIC_LIB = libprogressbar.a

SRC=lib
INCLUDE=include/progressbar
Expand All @@ -9,7 +9,7 @@ CFLAGS += -std=c99 -I$(INCLUDE) -Wimplicit-function-declaration -Wall -Wextra -p
CFLAGS_DEBUG = -g -O0
LDLIBS = -lncurses

all: $(EXECUTABLE) $(SHARED_LIB) $(STATIC_LIB)
all: $(EXECUTABLE) libprogressbar.so libprogressbar.a libstatusbar.so libstatusbar.a

debug: CFLAGS += $(CFLAGS_DEBUG)
debug: $(EXECUTABLE)
Expand All @@ -25,6 +25,15 @@ libprogressbar.so: $(INCLUDE)/progressbar.h $(SRC)/progressbar.c

libprogressbar.a: libprogressbar.a(progressbar.o)

libstatusbar.so: $(INCLUDE)/statusbar.h $(SRC)/statusbar.c
$(CC) -fPIC -shared -o $@ -c $(CFLAGS) $(CPPFLAGS) $(SRC)/statusbar.c

libstatusbar.a: libstatusbar.a(statusbar.o)

install:
cp libprogressbar.* libstatusbar.* /usr/local/lib
cp -r include/progressbar /usr/local/include

%.o: $(SRC)/%.c $(INCLUDE)/%.h
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

Expand All @@ -34,5 +43,5 @@ demo.o: $(TEST)/demo.c

.PHONY: clean
clean:
rm -f *.o $(EXECUTABLE) $(SHARED_LIB) $(STATIC_LIB)
rm -f *.o $(EXECUTABLE) $libprogressbar.so libprogressbar.a libstatusbar.so libstatusbar.a
rm -rf doc
32 changes: 24 additions & 8 deletions README.mdown
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## What is this thing?

progressbar is a C-class (it's a convention, dammit) for displaying attractive
progress bars on the command line. It's heavily influenced by the ruby ProgressBar
gem, whose api and behaviour it imitates.
![GIF created with `ttygif`](./example_output/demo.gif)

`progressbar` is a C-class (it's a convention, dammit) for displaying attractive progress bars on the command line. It's heavily influenced by the ruby `ProgressBar` gem, whose api and behavior it imitates.

## Ok, what the hell is a C-class, and how do I use one?

Expand Down Expand Up @@ -34,15 +34,31 @@ a tool to handle some long-running, processor-intensive task, I'd really
like to have a way of seeing at a glance how much time is remaining and
how far along we've gotten. Enter progressbar!

## Can I use it?
## How to use it

Of course, if you're so inclined. progressbar is licensed under a simplified BSD license,
so feel free to take it and run with it. Details can be found in the `LICENSE` file.
First install the `progressbar` libraries for progress and status bars:

1. `git clone PATH-TO-PROGRESSBAR` (replace path with git path)
2. `make`
3. `sudo make install`

How to compile your custom code and make use of `progressbar`:

gcc -lncurses -lprogressbar -lstatusbar YOURCODE.C -o YOURCODE

## Why doesn't it compile?
If your `gcc` search path does not look up `/usr/local/include`, try this:

If progressbar fails to build because `termcap.h` isn't found, you're probably missing the ncurses dev libraries.
gcc -I/usr/local/include/progressbar -lncurses -lprogressbar -lstatusbar YOURCODE.C -o YOURCODE

## Troubleshooting

If progressbar fails to build because `termcap.h` isn't found, you're probably missing the `ncurses dev` libraries.

gcc -c -std=c99 -Iinclude lib/progressbar.c
lib/progressbar.c:13:45: fatal error: termcap.h: No such file or directory
compilation terminated.

## LICENSE

Of course, if you're so inclined. `progressbar` is licensed under a simplified BSD license,
so feel free to take it and run with it. Details can be found in the `LICENSE` file.
Binary file added example_output/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.