--- tua-4.3.orig/configure
+++ tua-4.3/configure
@@ -2882,7 +2882,7 @@
       fi
 
       # We need to process the intl/ and po/ directory.
-      INTLSUB=intl
+#      INTLSUB=intl
       POSUB=po
     else
       DATADIRNAME=share
@@ -2928,7 +2928,7 @@
      fi
    fi
 
-            test -d intl || mkdir intl
+#            test -d intl || mkdir intl
    if test "$CATOBJEXT" = ".cat"; then
      ac_safe=`echo "linux/version.h" | tr './\055' '___'`
 echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
--- tua-4.3.orig/lib/tua_run
+++ tua-4.3/lib/tua_run
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+
+if [ -f /etc/tua.conf ]; then
+  . /etc/tua.conf
+fi
+
+# default options
+[ $OPTIONS ] || OPTIONS="--update-history --archived-logs"
+
+exec /usr/sbin/tua $OPTIONS "$*" | mail -s "TUA daily report" uucp
+
--- tua-4.3.orig/lib/TUA.pcd
+++ tua-4.3/lib/TUA.pcd
@@ -8,8 +8,12 @@
 # Overlapping slots will be detected and ignored by TUA. There will be a message
 # printed on stderr that shows exactly the location of the slots.
 #
-# PLEASE, forward to me (lele@eclipse.it) any new country you insert. 
 #
+##############################################################################
+# I know this file is outdated. If you have updated rates, please open
+# a bug against the package with the correct data for your country.
+# (The debian package maintainer.  -- md@linux.it)
+##############################################################################
 
 # DEFAULT COUNTRY:
 # This statement defines the default country, i.e. the country that will
--- tua-4.3.orig/src/compat.c
+++ tua-4.3/src/compat.c
@@ -22,7 +22,9 @@
 
 #include "tua.h"
 
-#if !HAVE_STDLIB_H
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#else
 extern PTR EXFUN (malloc, (size_t size));
 extern void EXFUN (free, (PTR ptr));
 #endif
--- tua-4.3.orig/src/customize.h
+++ tua-4.3/src/customize.h
@@ -26,7 +26,7 @@
  * Do not define anything for Xenix boxes
  * This is a constant to specify the maximum length of a pathname.
  */
-#define LPNMAX 128	/* For all the other but Xenix */
+#define LPNMAX 1024	/* For all the other but Xenix */
 
 /*
  * HDB-Uucp CORRECTION FACTOR:
@@ -49,6 +49,7 @@
  * FQDN (Fully Qualified Domain Name) then it will be ignored.
  */
 #define NET_DOMAIN	".sublink.org"
+#undef NET_DOMAIN
 
 /*
  * PCD  Pathname:
@@ -56,7 +57,7 @@
  * the phone costs.
  * LIBDIR is defined in the Makefile.
  */
-#define PCD_FILENAME LIBDIR "/TUA.pcd"
+#define PCD_FILENAME LIBDIR "/tua.pcd"
 
 #if TAYLOR_UUCP && HDB_UUCP
 #define BOTH_OF_THEM 1
@@ -74,7 +75,7 @@
  *
  */
 #if TAYLOR_UUCP
-#define DEFAULT_TAYLOR_SPOOL_DIR	"/usr/local/spool/uucp"
+#define DEFAULT_TAYLOR_SPOOL_DIR	"/var/log/uucp"
 #endif
 
 #if HDB_UUCP
--- tua-4.3.orig/src/tua.h
+++ tua-4.3/src/tua.h
@@ -83,7 +83,10 @@
 #include "trees.h"
 #include "debug.h"
 
+/*
 #include "libgettext.h"
+*/
+#include "libintl.h"
 #define _(str) gettext(str)
 
 typedef unsigned char BOOLEAN;
@@ -270,6 +273,7 @@
 
 /* CMO: Use the Uucp Logs under this directory */
 extern char *logs_prefix_path_opt;
+extern int archived_logs_opt;
 
 /* Name of the host where TUA is running */
 extern char SystemName[];
