#!/usr/bin/perl
###############################################################################
#
# File:         watchlogs
# RCS:          $Header: $
# Description:  retrieve new logfile entries
# Author:       Christian Limpach <chris@nice.ch>
# Created:      Fri Apr  7 03:48:23 1995
# Modified:     Fri Apr  7 04:30:09 1995 (Christian Limpach) chris@nice.ch
# Language:     Perl
# Package:      N/A
# Status:       Experimental (Do Not Distribute)
#
# (C) Copyright 1995, Christian Limpach, all rights reserved.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see ftp://nice.ethz.ch/users/chris/TERMS
# for details. This software comes with ABSOLUTELY NO WARRANTY.
#
###############################################################################

require 'syslog.newlines.pl';

$timestamps="/home/chris/Unix/etc/watchlog-timestamps";

rename ($timestamps, $timestamps . ".old");
open(tin, "<$timestamps.old");
open(tout, ">$timestamps");
while (<tin>) {
    if (/^\#/) {
	print tout;
	next;
    }
    ($file, $time) = /^([^ ]+)\s+([-\d]*)$/;
    $time=syslog_newlines($file, $time);
    print tout "$file $time\n";
    print "$file $time\n";
}
close tin;
close tout;

    
