diff --git a/ChangeLog b/ChangeLog index 154d1d3..6ad958c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-02-28 Richard Frith-Macdonald + + * EcCommand.m: + When building config for a process, only count the part of a process + name after the last hyphen as an instance ID if it is entirely + composed of digits. + 2022-02-08 Richard Frith-Macdonald * EcCommand.m: diff --git a/EcCommand.m b/EcCommand.m index 5c61c4e..37e0695 100644 --- a/EcCommand.m +++ b/EcCommand.m @@ -4954,7 +4954,25 @@ NSLog(@"Problem %@", localException); options: NSBackwardsSearch | NSLiteralSearch]; if (r.length > 0) { + NSString *inst = [name substringFromIndex: NSMaxRange(r)]; + NSUInteger len = [inst length]; + base = [name substringToIndex: r.location]; + if ([inst length] == 0) + { + base = nil; // Not an instance ID after hyphen + } + else + { + while (len-- > 0) + { + if (!isdigit([inst characterAtIndex: len])) + { + base = nil; // not positive integer after hyphen + break; + } + } + } } else {