Is there a way to search for a string in an ACL file?
I have looked for an answer in the various posts but have not found anything, so here is the question.
I am using Arbortext Editor 5.3. We have a couple of script files (init.acl and user.acl) on a network folder, say s:\scripts.
To avoid network latency the script files are copied to a local hard drive and loaded from there when Arbortext is executed. Occasionally one or more of these scripts may change. I want to make it easy for users to check for updates by providing an menu option they can use. The idea is it checks the version of the local script and then checks the version of the network script.
In each script file I put a version that I want to check against later, e.g $initscriptver=1 and $userscriptver=1,
what I want to do in my check_for_updates.acl script is something similar to the following:
- Open the network script file (e.g. s:\scripts\init.acl)
- Find the line containing the version number (e.g. $initscriptver=1)
- Extract the version number from the line
- Compare the version number I extracted with the one in the loaded script
I am having trouble working out how to do step 3 (and possibly step 2 ). As I may not be the only one updating the scripts, the version number position may change (e.g. there could be whitespace either side of the "=")
An example of the code is:
function Find_string_in_file(strtofind, from)
{
srcFile = open(from, "r")
if (srcFile < 0)
{
eval "Couldn’t open file for read:", from
return 0
}
while (getline(srcFile, line))
{
$pos=span($line, $strtofind);
if ($pos > 0)
{
#
# extract the version somehow
#
break;
}
}
close(srcFile)
return 1; # True
}
Any pointers would be greatly appreciated.

