From 6bf812a306f331d303c242d294117654f63931c1 Mon Sep 17 00:00:00 2001 From: nick black Date: Tue, 4 Feb 2020 23:09:44 -0500 Subject: [PATCH] demo: elide nonfree demos in DFSG build #316 --- src/demo/demo.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/demo/demo.c b/src/demo/demo.c index 5761b7964..4e9da3b7b 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -21,7 +21,11 @@ static demoresult* results; static char datadir[PATH_MAX]; static atomic_bool interrupted = ATOMIC_VAR_INIT(false); +#ifndef DFSG_BUILD static const char DEFAULT_DEMO[] = "ixetbcgpwuvlfsjo"; +#else +static const char DEFAULT_DEMO[] = "ixtbgpwuso"; +#endif void interrupt_demo(void){ atomic_store(&interrupted, true); @@ -67,22 +71,28 @@ struct timespec demodelay = { .tv_nsec = 0, }; +#ifndef DFSG_BUILD +#define NONFREE(name, fxn) { name, fxn, }, +#else +#define NONFREE(name, fxn) { NULL, NULL, }, +#endif + static struct { const char* name; int (*fxn)(struct notcurses*); } demos[26] = { { NULL, NULL, }, { "box", box_demo, }, - { "chunli", chunli_demo, }, + NONFREE("chunli", chunli_demo) { NULL, NULL, }, - { "eagle", eagle_demo, }, - { "fallin'", fallin_demo, }, + NONFREE("eagle", eagle_demo) + NONFREE("fallin'", fallin_demo) { "grid", grid_demo, }, { NULL, NULL, }, { "intro", intro, }, - { "jungle", jungle_demo, }, + NONFREE("jungle", jungle_demo) { NULL, NULL, }, - { "luigi", luigi_demo, }, + NONFREE("luigi", luigi_demo) { NULL, NULL, }, { NULL, NULL, }, { "outro", outro, }, @@ -92,7 +102,7 @@ static struct { { "sliders", sliding_puzzle_demo, }, { "trans", trans_demo, }, { "uniblock", unicodeblocks_demo, }, - { "view", view_demo, }, + NONFREE("view", view_demo) { "whiteout", witherworm_demo, }, { "xray", xray_demo, }, { NULL, NULL, }, @@ -348,6 +358,9 @@ summary_table(struct ncdirect* nc, const char* spec){ if(failed){ fprintf(stderr, "\nError running demo. Is \"%s\" the correct data path?\n", datadir); } +#ifdef DFSG_BUILD + fprintf(stderr, "DFSG version. Some demos are missing.\n"); +#endif return failed; }