@@ -446,7 +450,7 @@
 extern PTR EXFUN (xmalloc, (size_t size));
 extern void EXFUN (xfree, (PTR ptr));
 
-#if HAVE_STDLIB_H
+#if STDC_HEADERS
 #include <stdlib.h>
 #else
 extern
@@ -460,7 +464,7 @@
 extern int EXFUN (parse_pcd_file, (CONST char * pathname));
      
 #if HAVE_FUNCTION_MACRO
-#define LOG(fmt, arg)	fprintf(stderr, "TUA (" __FUNCTION__ "): " fmt "\n", arg)
+#define LOG(fmt, arg)	fprintf(stderr, "TUA (%s): " fmt "\n", __func__, arg)
 #else
 
 #ifdef __STDC__
--- tua-4.3.orig/src/tua.c
+++ tua-4.3/src/tua.c
@@ -76,6 +76,7 @@
 
 static int do_system_report_opt = TRUE;
 static int do_user_report_opt = TRUE;
+int archived_logs_opt = FALSE;
 static int do_daily_report_opt = TRUE;
 static int save_history_opt = FALSE;
 static int do_history_report = TRUE;
@@ -135,6 +136,7 @@
   {"only-system", 1, 0, 'O'},					/* -O */
   {"port-alias", 1, 0, 'r'},					/* -r */
   {"prefix-path", 1, 0, 'p'},					/* -p */
+  {"archived-logs", 0, &archived_logs_opt, 1},
   {"print-country", 0, &print_country_and_exit, 1},
 #if USE_TCL
   {"rc-file", 1, 0, 'T'},					/* -T */
@@ -192,7 +194,7 @@
 }
 
 static char VersionFormatString[] =
-"The Uucp Analyzer (TUA) rel. %s by lele@nautilus.eclipse.it (Lele Gaifax)\n";
+"The Uucp Analyzer (TUA) rel. %s by lele@seldati.it (Lele Gaifax)\n";
 static char CopyleftInfo[] =
 "TUA may be copied only under the terms of the GNU General Public License,\n\
 a copy of which can be found with the TUA distribution package\n";
@@ -224,6 +226,7 @@
 -H, --update-history		Update the history file\n\
 -0, --reset-history		Reset the history file\n\
 -p, --prefix-path=DIR		Read log files in directory DIR\n\
+    --archived-logs		Read .../Log.0 and .../Stats.0\
 -z, --chart-size=SIZE		Set the size of the hourly chart to SIZE rows\n", stderr);
   fputs ("\
 -o, --chart-only		Print only the hourly activity chart\n", stderr);
@@ -280,7 +283,7 @@
     --print-country             Print the country configuration and exit\n\
     --list-countries            List the countries in the PCD file and exit\n\n\
 	Please report bugs and problems to:\n\
-		lele@eclipse.it\n\n", stderr);
+		lele@seldati.it\n\n", stderr);
   fputs (CopyleftInfo, stderr);
 }
 
@@ -289,8 +292,10 @@
        int argc AND
        char *argv[])
 {
+#ifndef STDC_HEADERS
   extern int EXFUN (atoi, (char *));
   extern double EXFUN (atof, (char *));
+#endif
   extern char *optarg;
   extern int opterr;
   int opt;
@@ -580,6 +585,7 @@
     strcpy (name, _("UNKNOWN"));
 #endif
 
+#ifdef NET_DOMAIN
   /* if gethostname doesn't return a Fully Qualified Domain Name */
   if (strchr (name, '.') == 0)
     {
@@ -597,6 +603,7 @@
 	    strcat (name, domain);
 	  }
     }
+#endif
 }
 
 int
@@ -734,17 +741,19 @@
   Since = savestring (julian_to_asc (StatStartingTime));
   
   DaysSinceLastClean = (int)(StatEndingTime - StatStartingTime)+1;
