To simplify the other patches, I kept out all the whitespace and comment 
changes that I wanted to make to code I wasn't modifying.  The changes here are 
pretty essential, they line up the code with `Burgess-C-Style' as well as I 
understand it from reading elseware.  By essential, I mean that there were a 
few code problems that resulted from misalignment, like having 
ProcessPendingPackages happen inside the for loop, which wasn't apparently from 
the spacing.

Note: this is by no means an extensive effort to clean up the code!  This was 
just in the functions I was editing in this patchset: quite a lot of package.c, 
and the packaging-related functions in do.c.  I want to make an effort down the 
road to try and build an option-set for `indent' (see INDENT(1)) that mimics 
emacsstyle.txt.  Clean code is easier to work on :-).

Index: cfengine-trunk/src/do.c
===================================================================
--- cfengine-trunk.orig/src/do.c
+++ cfengine-trunk/src/do.c
@@ -2752,13 +2752,13 @@ for (ptr = VPKG; ptr != NULL; ptr=ptr->n
       }
 
    snprintf(lock,CF_BUFSIZE-1,"%s_%d_%d",ptr->name,ptr->cmp,ptr->action);
-   
+
    if 
(!GetLock(ASUniqueName("packages"),CanonifyName(lock),ptr->ifelapsed,ptr->expireafter,VUQNAME,CFSTARTTIME))
       {
       ptr->done = 'y';
       continue;
       }
-   
+
    match = PackageCheck(ptr->name, ptr->pkgmgr, ptr->ver, ptr->cmp);
    Verbose("Match status for %s is %u\n", ptr->name, match );
 
@@ -2774,7 +2774,7 @@ for (ptr = VPKG; ptr != NULL; ptr=ptr->n
    if (match)
       {
       AddMultipleClasses(ptr->defines);
-      if (ptr->action == pkgaction_remove) 
+      if (ptr->action == pkgaction_remove)
          {
          if (ptr->pkgmgr == pkgmgr_portage && (ptr->ver)[0])
             {
@@ -2845,7 +2845,7 @@ for (ptr = VPKG; ptr != NULL; ptr=ptr->n
             }
          }
       }
- 
+
    ptr->done = 'y';
    ReleaseCurrentLock();
    if( ptr->action != pkgaction_none )
@@ -2853,15 +2853,19 @@ for (ptr = VPKG; ptr != NULL; ptr=ptr->n
       prev_action = ptr->action;
       prev_pkgmgr = ptr->pkgmgr;
       }
+
+   }
+
+if(pending_pkgs != NULL)
+   {
+   ProcessPendingPackages(prev_pkgmgr, prev_action, &pending_pkgs);
+   DeleteItemList( pending_pkgs );
    }
 
-   if(pending_pkgs != NULL)
-      {
-      ProcessPendingPackages(prev_pkgmgr, prev_action, &pending_pkgs);
-      DeleteItemList( pending_pkgs );
-      }
 }
 
