From 20ecfc0d21eb2dacf35ce3af3185c022fc4b8bc4 Mon Sep 17 00:00:00 2001 From: toni Date: Sat, 20 Dec 2014 16:04:07 +0100 Subject: - finished ui - added copyright stuff - makefile improvements --- .gitignore | 2 +- Makefile | 8 ++++---- main.c | 14 ++++++++++---- ui.c | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 67402d3..b4c01e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/nask +/naskpass *.swp diff --git a/Makefile b/Makefile index 18c759f..60e27a6 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,13 @@ CFLAGS ?= $(shell ncurses5-config --cflags) -Wall -D_GNU_SOURCE=1 -g LDFLAGS ?= $(shell ncurses5-config --libs) -pthread CC := gcc INSTALL ?= install -VERSION = 1.0 -BIN = nask +VERSION = $(shell if [ -d ./.git ]; then echo -n "git-"; git rev-parse --short HEAD; else echo "1.1a"; fi) +BIN = naskpass SOURCES = status.c ui_ani.c ui_input.c ui_statusbar.c ui.c main.c -all: bin +all: $(BIN) -bin: +$(BIN): $(SOURCES) $(CC) $(SOURCES) -D_VERSION=\"$(VERSION)\" $(CFLAGS) $(LDFLAGS) -o $(BIN) install: diff --git a/main.c b/main.c index 36f396f..1cc99e9 100644 --- a/main.c +++ b/main.c @@ -9,7 +9,10 @@ #include "ui_statusbar.h" #include "ui.h" -#define PKGNAME "nask" +#define AUTHOR "Toni Uhlig" +#define AUTHOR_EMAIL "matzeton@googlemail.com" +#define PKGNAME "naskpass" +#define PKGDESC "A NCurses replacement for cryptsetup's askpass." #ifdef _VERSION #define VERSION _VERSION #else @@ -21,8 +24,10 @@ static void usage(char *arg0) { - fprintf(stderr, "%s (%s)\n", PKGNAME, VERSION); - fprintf(stderr, " CMD: %s: [passfifo]\n", arg0); + fprintf(stderr, "%s (%s)\n %s\n", PKGNAME, VERSION, PKGDESC); + fprintf(stderr, " Written by %s (%s).\n", AUTHOR, AUTHOR_EMAIL); + fprintf(stderr, " License GPLv3+: GNU GPL version 3 or later .\n\n"); + fprintf(stderr, " Command: %s: [passfifo]\n", arg0); } int main(int argc, char **argv) @@ -35,10 +40,11 @@ int main(int argc, char **argv) exit(-1); } + if ((child = vfork()) == 0) { if (setsid() == (pid_t)-1) { perror("setsid"); - return (EXIT_FAILURE); + exit (EXIT_FAILURE); } do_ui(); } if (child > 0) { diff --git a/ui.c b/ui.c index 91d551c..cc9eb0e 100644 --- a/ui.c +++ b/ui.c @@ -236,7 +236,7 @@ do_ui(void) register_statusbar(lower); register_anic(heartbeat); activate_input(wnd_main, pw_input); - set_statusbar_text(higher, "* NASKPASS *"); + set_statusbar_text(higher, "/* NASKPASS */"); if (run_ui_thrd() != 0) { exit(2); } -- cgit v1.2.3