-  printf (_("%s UUCP Analysis for ``%s'',\n  since %s to %s (%d day(s))\n\n"),
 #if BOTH_OF_THEM
-	  (is_taylor_uucp ? "Taylor" : "HoneyDanBer"),
+#define TYPE_PRINT	  (is_taylor_uucp ? "Taylor" : "HoneyDanBer"),
 #else
 #if TAYLOR_UUCP
-	  "Taylor",
+#define TYPE_PRINT	  "Taylor",
 #else /* !TAYLOR_UUCP */
-	  "HoneyDanBer",
+#define TYPE_PRINT	  "HoneyDanBer",
 #endif /* TAYLOR_UUCP */
 #endif /* BOTH_OF_THEM */
+  printf (_("%s UUCP Analysis for ``%s'',\n  since %s to %s (%d day(s))\n\n"),
+	TYPE_PRINT
 	  SystemName, Since, julian_to_asc (StatEndingTime), DaysSinceLastClean);
+#undef TYPE_PRINT
   
 #if USE_TCL
   if (interactive_session_opt)
@@ -763,18 +772,20 @@
     }
   else
     {
-      printf (_("%s UUCP Analysis for ``%s''\n\n"),
 #if TAYLOR_UUCP
 #if HDB_UUCP
-	  (is_taylor_uucp ? "Taylor" : "HoneyDanBer"),
+#define TYPE_PRINT	  (is_taylor_uucp ? "Taylor" : "HoneyDanBer"),
 #else
-	  "Taylor",
+#define TYPE_PRINT	  "Taylor",
 #endif /* HDB_UUCP */
 
 #else /* !TAYLOR_UUCP */
-	  "HoneyDanBer",
+#define TYPE_PRINT	  "HoneyDanBer",
 #endif /* TAYLOR_UUCP */	  
+      printf (_("%s UUCP Analysis for ``%s''\n\n"),
+		TYPE_PRINT
 	      SystemName);
+#undef TYPE_PRINT
       hourly_activity_charts ();
     }
 
--- tua-4.3.orig/src/pcdl_gram.y
+++ tua-4.3/src/pcdl_gram.y
@@ -40,7 +40,7 @@
 
 %union {
   int ival;
-  float fval;
+  double fval;
   char * string;
   pcdl_slots * slots;
 }
@@ -49,6 +49,7 @@
 %token <ival> PCKW_INT
 %token <string> PCKW_STRING
 %token <ival> PCKW_DAY
+%token <fval> PCKW_FLOAT
 %token PCKW_RATE
 %token PCKW_NAME
 %token PCKW_DEFAULT
@@ -172,7 +173,7 @@
 
     if (names)
       {
-        names->cost_per_unit = (float) $4;
+        names->cost_per_unit = (double) $4;
         names->seconds_per_unit = $6;
         names->call_cost = 0.0;
       }
@@ -187,28 +188,22 @@
 
     if (names)
       {
-        names->cost_per_unit = (float) $6;
+        names->cost_per_unit = (double) $6;
         names->seconds_per_unit = $8;
-        names->call_cost = (float) $4;
+        names->call_cost = (double) $4;
       }
   }    
 		  ;
 
 
