/* Deal with any received signals. This includes ctrl-C to stop the program.  */
static void sig_int(int signo)
/* Deal with any received signals. This includes ctrl-C to stop the program.  */
static void sig_int(int signo)
{
    (void) signo;
    if (FD_pipe != -1) 
    {
        printf("\nClosing pipe.\n");
        close(FD_pipe);
    }
    if (FD_com != -1)
    {
        printf("\nClosing serial port.\n");
        close(FD_com);
    }
    printf("\nSignal captured and devices shut down.\n");
    exit(0);
}