From d5c7780e0ccc77b10cc485ab71f448f285be2b7f Mon Sep 17 00:00:00 2001 From: midipix Date: Jun 18 2020 21:07:44 +0000 Subject: driver: restore proper operation of --version with a modeless driver context. --- diff --git a/src/driver/toks_driver_ctx.c b/src/driver/toks_driver_ctx.c index 92c7a15..de6e05e 100644 --- a/src/driver/toks_driver_ctx.c +++ b/src/driver/toks_driver_ctx.c @@ -484,7 +484,15 @@ int toks_get_driver_ctx( return toks_get_driver_ctx_fail(meta); } - if ((cctx.drvflags & TOKS_DRIVER_MODE_SERVER) && (ntokens <= 0)) { + if ((ntokens == 0) && !(cctx.drvflags & TOKS_DRIVER_VERSION)) { + ntokens = (-1); + } + + if (ntokens == 0) { + cctx.drvflags &= ~(uint64_t)TOKS_DRIVER_MODE_SERVER; + } + + if ((cctx.drvflags & TOKS_DRIVER_MODE_SERVER) && (ntokens < 0)) { if (flags & TOKS_DRIVER_VERBOSITY_ERRORS) toks_dprintf(STDERR_FILENO, "%s: error: number of tokens not set or is invalid.",