https://gitlab.synchro.net/main/sbbs/-/commit/b527ddd0c10ed8dbf6991d9b
Modified Files:
src/sbbs3/prntfile.cpp readmail.cpp readmsgs.cpp sbbs.h scandirs.cpp scansubs.cpp
Log Message:
boolsrch: fold compile + retry-on-error into get_search_string()
Reported: typing an invalid query (e.g. "(AND") at the F)ind file
description prompt printed the syntax-error message 21 times - once per directory in the selected library. Same shape of bug latent at every
loop call site that compiles the boolean expression inside the iterated function: listfiles() / scanposts() / searchmail() each compile on
entry and bail on syntax error, so the outer loop just sees "no results,
try the next slot" and the user gets one error per slot.
Fix: lift the compile up into get_search_string() so each query is
validated exactly once, at prompt time. On syntax error the helper
prints the InvalidSearchExpression message, displays textsrch.msg
(the same help screen '?' would show - so the user sees the syntax
reference immediately, not just an error), and re-prompts. The user
stays in the prompt loop until they enter a valid expression or
abort with empty input.
Signature change: returns struct bool_expr* (NULL on abort) instead of
bool. Callers that want the compiled expression directly (pager '/', readmsgs.cpp 'F' rebind) use it; callers that just want a validated
string for a downstream function (scansubs, scandirs, readmail) free
the expression immediately - the downstream function will re-compile,
which is fine because the string is now guaranteed-valid so the
downstream compile cannot fail.
Net: each of the 7 call sites drops its own bool_expr_compile + error-
print boilerplate; the F-rebind in readmsgs.cpp shrinks from a 15-line
block to a 6-line block; the 21-errors bug is gone; the user gets a
re-prompt with help on screen the moment they hit a syntax error.
scansubs.cpp and scandirs.cpp gained an #include "boolsrch.h" (needed
for bool_expr_free()).
Co-Authored-By: Claude Opus 4.7 (1M context) <
noreply@anthropic.com>
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)