diff -Naur squidGuard-1.3.orig/src/sgDb.c squidGuard-1.3/src/sgDb.c
--- squidGuard-1.3.orig/src/sgDb.c	2007-11-03 14:59:49.000000000 +0100
+++ squidGuard-1.3/src/sgDb.c	2007-11-17 22:56:07.000000000 +0100
@@ -1,10 +1,12 @@
 /*
   By accepting this notice, you agree to be bound by the following
   agreements:
- 
-  This software product, squidGuard, is copyrighted (C) 1998-2007
-  by Christine Kronberg, Shalla Secure Services. All rights reserved.
-
+  
+  This software product, squidGuard, is copyrighted (C) 1998 by
+  ElTele Øst AS, Oslo, Norway, with all rights reserved.
+  With December 27th 2006 all rights moved to Christine Kronberg,
+  Shalla Secure Services.
+  
   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License (version 2) as
   published by the Free Software Foundation.  It is distributed in the
@@ -287,29 +289,75 @@
   return result;
 }
 
+static int stdoutisatty;
+
+#if __STDC__
+void startProgressBar()
+#else
+void startProgressBar()
+#endif
+{
+  stdoutisatty = isatty(STDOUT_FILENO);
+
+  if(1 == stdoutisatty)
+  {
+    /* do nothing */
+  }
+  else
+  {
+    printf("    [");
+    fflush(stdout);
+  }
+  return;
+}
+
 #if __STDC__
-void drawProgressBar(float prog)
+void finishProgressBar()
 #else
-void drawProgressBar(prog)
+void finishProgressBar()
+#endif
+{
+  if(1 == stdoutisatty)
+  {
+    printf("\n");
+  }
+  else
+  {
+    printf("] 100 %% done\n");
+  }
+  fflush(stdout);
+  return;
+}
+
+#if __STDC__
+void updateProgressBar(float prog)
+#else
+void updateProgressBar(prog)
 	float prog;
 #endif
 {
-  int j,k=0;
-  k = (int)(prog * 50.0);
-  printf("    [");
-  for(j=0; j<50; j++)
+  if(1 == stdoutisatty)
   {
-    if(j <= k)
+    int j,k=0;
+    k = (int)(prog * 50.0);
+    printf("\r");fflush(stdout);
+    printf("    [");
+    for(j=0; j<50; j++)
+    {
+      if(j <= k)
         printf("=");
-    else
+      else
         printf(" ");
+    }
+    printf("] %d %% done", (int)(prog*100.0));fflush(stdout);
   }
-  printf("] %d %% done", (int)(prog*100.0));fflush(stdout);
-  for(j=0; j<1000000; j++) {/*slow down to make progress bar more obvious*/}
-  printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");fflush(stdout);
-  printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");fflush(stdout);
-  printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");fflush(stdout);
-  printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");fflush(stdout);
+  else
+  {
+    if(((int)(prog*100.0) % 100) == 0)
+      printf(".");fflush(stdout);
+  }
+
+  return;
 }
 
 #if __STDC__
@@ -340,13 +388,14 @@
 
   fstat(fileno(fp), &fpst);
   fpsz = fpst.st_size;
+  startProgressBar();
   
   memset(&Db->key, 0, sizeof(DBT));
   memset(&Db->data, 0, sizeof(DBT));
   while(fgets(line, sizeof(line), fp) != NULL){
 
     lnsz += strlen(line);
-    drawProgressBar((float)lnsz/(float)fpsz);
+    updateProgressBar((float)lnsz/(float)fpsz);
     
     if(*line == '#')
       continue;
@@ -418,7 +467,7 @@
   if(update){
     sgLogError("update: added %d entries, deleted %d entries",entries,deleted);
   }
-  printf("\n");
+  finishProgressBar();
   Db->entries = entries;
   fclose(fp);
 }

