add makefile - gramscii - A simple editor for ASCII box-and-arrow charts DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 3a8eeffc5b3ef3d23984913d841e3a0aa5f68e16 DIR parent a64ca9d14f8c197398badad39148b794757742b2 HTML Author: KatolaZ <katolaz@freaknet.org> Date: Tue, 23 Jul 2019 16:57:25 +0100 add makefile Diffstat: A Makefile | 19 +++++++++++++++++++ M TODO | 12 +++++++++--- A config.mk | 10 ++++++++++ M gramscii.c | 3 ++- 4 files changed, 40 insertions(+), 4 deletions(-) --- DIR diff --git a/Makefile b/Makefile @@ -0,0 +1,19 @@ +# gramscii - simple editor for ASCII box-and-arrow charts + +include config.mk + +SRC = gramscii.c + +all: options gramscii + +options: + @echo "-+- build options -+-" + @echo "PREFIX = $(PREFIX)" + @echo "CFLAGS = $(CFLAGS)" + @echo "CC = $(CC)" + @echo "-+-+-+-+-+-+-+-+-+-+-" + + +gramscii: + $(CC) $(CFLAGS) -o $@ $(SRC) + DIR diff --git a/TODO b/TODO @@ -1,16 +1,18 @@ + optimize redraws (i.e., avoid to redraw if possible) - move configs in config.h -- add Makefile - change screen management (i.e., dynamic array of lines) -- get screen geometry - add action multiplier (e.g., "7h" moves left by 7 cols) - add scripting mode option ("-s"?) - add screen geometry option (-g 25x80?) - read file at point +- use [ENTER] to exit from text insert +- maybe move "text" mode to "t" +- implement ellipse - parse control characters - parse arrows (text-mode will allow movements as well) - (?) implement CTRL+G as abort (aside ESC) - add crop command (c) +- remove extra blanks until EOL when saving to file + visual selection - crop-to - yank/put @@ -20,9 +22,13 @@ - manage special chars (DEL/CANC) during text insert (also do not print unmanaged chars!) - allow scrolling (both vertical and horizontal) +- catch SIGWINCH and react appropriately (after scroll is + enabled) - auto-arrow 'A' (automatic end-char) -* allow the use of [ENTER] to confirm arrow, boxes, and text (useful +* get screen geometry +* allow the use of [ENTER] to confirm arrow, boxes (useful for scripting) +* add Makefile * change "g" command: - g-g (goto top-left) - g-G (goto bottom-right) DIR diff --git a/config.mk b/config.mk @@ -0,0 +1,10 @@ +NAME=gramscii +VERSION=0.1 + +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)share/man + +CFLAGS=-O3 -std=c90 -pedantic -Wall + +CC=cc DIR diff --git a/gramscii.c b/gramscii.c @@ -633,7 +633,7 @@ void write_file(){ if (!fname[0] || force_new){ get_string("Write to: ", fname, 255); - if (f=fopen(fname, "r")){ + if ((f=fopen(fname, "r"))!=NULL){ if (!is_yes(get_key("File exists. Overwrite [y/n]?")) ){ fclose(f); return; @@ -851,4 +851,5 @@ int main(int argc, char *argv[]){ commands(); cleanup(0); + return 0; }