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

Re: Bug#45852: colortail: colortail can't read /etc/clortail or $HOME/.colortail



On Fri, Oct 01, 1999 at 07:53:46AM +0100, Edward Betts wrote:

> This is a problem, the maintainer moved from C to C++ and lost my
> /etc/colortail patch in the process. I will look into it, but I do not know
> C++ very well, whether somebody else could help, or possibly adopt the
> package?

You should really learn C++ - I just noticed that I did not use it often
enough. I really know the language but what I don't know are the libraries.
With some info commands I got the following patch:

--- colortail-0.3.0.orig/OptionsParser.cc	Thu Aug  5 01:23:39 1999
+++ colortail-0.3.0/OptionsParser.cc	Sat Oct  2 10:49:50 1999
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "OptionsParser.h"
 #include "Info.h"
@@ -232,6 +233,43 @@
       }
    }
    
+   // Debian modification: Check for $HOME/.colortail and /etc/colortail 
+   // if no config file was given on the command line.
+
+   if( o->color != 0 && o->nr_cfg_files == 0 )
+   {
+      // Use the default configuration only if color is wanted and there
+      // was no config file given.
+
+      const char	*home = getenv("HOME");
+      if( home ) {
+         ostrstream	filename;
+	 // Let's look into the home directory first
+
+	 filename << home << '/' << ".colortail" << '\0';
+	 if( access(filename.str(), R_OK) == 0 )
+	 {
+	    o->cfg_filenames[o->nr_cfg_files++] = filename.str();
+	    o->global_cfg_file = 1;
+	 } else
+	    filename.freeze(0);
+      }
+	
+      if( o->nr_cfg_files == 0 ) {
+         ostrstream	filename;
+	 // Still nothing found
+
+         filename << "/etc/colortail" << '\0';
+
+   	 if( access(filename.str(), R_OK) == 0 )
+	 {
+	    o->cfg_filenames[o->nr_cfg_files++] = filename.str();
+	    o->global_cfg_file = 1;
+	 } else
+	    filename.freeze(0);
+      }
+   }
+
    return o;
 }
 
Hope this helps. As I often heard that the patches did not come through, 
you can also get this patch at 

	http://pclab.ifg.uni-kiel.de/~torsten/colortail.diff

Hope this helps

	Torsten Landschoff for the Debian QA Group


Reply to: