- Fixed bug that failed to anchor to end of string when searching for
  "cal" or "itask", but instead matched on elements of the path,
  like /usr/local/bin.  Thanks to Eric Farris.
This commit is contained in:
Paul Beckingham 2009-07-08 08:41:29 -04:00
parent 844dd473e6
commit bf3e69add6
3 changed files with 14 additions and 13 deletions

View file

@ -67,7 +67,9 @@ void Context::initialize (int argc, char** argv)
if (i == 0)
{
program = argv[i];
if (program.find ("cal") != std::string::npos)
std::string::size_type cal = program.find ("/cal");
if (program == "cal" ||
(cal != std::string::npos && program.length () == cal + 4))
args.push_back ("calendar");
}
else

View file

@ -49,7 +49,10 @@ int main (int argc, char** argv)
try
{
context.initialize (argc, argv);
if (context.program.find ("itask") != std::string::npos)
std::string::size_type itask = context.program.find ("/itask");
if (context.program == "itask" ||
(itask != std::string::npos && context.program.length () == itask + 5))
status = context.interactive ();
else
status = context.run ();