=== modified file 'tools/purge/conffile.cc'
--- tools/purge/conffile.cc	2012-10-04 11:10:17 +0000
+++ tools/purge/conffile.cc	2012-10-24 17:07:06 +0000
@@ -45,6 +45,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <fstream>
 
 int
 readConfigFile( CacheDirVector& cachedir, const char* fn, FILE* debug )
@@ -58,8 +59,8 @@
 
     // try to open file
     if ( debug ) fprintf( debug, "# trying to open %s\n", fn ? fn : "(null)" );
-    FILE* in = fopen( fn, "r" );
-    if ( in == NULL ) {
+    std::ifstream cfgin(fn);
+    if ( !cfgin.good() ) {
         fprintf( stderr, "fopen %s: %s\n", fn, strerror(errno) );
         return -1;
     }
@@ -81,7 +82,7 @@
     regmatch_t subs[8];
     char *s, line[1024];
     CacheDir cd;
-    while ( fgets( line, sizeof(line), in ) ) {
+    while ( cfgin.getline( line, sizeof(line)) ) {
         // FIXME: overly long lines
 
         // terminate line at start of comment
@@ -99,7 +100,7 @@
                 fprintf( stderr, "while matching \"%s\" against %s%s\n",
                          expression, line, buffer );
                 regfree(&rexp);
-                fclose(in);
+                cfgin.close();
                 return -1;
             }
         } else {
@@ -176,7 +177,7 @@
         }
     }
 
-    fclose(in);
+    cfgin.close();
     regfree(&rexp);
     return cachedir.size();
 }

