bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppendIfNoLineMatching incorrect behavior


From: mark
Subject: Re: AppendIfNoLineMatching incorrect behavior
Date: Wed, 14 May 2003 06:57:24 +0200 (MEST)

Thanks for your patch -- it is not *quite* right, but I have added
the essence of it to the code for 2.0.7.

Mark

On 13 May, Jonathan Chen wrote:
> 
> CFEngine version 2.0.6 has an implementation of AppendIfNoLineMatching that
> varies from the documentation.  Instead of appending the string set from
> SetLine, it appends the regular expression.  The following patch fixes this
> problem:
> 
> --- cfengine-2.0.6/src/edittools.c~   Tue May 13 15:42:57 2003
> +++ cfengine-2.0.6/src/edittools.c    Tue May 13 15:42:58 2003
> @@ -537,22 +537,12 @@
>                    continue;
>                    }
>  
> -            if (strcmp(expdata,"ThisLine") == 0)
> +            if (LocateNextItemMatching(filestart,expdata) == NULL)
>                 {
> -               if (LocateNextItemMatching(filestart,EDITBUFF) == NULL)
> -                  {
> -                  AppendItem(&filestart,EDITBUFF,NULL);
> -                  }           
> +               AppendItem(&filestart,EDITBUFF,NULL);
> +               }              
> +            break;
>  
> -               break;
> -               }
> -            
> -               if (LocateNextItemMatching(filestart,expdata) == NULL)
> -               {
> -                  AppendItem(&filestart,expdata,NULL);
> -                  }
> -               break;
> -
>        case Prepend:
>                 PrependItem(&filestart,expdata,NULL);
>                 break;
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  address@hidden
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]