/* 
** PACS-WLL 2000 project, Prepaid System.
** 
** The module Copyright (C) 2000-2001 interWAVE Inc.
** 
** Written completely by Zhang Shuzhong at iCRD January, 2001
**
** module name: signal.c
** CVS $Id: signal.c,v 1.2 2001/01/11 04:07:56 zhangsz Exp $
**
** Signal functions
**
*/

#include     "./include/iptrans.h"

/*
** Set termination signal in a loop program, 
** handler of function mostly deal with something,
** e.g. closing file handler, socket handler or free allocatied memory.
*/
/*@ignore@*/
void
SetTermSignal(struct termio *ptermio, void (*handler)(int))
{
    ioctl(0, TCGETA, ptermio);
    ptermio->c_cc[VINTR] = '\x03';
    ioctl(0, TCSETA, ptermio);

    signal(SIGINT, handler);
    signal(SIGTERM, handler);
}
/*@end@*/