-float_number	: PCKW_INT
-		  {
-    $$ = (float) $1;
-  }
-		| PCKW_INT '.' PCKW_INT
-		  {
-    extern double EXFUN(atof, (char *));
-    char buffer[50];
-
-    sprintf (buffer, "%d.%d", $1, $3);
-    $$ = atof (buffer);
+float_number    : PCKW_INT
+                  {
+    $$ = (double) $1;
   }
+                | PCKW_FLOAT
 		  ;
 
+
 /* sunday = <day_block>;
  * or
  * monday-friday = <day_block>; */		  
@@ -397,9 +392,22 @@
 
   if (isdigit (c))
     {
+      double int_part;
+
       ungetc (c, pcd_file);
-      fscanf (pcd_file, "%d", &yylval.ival);
-      return PCKW_INT;
+      fscanf (pcd_file, "%lf", &yylval.fval);
+
+      modf (yylval.fval, &int_part);
+
+      if (yylval.fval == int_part)
+	{
+	  yylval.ival = int_part;
+	  return PCKW_INT;
+	}
+      else
+	{
+	  return PCKW_FLOAT;
+	}
     }
 
   if (isalpha (c))
--- tua-4.3.orig/src/Makefile.in
+++ tua-4.3/src/Makefile.in
@@ -70,14 +70,14 @@
 INCLUDES = -I$(srcdir) -I.. -I../intl -I$(top_srcdir)/intl
 
 OBJECTS = @ALLOCA@ @SUPPORT_OBJECTS@ \
-	commtree.o compat.o daytree.o debug.o getopt.o julian.o \
+	commtree.o compat.o daytree.o debug.o julian.o \
 	pcdl.o pcdl_gram.o phonesw.o portalias.o porttree.o process.o \
 	prochist.o reports.o sysalias.o systree.o tmparse.o trees.o \
 	tua.o useralias.o usertree.o
 
 HEADERS = ansidecl.h customize.h debug.h pcdl.h trees.h tua.h
 SOURCES = commtree.c compat.c  daytree.c \
-	debug.c	 getopt.c getopt.h globalias.h julian.c alloca.c \
+	debug.c	globalias.h julian.c alloca.c \
 	pcdl.c  pcdl_gram.y pcdl_gram.c phonesw.c \
 	portalias.c porttree.c process.c prochist.c \
 	globalias.c readl_supp.c reports.c sysalias.c systree.c tcl_supp.c \
@@ -85,7 +85,7 @@
 
 DISTFILES = ChangeLog Makefile.in $(HEADERS) $(SOURCES)
 
-SUBDIRS = hdb taylor lib
+SUBDIRS = taylor lib #hdb
 
 default: all
 
@@ -156,7 +156,7 @@
 
 distclean: distclean-recursive distclean-local
 distclean-local: clean-local
-	rm -f Makefile TAGS
+	rm -f Makefile TAGS pcdl_gram.c
 
 maintainer-clean: maintainer-clean-recursive maintainer-clean-local
 maintainer-clean-local: distclean-local
--- tua-4.3.orig/src/ChangeLog
+++ tua-4.3/src/ChangeLog
@@ -1,3 +1,10 @@
+2003-04-02  Mark Brown  <broonie@sirena.org.uk>
+
+	* pcdl_gram.y: Add new token type PCKW_FLOAT and lex floating
+	point numbers directly.  Adjust float_number to use this rather
+	than combining two ints to avoid loss of leading zeros.  For
+	convenience work with doubles.
+
 Tue Feb 13 11:06:48 1996  Lele Gaifax  <lele@nautilus.eclipse.it>
 
 	* pcdl.c (pcdl_print_country): Print names as letters instead of
--- tua-4.3.orig/src/reports.c
+++ tua-4.3/src/reports.c
@@ -377,7 +377,7 @@
 	{
 	  printf (_("\tLast connection: %s\n"), julian_to_asc (system->LastConnection));
 	  
-	  printf (_("\tThere have been %u call(s) (with an average of %.1f Ok/day):\n\t\t\t\t\t"),
+	  printf (_("\tThere have been %u call(s) (with an average of %.1f OK/day):\n\t\t\t\t\t"),
 		  system->Calls,
 		  ((float) system->CallsOK / (float) DaysSinceLastClean));
 	  if (system->CallsOK)
--- tua-4.3.orig/src/taylor/procstats.c
+++ tua-4.3/src/taylor/procstats.c
@@ -42,7 +42,8 @@
     fputs ("\nProcessing Stats:\n", stderr);
 #endif
   
-  sprintf (FileName, "%s/%s", logs_prefix_path_opt, STATS_NAME);
+  sprintf (FileName, "%s/%s%s", logs_prefix_path_opt, STATS_NAME,
+	  archived_logs_opt ? ".1": "");
 
   if ((fp = fopen (FileName, "r")) == (FILE *) NULL)
     {
--- tua-4.3.orig/src/taylor/log.c
+++ tua-4.3/src/taylor/log.c
@@ -48,7 +48,9 @@
   
   if (line[0] != 'u' || line[1] != 'u')
     {
-      debug_printf ("skipping continued line '%15.15s...'", line);
+#if 0
+  	debug_printf ("skipping continued line '%15.15s...'", line);
+#endif
       goto read_line;
     }
 
--- tua-4.3.orig/src/taylor/proclog.c
+++ tua-4.3/src/taylor/proclog.c
@@ -60,7 +60,8 @@
     fputs ("\nProcessing Log:\n", stderr);
 #endif
   
-  sprintf (FileName, "%s/%s", logs_prefix_path_opt, LOG_NAME);
+  sprintf (FileName, "%s/%s%s", logs_prefix_path_opt, LOG_NAME,
+	  archived_logs_opt ? ".1": "");
 
   if ((fp = fopen (FileName, "r")) == (FILE *) NULL)
     {
--- tua-4.3.orig/doc/tua.man
+++ tua-4.3/doc/tua.man
@@ -56,7 +56,7 @@
 .ds L' `
 .ds R' '
 'br\}
-.TH TUA 1L "16 November 1991" "Release 3.4" "LOCAL USER COMMANDS"
+.TH TUA 8L "16 November 1991" "Release 3.4" "LOCAL USER COMMANDS"
 .SH NAME
 TUA \- The Uucp Analyzer
 .SH SYNOPSIS
--- tua-4.3.orig/doc/Makefile.in
+++ tua-4.3/doc/Makefile.in
@@ -69,7 +69,7 @@
 	rluser.texinfo tua.1l tua.info tua.man tua.texinfo \
 	wildmat.3 
 
-all: tua.1l tua.info tua.dvi
+all: tua.1l tua.info #tua.dvi
 
 install: install-exec install-data
 install-exec:
--- tua-4.3.orig/doc/tua.texinfo
+++ tua-4.3/doc/tua.texinfo
@@ -5,6 +5,10 @@
 @syncodeindex fn cp
 @paragraphindent 2
 @c %**end of header
+@dircategory Networking tools
+@direntry TUA
+* TUA: (tua).              UUCP traffic reporting and analysis
+@end direntry
 
 @ifinfo
 This file documents @sc{tua}, The Uucp Analyzer, a tool that analyze the BNU
@@ -553,7 +557,7 @@
                   4:07:32.35 ( 16.4%,  99680 Lit) in Evening Time
                  17:58:02.47 ( 71.6%, 349635 Lit) in Night Time
         Last connection: 13 Jul 1993 - 15:53:01
-        There have been 168 calls (with an average of 2 Ok/day):
+        There have been 168 calls (with an average of 2 OK/day):
                                         139 OK ( 34 IN, 105 OUT,   7 STOPPED)
                                          22 FAILED
 @end example
--- tua-4.3.orig/po/it.po
+++ tua-4.3/po/it.po
@@ -93,7 +93,7 @@
 
 #: src/pcdl.c:124 src/pcdl.c:134
 msgid "{ rate %d, %s at line %d } and "
-msgstr "{ costo %d, %s alla linea %d } e \n"
+msgstr "{ costo %d, %s alla linea %d } e "
 
 #: src/pcdl.c:126 src/pcdl.c:136
 msgid "{ rate %d, %s at line %d }\n"
@@ -272,7 +272,7 @@
 
 #: src/reports.c:380
 msgid ""
-"\tThere have been %u call(s) (with an average of %.1f Ok/day):\n"
+"\tThere have been %u call(s) (with an average of %.1f OK/day):\n"
 "\t\t\t\t\t"
 msgstr ""
 "\tCi sono state %u chiamate (con una media di %.1f Ok/giorno):\n"
--- tua-4.3.orig/po/Makefile.in.in
+++ tua-4.3/po/Makefile.in.in
@@ -198,7 +198,7 @@
 	for cat in $$catalogs; do \
 	  lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
 	  mv $$lang.po $$lang.old.po; \
-	  if $(TUPDATE) $(PACKAGE).pot $$lang.old.po > $$lang.po; then \
+	  if msgmerge $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
 	    rm -f $$lang.old.po; \
 	  else \
 	    echo "tupdate for $$cat failed!"; \
