-- a Lua program, see https://findanyfile.app/scripting.php
--
-- This uses the `nm` commandline tool to look up a given symbol name
--
-- _FAF_Config_ ( minAppVersion=366, input=single )
--

if faf.appVersion < 366 then
	faf.fail ("The script '" .. faf.scriptFileName .. "' doesn't work with this outdated version of FAF.")
end

searchPattern = ""

function searchHasStarted ()
	searchPattern = currentSearch.input
end

fileOptions = "-gjU"

function match (f)
	if not f.isDirectory then
		result = faf.runCommandWithArgs("/usr/bin/nm", {fileOptions, f.path})
		if string.find(result, searchPattern) then
			return true
		end
	end
	return false
end
