/* <<< Start of information >>>                                       */
/* ------------------------------------------------------------------ */
/* This file is part of the xwatch program. Copyright (C) Karel Kubat */
/* 1995. All rights reserved. You are permitted to redistribute this  */
/* package, if you include all unmodified sources and all unmodified  */
/* documentation (including this text). You are NOT permitted to      */
/* distribute files of this package with modifications. See the file  */
/* COPYING for more information. When in doubt, mail me at            */
/* karel@icce.rug.nl.                                                 */
/* ------------------------------------------------------------------ */
/* <<< End of information >>>                                         */

#include "xwatch.h"

void alarmhandler (int sig)
{
    register int
	i;
    
    if (rescan)			        /* clear browser if necessary */
    {
	fl_clear_browser (browser);
	rescan_files ();
	rescan = 0;
    }
    else				/* or show contents */ 
    {
	for (i = 0; i < nfinfo; i++)
	    scanfile (i, 1);
    }

    /* remember only max lines */ 
    if (fl_get_browser_maxline (browser) > nlines)
    {
	fl_freeze_form (browser_form);
	do
	    fl_delete_browser_line (browser, 1);
	while (fl_get_browser_maxline (browser) > nlines);
	fl_unfreeze_form (browser_form);
    }

    /* reload scanning alarm */ 
    signal (SIGALRM, alarmhandler);
    alarm (interval);
}

