From 3a8eeffc5b3ef3d23984913d841e3a0aa5f68e16 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Tue, 23 Jul 2019 16:57:25 +0100 Subject: add makefile --- Makefile | 19 +++++++++++++++++++ TODO | 12 +++++++++--- config.mk | 10 ++++++++++ gramscii.c | 3 ++- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 Makefile create mode 100644 config.mk diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9ce0381 --- /dev/null +++ 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) + diff --git a/TODO b/TODO index 83a28b8..da7de02 100644 --- 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) diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..49448a1 --- /dev/null +++ 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 diff --git a/gramscii.c b/gramscii.c index 24841f3..f7f2ed4 100644 --- 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; } -- cgit v1.2.3