From 90fbb368596a36da1b1b1f27a55570926c71c650 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 2 May 2021 19:58:28 -0400 Subject: Get list of formats to test from unscoop itself --- Makefile | 4 +--- unscoop.c | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9062bef..7c09875 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,6 @@ OBJS.scoop = scoop.o xdg.o OBJS.unscoop = unscoop.o xdg.o OBJS = ${OBJS.litterbox} ${OBJS.scoop} ${OBJS.unscoop} -FORMATS = generic catgirl irc textual - dev: tags all test all: ${BINS} @@ -40,7 +38,7 @@ ${OBJS}: database.h test: .test .test: unscoop - for f in ${FORMATS}; do ./unscoop -! -f $$f || exit 1; done + for f in $$(./unscoop -f ?); do ./unscoop -! -f $$f || exit 1; done touch .test tags: *.[ch] diff --git a/unscoop.c b/unscoop.c index 153841c..0ae16d9 100644 --- a/unscoop.c +++ b/unscoop.c @@ -221,9 +221,12 @@ static const struct Format { }; static const struct Format *formatParse(const char *name) { + bool list = !strcmp(name, "?"); for (size_t i = 0; i < ARRAY_LEN(Formats); ++i) { if (!strcmp(name, Formats[i].name)) return &Formats[i]; + if (list) printf("%s\n", Formats[i].name); } + if (list) exit(EX_OK); errx(EX_USAGE, "no such format %s", name); } -- cgit 1.4.1