MINOR: cfgparse: add cfg_find_best_match() to suggest an existing word
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 08:08:04 +0000 (09:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 13:13:21 +0000 (14:13 +0100)
commite2afcc45092c063464e1f612374aa4b002cd0b66
tree413c8fee9de00ec787cc6fd6b0e197568f05b1a5
parentba2c4459a5f63d5650ff3a4731e74d54e92b5a68
MINOR: cfgparse: add cfg_find_best_match() to suggest an existing word

Instead of just reporting "unknown keyword", let's provide a function which
will look through a list of registered keywords for a similar-looking word
to the one that wasn't matched. This will help callers suggest correct
spelling. Also, given that a large part of the config parser still relies
on a long chain of strcmp(), we'll need to be able to pass extra candidates.
Thus the function supports an optional extra list for this purpose.
include/haproxy/cfgparse.h
src/cfgparse.c