|
|
@ -149,7 +149,7 @@ usage(const char* exe, int status){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static demoresult*
|
|
|
|
static demoresult*
|
|
|
|
ext_demos(struct notcurses* nc, const char* spec){
|
|
|
|
ext_demos(struct notcurses* nc, const char* spec, bool ignore_failures){
|
|
|
|
int ret = 0;
|
|
|
|
int ret = 0;
|
|
|
|
results = malloc(sizeof(*results) * strlen(spec));
|
|
|
|
results = malloc(sizeof(*results) * strlen(spec));
|
|
|
|
if(results == NULL){
|
|
|
|
if(results == NULL){
|
|
|
@ -176,7 +176,7 @@ ext_demos(struct notcurses* nc, const char* spec){
|
|
|
|
results[i].timens = nowns - prevns;
|
|
|
|
results[i].timens = nowns - prevns;
|
|
|
|
prevns = nowns;
|
|
|
|
prevns = nowns;
|
|
|
|
results[i].result = ret;
|
|
|
|
results[i].result = ret;
|
|
|
|
if(ret){
|
|
|
|
if(!ignore_failures){
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
hud_completion_notify(&results[i]);
|
|
|
|
hud_completion_notify(&results[i]);
|
|
|
@ -188,14 +188,15 @@ ext_demos(struct notcurses* nc, const char* spec){
|
|
|
|
// specification, also returns NULL, heh. determine this by argv[optind];
|
|
|
|
// specification, also returns NULL, heh. determine this by argv[optind];
|
|
|
|
// if it's NULL, there were valid options, but no spec.
|
|
|
|
// if it's NULL, there were valid options, but no spec.
|
|
|
|
static const char*
|
|
|
|
static const char*
|
|
|
|
handle_opts(int argc, char** argv, notcurses_options* opts, bool* use_hud){
|
|
|
|
handle_opts(int argc, char** argv, notcurses_options* opts, bool* use_hud,
|
|
|
|
|
|
|
|
bool* ignore_failures){
|
|
|
|
strcpy(datadir, NOTCURSES_SHARE);
|
|
|
|
strcpy(datadir, NOTCURSES_SHARE);
|
|
|
|
char renderfile[PATH_MAX] = "";
|
|
|
|
char renderfile[PATH_MAX] = "";
|
|
|
|
bool constant_seed = false;
|
|
|
|
bool constant_seed = false;
|
|
|
|
int c;
|
|
|
|
int c;
|
|
|
|
*use_hud = false;
|
|
|
|
*use_hud = false;
|
|
|
|
memset(opts, 0, sizeof(*opts));
|
|
|
|
memset(opts, 0, sizeof(*opts));
|
|
|
|
while((c = getopt(argc, argv, "HVhckl:r:d:f:p:")) != EOF){
|
|
|
|
while((c = getopt(argc, argv, "HVhickl:r:d:f:p:")) != EOF){
|
|
|
|
switch(c){
|
|
|
|
switch(c){
|
|
|
|
case 'H':
|
|
|
|
case 'H':
|
|
|
|
*use_hud = true;
|
|
|
|
*use_hud = true;
|
|
|
@ -221,6 +222,9 @@ handle_opts(int argc, char** argv, notcurses_options* opts, bool* use_hud){
|
|
|
|
case 'c':
|
|
|
|
case 'c':
|
|
|
|
constant_seed = true;
|
|
|
|
constant_seed = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'i':
|
|
|
|
|
|
|
|
*ignore_failures = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 'k':
|
|
|
|
case 'k':
|
|
|
|
opts->inhibit_alternate_screen = true;
|
|
|
|
opts->inhibit_alternate_screen = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -393,9 +397,9 @@ int main(int argc, char** argv){
|
|
|
|
sigaddset(&sigmask, SIGWINCH);
|
|
|
|
sigaddset(&sigmask, SIGWINCH);
|
|
|
|
pthread_sigmask(SIG_SETMASK, &sigmask, NULL);
|
|
|
|
pthread_sigmask(SIG_SETMASK, &sigmask, NULL);
|
|
|
|
notcurses_options nopts;
|
|
|
|
notcurses_options nopts;
|
|
|
|
bool use_hud;
|
|
|
|
|
|
|
|
const char* spec;
|
|
|
|
const char* spec;
|
|
|
|
if((spec = handle_opts(argc, argv, &nopts, &use_hud)) == NULL){
|
|
|
|
bool use_hud, ignore_failures;
|
|
|
|
|
|
|
|
if((spec = handle_opts(argc, argv, &nopts, &use_hud, &ignore_failures)) == NULL){
|
|
|
|
if(argv[optind] != NULL){
|
|
|
|
if(argv[optind] != NULL){
|
|
|
|
usage(*argv, EXIT_FAILURE);
|
|
|
|
usage(*argv, EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -437,7 +441,7 @@ int main(int argc, char** argv){
|
|
|
|
nanosleep(&demodelay, NULL);
|
|
|
|
nanosleep(&demodelay, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(ext_demos(nc, spec) == NULL){
|
|
|
|
if(ext_demos(nc, spec, ignore_failures) == NULL){
|
|
|
|
goto err;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(hud_destroy()){
|
|
|
|
if(hud_destroy()){
|
|
|
|