+/*******************************************************************/
+
 void ProcessPendingPackages (enum pkgmgrs pkgmgr, enum pkgactions action, 
struct Item **pending_pkgs)
 {
    switch(action)
@@ -2875,7 +2879,7 @@ void ProcessPendingPackages (enum pkgmgr
       default:
          snprintf(OUTPUT,CF_BUFSIZE,"Internal error!  Tried to process package 
with an unknown action: %d.  This should never happen!\n", action);
          CfLog(cferror,OUTPUT,"");
-         break; 
+         break;
       }
 }
 
Index: cfengine-trunk/src/package.c
===================================================================
--- cfengine-trunk.orig/src/package.c
+++ cfengine-trunk/src/package.c
@@ -146,10 +146,10 @@ switch(pkgmgr)
       /* UGH!  This should *never* happen.  GetPkgMgr() and
        * InstallPackagesItem() should have caught this before it
        * was ever installed!!!
-       * */
-       snprintf(OUTPUT,CF_BUFSIZE,"Internal error!  Tried to check package %s 
in an unknown database: %d.  This should never happen!\n", package, pkgmgr);
-       CfLog(cferror,OUTPUT,"");
-       break;
+       */
+      snprintf(OUTPUT,CF_BUFSIZE,"Internal error!  Tried to check package %s 
in an unknown database: %d.  This should never happen!\n", package, pkgmgr);
+      CfLog(cferror,OUTPUT,"");
+      break;
    }
 return match;
 }
@@ -157,12 +157,12 @@ return match;
 
/*********************************************************************************/
 int InstallPackage(enum pkgmgrs pkgmgr, struct Item **pkglist)
 
-{ char rawinstcmd[CF_BUFSIZE];
- /* Make the instcmd twice the normal buffer size since the package list
-    limit is CF_BUFSIZE so this can obviously get larger! */
- char instcmd[CF_BUFSIZE*2];
- char line[CF_BUFSIZE];
- FILE *pp;
+{  char rawinstcmd[CF_BUFSIZE];
+   /* Make the instcmd twice the normal buffer size since the package list
+    * limit is CF_BUFSIZE so this can obviously get larger! */
+   char instcmd[CF_BUFSIZE*2];
+   char line[CF_BUFSIZE];
+   FILE *pp;
    int result = 0;
 
 /* Determine the command to use for the install. */
@@ -178,8 +178,8 @@ switch(pkgmgr)
           }
        strncpy(rawinstcmd, 
GetMacroValue(CONTEXTID,"RPMInstallCommand"),CF_BUFSIZE);
        break;
-       
-       /* Debian */
+
+   /* Debian */
    case pkgmgr_dpkg:
 
        if (!GetMacroValue(CONTEXTID,"DPKGInstallCommand"))
@@ -189,8 +189,8 @@ switch(pkgmgr)
           }
        strncpy(rawinstcmd, 
GetMacroValue(CONTEXTID,"DPKGInstallCommand"),CF_BUFSIZE);
        break;
-       
-       /* Solaris */
+
+   /* Solaris */
    case pkgmgr_sun:
 
        if (!GetMacroValue(CONTEXTID,"SUNInstallCommand"))
@@ -200,8 +200,8 @@ switch(pkgmgr)
           }
        strncpy(rawinstcmd, 
GetMacroValue(CONTEXTID,"SUNInstallCommand"),CF_BUFSIZE);
        break;
-       
-       /* AIX */
+
+   /* AIX */
    case pkgmgr_aix:
        if (!GetMacroValue(CONTEXTID,"AIXInstallCommand"))
           {
@@ -209,12 +209,11 @@ switch(pkgmgr)
           return 0;
           }
        strncpy(rawinstcmd, 
GetMacroValue(CONTEXTID,"AIXInstallCommand"),CF_BUFSIZE);
-       
        break;
 
-       /* Portage */
+   /* Portage */
    case pkgmgr_portage:
-       
+
        if (!GetMacroValue(CONTEXTID,"PortageInstallCommand"))
           {
           Verbose("PortageInstallCommand NOT Set.  Package Installation Not 
Possible!\n");
@@ -222,10 +221,10 @@ switch(pkgmgr)
           }
        strncpy(rawinstcmd, 
GetMacroValue(CONTEXTID,"PortageInstallCommand"),CF_BUFSIZE);
        break;
-       
+
    /* FreeBSD */
    case pkgmgr_freebsd:
-       
+
       if (!GetMacroValue(CONTEXTID,"FreeBSDInstallCommand"))
          {
          Verbose("FreeBSDInstallCommand NOT Set.  Package Installation Not 
Possible!\n");
@@ -233,80 +232,82 @@ switch(pkgmgr)
          }
       strncpy(rawinstcmd, 
GetMacroValue(CONTEXTID,"FreeBSDInstallCommand"),CF_BUFSIZE);
       break;
-       
-       /* Default */
+
+   /* Default */
    default:
        Verbose("InstallPackage(): Unknown package manager %d\n",pkgmgr);
        break;
    }
 
-   /* Common to all pkg managers */
-   if( BuildCommandLine( instcmd, rawinstcmd, *pkglist ) )
+/* Common to all pkg managers */
+if( BuildCommandLine( instcmd, rawinstcmd, *pkglist ) )
+   {
+   Verbose("InstallPackage(): using '%s'\n", instcmd);
+   if (DONTDO)
       {
-      Verbose("InstallPackage(): using '%s'\n", instcmd);
-      if (DONTDO)
+      Verbose("--skipping because DONTDO is enabled.\n");
+      result = 1;
+      }
+   else
+      {
+      if ((pp = cfpopen(instcmd, "r")) == NULL)
          {
-         Verbose("--skipping because DONTDO is enabled.\n");
-         result = 1;
+         Verbose("Could not execute package install command\n");
+         /* Return that the package is still not installed */
+         return 0;
          }
-      else 
+
+      while (!feof(pp))
          {
-         if ((pp = cfpopen(instcmd, "r")) == NULL)
-            {
-            Verbose("Could not execute package install command\n");
-            /* Return that the package is still not installed */
-            return 0;
-            }
-         
-         while (!feof(pp))
-            {
-            ReadLine(line,CF_BUFSIZE-1,pp);
-            snprintf(OUTPUT,CF_BUFSIZE,"Package install: %s\n",line);
-            CfLog(cfinform,OUTPUT,""); 
-            }
-         
-         if (cfpclose(pp) != 0)
-            {
-            Verbose("Package install command was not successful\n");
-            result = 0;
-            }
-         else
-            {
-            result = 1;
-            }
+         ReadLine(line,CF_BUFSIZE-1,pp);
+         snprintf(OUTPUT,CF_BUFSIZE,"Package install: %s\n",line);
+         CfLog(cfinform,OUTPUT,"");
          }
-      }
-      else 
-      {
-         Verbose("Unable to build package manager command.\n");
+
+      if (cfpclose(pp) != 0)
+         {
+         Verbose("Package install command was not successful\n");
          result = 0;
+         }
+      else
+         {
+         result = 1;
+         }
       }
-   return result;
+   }
+else
+   {
+      Verbose("Unable to build package manager command.\n");
+      result = 0;
+   }
+return result;
+
 }
 
 int UpgradePackage(char *name, enum pkgmgrs pkgmgr, char* version, enum 
cmpsense cmp)
-{
-   struct Item *removelist = NULL;
+{  struct Item *removelist = NULL;
    struct Item *addlist = NULL;
    int result = 0;
 
-   Verbose("Package upgrade for %s: %s\n", PKGMGRTEXT[pkgmgr], name );
+Verbose("Package upgrade for %s: %s\n", PKGMGRTEXT[pkgmgr], name );
 
-   PackageList(name, pkgmgr, version, cmp, &removelist);
+PackageList(name, pkgmgr, version, cmp, &removelist);
+
+if( RemovePackage( pkgmgr, &removelist ) )
+  {
+  AppendItem(&addlist, name, NULL);
+  result = InstallPackage( pkgmgr, &addlist );
+  }
+else
+  {
+  Verbose("Package %s cannot be upgraded because the old version was not 
removed.\n", name );
+  result = 0;
+  }
+
+DeleteItemList(removelist);
+DeleteItemList(addlist);
+return result;
 
-   if( RemovePackage( pkgmgr, &removelist ) )
-      {
-      AppendItem(&addlist, name, NULL);
-      result = InstallPackage( pkgmgr, &addlist );
-      }
-   else
-      {
-      Verbose("Package %s cannot be upgraded because the old version was not 
removed.\n", name );
-      result = 0;
-      }
-   DeleteItemList(removelist);
-   DeleteItemList(addlist);
-   return result;
 }
 
 int RemovePackage(enum pkgmgrs pkgmgr, struct Item **pkglist)
@@ -316,90 +317,90 @@ int RemovePackage(enum pkgmgrs pkgmgr, s
    FILE *pp;
    int result = 0;
 
-   if (pkglist == NULL)
+if (pkglist == NULL)
+   {
+   Verbose("No packages to remove.\n");
+   return 0;
+   }
+
+/* Determine the command to use for the removal. */
+switch(pkgmgr)
+   {
+   /* FreeBSD */
+   case pkgmgr_freebsd:
+      if (!GetMacroValue(CONTEXTID,"FreeBSDRemoveCommand"))
+         {
+             strncpy(rawdelcmd, "/usr/sbin/pkg_delete %s", 23 );
+         }
+      else
+         {
+         strncpy(rawdelcmd, 
GetMacroValue(CONTEXTID,"FreeBSDRemoveCommand"),CF_BUFSIZE);
+         }
+      break;
+
+   /* Portage */
+   case pkgmgr_portage:
+      if (!GetMacroValue(CONTEXTID,"PortageRemoveCommand"))
+         {
+            strncpy(rawdelcmd, "/usr/bin/emerge -C %s", 21 );
+         }
+      else
+         {
+         strncpy(rawdelcmd, 
GetMacroValue(CONTEXTID,"PortageRemoveCommand"),CF_BUFSIZE);
+         }
+      break;
+
+   /* Default */
+   default:
+      Verbose("Package removal not yet implemented for this package manager.");
+      break;
+   }
+
+if( BuildCommandLine( delcmd, rawdelcmd, *pkglist ) )
+   {
+   Verbose("RemovePackage(): using '%s'\n", delcmd);
+   if (DONTDO)
       {
-      Verbose("No packages to remove.\n");
-      return 0;
+      Verbose("--skipping because DONTDO is enabled.\n");
+      result = 1;
       }
-
-   /* Determine the command to use for the removal. */
-   switch(pkgmgr)
+   else
       {
-      /* FreeBSD */
-      case pkgmgr_freebsd:
-         if (!GetMacroValue(CONTEXTID,"FreeBSDRemoveCommand"))
-            {
-               strncpy(rawdelcmd, "/usr/sbin/pkg_delete %s", 23 );
-            }
-         else
-            {
-            strncpy(rawdelcmd, 
GetMacroValue(CONTEXTID,"FreeBSDRemoveCommand"),CF_BUFSIZE);
-            }
-         break;
-       
-      /* Portage */
-      case pkgmgr_portage:
-         if (!GetMacroValue(CONTEXTID,"PortageRemoveCommand"))
-            {
-               strncpy(rawdelcmd, "/usr/bin/emerge -C %s", 21 );
-            }
-         else
-            {
-            strncpy(rawdelcmd, 
GetMacroValue(CONTEXTID,"PortageRemoveCommand"),CF_BUFSIZE);
-            }
-         break;
+      if ((pp = cfpopen(delcmd, "r")) == NULL)
+         {
+         Verbose("Could not execute package removal command\n");
+         /* Return that the package is still not removed */
+         return 0;
+         }
 
-      /* Default */
-      default:
-         Verbose("Package removal not yet implemented for this package 
manager.");
-         break;
-      }
+      while (!feof(pp))
+         {
+         ReadLine(line,CF_BUFSIZE-1,pp);
+         snprintf(OUTPUT,CF_BUFSIZE,"Package removal: %s\n",line);
+         }
 
-   if( BuildCommandLine( delcmd, rawdelcmd, *pkglist ) )
-      {
-      Verbose("RemovePackage(): using '%s'\n", delcmd);
-      if (DONTDO)
+      if (cfpclose(pp) != 0)
          {
-         Verbose("--skipping because DONTDO is enabled.\n");
-         result = 1;
+         Verbose("Package removal command was not successful\n");
+         result = 0;
          }
-      else 
+      else
          {
-         if ((pp = cfpopen(delcmd, "r")) == NULL)
-            {
-            Verbose("Could not execute package removal command\n");
-            /* Return that the package is still not removed */
-            return 0;
-            }
-            
-         while (!feof(pp))
-            {
-            ReadLine(line,CF_BUFSIZE-1,pp);
-            snprintf(OUTPUT,CF_BUFSIZE,"Package removal: %s\n",line);
-            }
-            
-         if (cfpclose(pp) != 0)
-            {
-            Verbose("Package removal command was not successful\n");
-            result = 0;
-            }
-         else
-            {
-            result = 1;
-            }
+         result = 1;
          }
       }
-   else 
-      {
-      Verbose("Unable to evaluate package manager command.\n");
-      result = 0;
-      }
-   return result;
+   }
+else
+   {
+   Verbose("Unable to evaluate package manager command.\n");
+   result = 0;
+   }
+return result;
+
 }
 
-int BuildCommandLine(char *resolvedcmd, char *rawcmd, struct Item *pkglist )   
-{ 
-   struct Item *package;
+int BuildCommandLine(char *resolvedcmd, char *rawcmd, struct Item *pkglist )
+{  struct Item *package;
    char *cmd_tail;
    FILE *pp;
    char *ptr, *cmd_ptr;
@@ -407,15 +408,15 @@ int BuildCommandLine(char *resolvedcmd, 
    int cmd_tail_len = 0;
    int original_len;
 
-    /* How many words are there in the package manager invocation? */
+   /* How many words are there in the package manager invocation? */
    for (ptr = rawcmd, cmd_args = 1; NULL != ptr; ptr = strchr(++ptr, ' '))
       {
       ++cmd_args;
       }
 
    /* This could probably be a bit more complete, but I don't think
-   that anyone would want to expand the package name more than
-   once in a single command invocation anyhow. */
+      that anyone would want to expand the package name more than
+      once in a single command invocation anyhow. */
    if (cmd_tail = strstr(rawcmd, "%s"))
       {
       *cmd_tail = '\0';
@@ -423,20 +424,20 @@ int BuildCommandLine(char *resolvedcmd, 
       cmd_tail_len = strlen(cmd_tail);
       --cmd_args;
       }
-   
+
    /* Copy the initial part of the install command */
    strncpy(resolvedcmd, rawcmd, CF_BUFSIZE*2);
-   
+
    snprintf(OUTPUT,CF_BUFSIZE,"Package manager will be invoked as %s\n", 
resolvedcmd);
    CfLog(cfinform,OUTPUT,"");
-   
+
    if ((pp = cfpopen(resolvedcmd, "r")) == NULL)
       {
       Verbose("Could not execute package manager\n");
       /* Return that the package is still not installed */
       return 0;
       }
-   
+
    /* Iterator through package list until we reach the maximum number that 
cfpopen can take */
    original_len = strlen(resolvedcmd);
    cmd_ptr = &resolvedcmd[original_len];
@@ -453,7 +454,7 @@ int BuildCommandLine(char *resolvedcmd, 
    *--cmd_ptr = '\0';
 
    if (cmd_ptr != &resolvedcmd[original_len])
-      {      
+      {
       /* Have a full command line, so append the tail if necessary. */
       if (cmd_tail_len > 0)
          {
@@ -462,13 +463,13 @@ int BuildCommandLine(char *resolvedcmd, 
       }
    return 1;
 }
-      
-/*********************************************************************/
-/* RPM */
-/* returns: 1 - found a match
+
+/*********************************************************************
+ * RPM
+ * returns: 1 - found a match
  *          0 - found no match
- */
-/*********************************************************************/
+ *
+ *********************************************************************/
 
 int RPMPackageCheck(char *package,char *version,enum cmpsense cmp)
 
@@ -496,58 +497,55 @@ else
    }
 
 if ((pp = cfpopen(VBUFF, "r")) == NULL)
-  {
-  Verbose("Could not execute the RPM command.  Assuming package not 
installed.\n");
-  return 0;
-  }
+   {
+   Verbose("Could not execute the RPM command.  Assuming package not 
installed.\n");
+   return 0;
+   }
 
- while(!feof(pp))
-    {
-    *VBUFF = '\0';
+while(!feof(pp))
+   {
+   *VBUFF = '\0';
 
-    ReadLine(VBUFF,CF_BUFSIZE,pp);
+   ReadLine(VBUFF,CF_BUFSIZE,pp);
+
+   if (*VBUFF != '\0')
+      {
+      AppendItem(&evrlist,VBUFF,"");
+      }
+   }
 
-    if (*VBUFF != '\0')
-       {
-       AppendItem(&evrlist,VBUFF,"");
-       }
-    }
- 
 /* Non-zero exit status means that we could not find the package, so
- * Zero the list and bail. */
+ * zero the list and bail. */
+if (cfpclose(pp) != 0)
+   {
+   DeleteItemList(evrlist);
+   evrlist = NULL;
+   }
 
- if (cfpclose(pp) != 0)
-    {
-    DeleteItemList(evrlist);
-    evrlist = NULL;
-    }
- 
- if (evrlist == NULL)
-    {
-    Verbose("RPM Package %s not installed.\n", package);
-    return 0;
-    }
- 
+if (evrlist == NULL)
+   {
+   Verbose("RPM Package %s not installed.\n", package);
+   return 0;
+   }
 
 Verbose("RPMCheckPackage(): Requested %s %s %s\n", package, 
CMPSENSETEXT[cmp],(version[0] ? version : "ANY"));
 
 /* If no version was specified, just return 1, because if we got this far
  * some package by that name exists. */
-
 if (!version[0])
-  {
-  DeleteItemList(evrlist);
-  return 1;
-  }
+   {
+   DeleteItemList(evrlist);
+   return 1;
+   }
 
 /* Parse the EVR we are looking for once at the start */
- 
+
 ParseEVR(version, &eB, &vB, &rB);
 
 /* The rule here will be: if any package in the list matches, then the
  * first one to match wins, and we bail out. */
 
- for (evr = evrlist; evr != NULL; evr=evr->next)
+for (evr = evrlist; evr != NULL; evr=evr->next)
    {
    char *evrstart;
    evrstart = evr->name;
@@ -563,11 +561,11 @@ ParseEVR(version, &eB, &vB, &rB);
     */
 
    if (!strncmp(evrstart, "(none)", strlen("(none)")))
-     {
-     /* We have no EVR in the installed package.  Fudge it. */
-     evrstart = strchr(evrstart, ':') - 1;
-     *evrstart = '0';
-     }
+      {
+      /* We have no EVR in the installed package.  Fudge it. */
+      evrstart = strchr(evrstart, ':') - 1;
+      *evrstart = '0';
+      }
 
    Verbose("RPMCheckPackage(): Trying installed version %s\n", evrstart);
    ParseEVR(evrstart, &eA, &vA, &rA);
@@ -576,21 +574,21 @@ ParseEVR(version, &eB, &vB, &rB);
    epochA = atol(eA);   /* The above code makes sure we always have this. */
 
    if (eB && *eB) /* the B side is what the user entered.  Better check. */
-     {
-     epochB = atol(eB);
-     }
+      {
+      epochB = atol(eB);
+      }
 
    /* First try the epoch. */
 
    if (epochA > epochB)
-     {
-     result = cmpsense_gt;
-     }
+      {
+      result = cmpsense_gt;
+      }
 
    if (epochA < epochB)
-     {
-     result = cmpsense_lt;
-     }
+      {
+      result = cmpsense_lt;
+      }
 
    /* If that did not decide it, try version.  We must *always* have
     * a version string.  That's just the way it is.*/
@@ -623,7 +621,7 @@ ParseEVR(version, &eB, &vB, &rB);
       }
 
    Verbose("Comparison result: %s\n",CMPSENSETEXT[result]);
-   
+
    switch(cmp)
       {
       case cmpsense_gt:
@@ -645,17 +643,17 @@ ParseEVR(version, &eB, &vB, &rB);
           match = (result != cmpsense_eq);
           break;
       }
-   
+
    /* If we find a match, just return it now, and don't bother checking
     * anything else RPM returned, if it returns multiple packages */
-   
+
    if (match)
       {
       DeleteItemList(evrlist);
       return 1;
       }
    }
- 
+
 /* If we manage to make it out of the loop, we did not find a match. */
 
 DeleteItemList(evrlist);
@@ -664,7 +662,7 @@ return 0;
 
 int RPMPackageList (char *package, char *version, enum cmpsense cmp, struct 
Item **pkglist)
 {
-   return 0; /* not implemented yet */
+return 0; /* not implemented yet */
 }
 
 /*********************************************************************/
@@ -674,13 +672,13 @@ int RPMPackageList (char *package, char 
 int DPKGPackageCheck(char *package,char *version,enum cmpsense cmp)
 
 { FILE *pp;
- struct Item *evrlist = NULL;
- struct Item *evr;
- char *evrstart;
- enum cmpsense result;
- int match = 0;
- char tmpBUFF[CF_BUFSIZE];
- 
+  struct Item *evrlist = NULL;
+  struct Item *evr;
+  char *evrstart;
+  enum cmpsense result;
+  int match = 0;
+  char tmpBUFF[CF_BUFSIZE];
+
 Verbose ("Package: ");
 Verbose (package);
 Verbose ("\n");
@@ -786,7 +784,7 @@ if (strncmp (version, "(none)", strlen (
 /* check if installed version is gt version */
 
 snprintf (VBUFF, CF_BUFSIZE, "/usr/bin/dpkg --compare-versions %s gt %s", 
evrstart, version);
-  
+
 if ((pp = cfpopen (VBUFF, "r")) == NULL)
    {
    Verbose ("Could not execute DPKG-command.\n");
@@ -804,7 +802,7 @@ while (!feof (pp))
 if (cfpclose (pp) == 0)
    {
    result = cmpsense_gt;
-   }    
+   }
 
 /* check if installed version is lt version */
 snprintf (VBUFF, CF_BUFSIZE, "/usr/bin/dpkg --compare-versions %s lt %s", 
evrstart, version);
@@ -827,10 +825,10 @@ while (!feof (pp))
 if (cfpclose (pp) == 0)
    {
    result = cmpsense_lt;
-   }    
-  
+   }
+
 Verbose ("Comparison result: %s\n", CMPSENSETEXT[result]);
-  
+
 switch (cmp)
    {
    case cmpsense_gt:
@@ -860,7 +858,7 @@ if (match)
    }
 
 /* RB 24.03.06: Why do we need an extra blank line here?: ugly
- * 
+ *
  * Verbose("\n");
  */
 
@@ -971,12 +969,12 @@ for (evr = evrlist; evr != NULL; evr=evr
    {
    char *evrstart;
    evrstart = evr->name;
-   
+
    /* Start out assuming the comparison will be equal. */
    result = cmpsense_eq;
-   
+
    ParseSUNVR(evrstart, &majorA, &minorA, &microA);
-   
+
    /* Compare the major versions. */
    if(majorA > majorB)
       {
@@ -999,7 +997,7 @@ for (evr = evrlist; evr != NULL; evr=evr
          {
          result = cmpsense_lt;
          }
-      
+
       /* If the minor versions match, compare the micro versions. */
 
       if(result == cmpsense_eq)
@@ -1014,7 +1012,7 @@ for (evr = evrlist; evr != NULL; evr=evr
             }
          }
       }
-   
+
    switch(cmp)
       {
       case cmpsense_gt:
@@ -1055,12 +1053,12 @@ int SUNPackageList (char *package, char 
    return 0; /* not implemented yet */
 }
 
-/*********************************************************************/
-/* Sun's manual pages say that the version number is a major, minor,
+/*********************************************************************
+ * Sun's manual pages say that the version number is a major, minor,
  * and optional micro version number.  This code checks for that.
  * It will not handle other arbitrary and strange values people might
  * put in like "2.6d.12a" or "1.11 beta" or "pre-release 7"
-/*********************************************************************/
+ *********************************************************************/
 
 void ParseSUNVR (char * vr, int *major, int *minor, int *micro)
 {
@@ -1109,21 +1107,21 @@ void ParseSUNVR (char * vr, int *major, 
 /*********************************************************************/
 int AIXPackageCheck(char *package,char *version,enum cmpsense cmp)
 { FILE *pp;
-struct Item *evrlist = NULL;
-struct Item *evr;
-char *evrstart;
-enum cmpsense result;
-int match = 0;
-char tmpBUFF[CF_BUFSIZE];
-char *vs, *ve;
-int verA = 0;
-int verB = 0;
-int releaseA = 0;
-int releaseB = 0;
-int maintA = 0;
-int maintB = 0;
-int fixA = 0;
-int fixB = 0;
+  struct Item *evrlist = NULL;
+  struct Item *evr;
+  char *evrstart;
+  enum cmpsense result;
+  int match = 0;
+  char tmpBUFF[CF_BUFSIZE];
+  char *vs, *ve;
+  int verA = 0;
+  int verB = 0;
+  int releaseA = 0;
+  int releaseB = 0;
+  int maintA = 0;
+  int maintB = 0;
+  int fixA = 0;
+  int fixB = 0;
 
 Verbose ("Package: ");
 Verbose (package);
@@ -1203,71 +1201,66 @@ ParseAIXVR(version, &verB, &releaseB, &m
 
 for (evr = evrlist; evr != NULL; evr=evr->next)
    {
-     char *evrstart;
-     evrstart = evr->name;
+   char *evrstart;
+   evrstart = evr->name;
 
-     /* Start out assuming the comparison will be equal. */
-     result = cmpsense_eq;
+   /* Start out assuming the comparison will be equal. */
+   result = cmpsense_eq;
      
-     ParseAIXVR(evrstart, &verA, &releaseA, &maintA, &fixA);
-
-     /* Compare the major versions. */
-     if(verA > verB)
-        {
-        result = cmpsense_gt;
-        }
-     if(verA < verB)
-        {
-        result = cmpsense_lt;
-        }
+   ParseAIXVR(evrstart, &verA, &releaseA, &maintA, &fixA);
 
-     /* If the major versions are teh same, check the release */
-
-     if(result == cmpsense_eq)
-        {
-        if(releaseA > releaseB)
-           {
-           result = cmpsense_gt;
-           }
-        if(releaseA < releaseB)
-           {
-           result = cmpsense_lt;
-           }
+   /* Compare the major versions. */
+   if(verA > verB)
+      {
+      result = cmpsense_gt;
+      }
+   if(verA < verB)
+      {
+      result = cmpsense_lt;
+      }
 
-     /* If the releases match, compare the maint version */
+   /* If the major versions are the same, check the release */
+   if(result == cmpsense_eq)
+      {
+      if(releaseA > releaseB)
+         {
+         result = cmpsense_gt;
+         }
+      if(releaseA < releaseB)
+         {
+         result = cmpsense_lt;
+         }
 
-        if(result == cmpsense_eq)
-           {
+      /* If the releases match, compare the maint version */
+      if(result == cmpsense_eq)
+         {
+         if(maintA > maintB)
+            {
+            result = cmpsense_gt;
+            }
+         if(maintA < maintB)
+            {
+            result = cmpsense_lt;
+            }
 
-           if(maintA > maintB)
-              {
-              result = cmpsense_gt;
-              }
-           if(maintA < maintB)
-              {
-              result = cmpsense_lt;
-              }
-
-     /* If the maint versions match, compare the fix level */
-
-           if(result == cmpsense_eq)
-              {
-
-           if(fixA > fixB)
-              {
-              result = cmpsense_gt;
-              }
-           if(fixA < fixB)
-              {
-              result = cmpsense_lt;
-              }
-           }
-        }
-     }
+         /* If the maint versions match, compare the fix level */
+         if(result == cmpsense_eq)
+            {
+            if(fixA > fixB)
+               {
+               result = cmpsense_gt;
+               }
+            if(fixA < fixB)
+               {
+               result = cmpsense_lt;
+               }
+            }
+         }
+      }
 
    switch(cmp)
-     {
-           case cmpsense_gt:
+      {
+      case cmpsense_gt:
           match = (result == cmpsense_gt);
           break;
       case cmpsense_ge:
@@ -1285,7 +1278,7 @@ for (evr = evrlist; evr != NULL; evr=evr
       case cmpsense_ne:
           match = (result != cmpsense_eq);
           break;
-     } 
+      }
 
    /* If we find a match, skip checking the rest, and return this one. */
    if (match)
@@ -1304,14 +1297,14 @@ int AIXPackageList(char *package, char *
    return 0; /* not implemented yet */
 }
 
-/*********************************************************************/
-/* AIX docs describe the version as:
+/*********************************************************************
+ * AIX docs describe the version as:
  * Version.Release.Maintenance/Modification.Fix (V.R.M.F).  
  * any non digits [0-9] in these fields will be ignored and only the 
  * numeric digits will be extracted.  standalone non-digits will be 
  * treated as 0 for the entire field.  V.R.M.F shouldn't contain any 
  * non numeric data (this is enforced by IBM tools like mkinstallp)
-/*********************************************************************/
+ *********************************************************************/
 
 void ParseAIXVR(char * vr, int *ver, int *release, int *maint, int *fix)
 {

--
Eric Searcy
OSU Open Source Lab

_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to