help-cfengine
[Top][All Lists]
Advanced

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

[PATCH] ReplaceWithLine doesn't expand variables


From: Adrian Phillips
Subject: [PATCH] ReplaceWithLine doesn't expand variables
Date: 31 Jan 2002 08:56:27 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Heres a patch for 1.6.3 (I'll look at 2.0 a little later),

Sincerely,

Adrian Phillips

--- cfengine-1.6.3/src/edittools.c~     Thu Jan 31 07:16:40 2002
+++ cfengine-1.6.3/src/edittools.c      Thu Jan 31 07:40:52 2002
@@ -693,7 +693,7 @@
                break;
               
      case ReplaceLineWith:
-               if (!ReplaceEditLineWith(ep))
+               if (!ReplaceEditLineWith(expdata))
                   {
                   printf("%s: aborting edit of file %s\n",VPREFIX,filename);
                   continue;
--- cfengine-1.6.3/src/edittools.c~     Thu Feb 15 07:24:22 2001
+++ cfengine-1.6.3/src/edittools.c      Thu Jan 31 07:15:02 2002
@@ -1158,26 +1158,26 @@
 
 /********************************************************************/
 
-int ReplaceEditLineWith (editptr)
+int ReplaceEditLineWith (string)
 
-struct Edlist *editptr;
+char *string;
 
 { char *sp;
 
-if (strcmp(editptr->data,CURRENTLINEPTR->name) == 0)
+if (strcmp(string,CURRENTLINEPTR->name) == 0)
    {
    EditVerbose("ReplaceLineWith - line does not need correction.\n");
    return true;
    }
 
-if ((sp = malloc(strlen(editptr->data)+1)) == NULL)
+if ((sp = malloc(strlen(string)+1)) == NULL)
    {
    printf("%s: Memory allocation failed in ReplaceEditLineWith, aborting 
edit.\n",VPREFIX);
    return false;
    }
 
-EditVerbose("Replacing line %d with 
%10s...\n",CURRENTLINENUMBER,editptr->data);
-strcpy(sp,editptr->data);
+EditVerbose("Replacing line %d with %10s...\n",CURRENTLINENUMBER,string);
+strcpy(sp,string);
 free (CURRENTLINEPTR->name);
 CURRENTLINEPTR->name = sp;
 NUMBEROFEDITS++;
--- cfengine-1.6.3/src/prototypes.h~    Fri Dec 15 16:29:02 2000
+++ cfengine-1.6.3/src/prototypes.h     Thu Jan 31 07:37:05 2002
@@ -207,7 +207,7 @@
 void DoEditFile ARGLIST((struct Edit *ptr, char *filename));
 int IncrementEditPointer ARGLIST((char *str, struct Item *liststart));
 int ResetEditSearch  ARGLIST((char *str, struct Item *list));
-int ReplaceEditLineWith  ARGLIST((struct Edlist *editptr));
+int ReplaceEditLineWith  ARGLIST((char *string));
 int RunEditScript  ARGLIST((char *script, char *fname, struct Item 
**filestart, struct Edit *ptr));
 void DoFixEndOfLine ARGLIST((struct Item *list, char *type));
 void HandleAutomountRescources ARGLIST((struct Item **filestart, char *opts));


-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]



reply via email to

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