help-cfengine
[Top][All Lists]
Advanced

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

[PATCH] Make sure variables are expanded for ReplaceLineWith


From: Adrian Phillips
Subject: [PATCH] Make sure variables are expanded for ReplaceLineWith
Date: 05 Feb 2002 13:24:33 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

This I sent a few days ago for 1.6.3, here is the 2.0 version (the
same actually).

diff -urN cfengine-2.0.a16/src/edittools.c cfengine-2.0.a16.new/src/edittools.c
--- cfengine-2.0.a16/src/edittools.c    Mon Jan 21 13:56:55 2002
+++ cfengine-2.0.a16.new/src/edittools.c        Fri Feb  1 12:00:21 2002
@@ -705,7 +705,7 @@
                break;
               
      case ReplaceLineWith:
-               if (!ReplaceEditLineWith(ep))
+               if (!ReplaceEditLineWith(expdata))
                   {
                   printf("%s: aborting edit of file %s\n",VPREFIX,filename);
                   continue;
@@ -1175,26 +1175,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++;
diff -urN cfengine-2.0.a16/src/prototypes.h 
cfengine-2.0.a16.new/src/prototypes.h
--- cfengine-2.0.a16/src/prototypes.h   Fri Jan 11 16:56:10 2002
+++ cfengine-2.0.a16.new/src/prototypes.h       Fri Feb  1 12:01:50 2002
@@ -209,7 +209,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]