🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
1 messages
1 total messages Started by James Elliott Thu, 04 Oct 1990 00:16
Bug in patch10, term.c?
#967
Author: James Elliott
Date: Thu, 04 Oct 1990 00:16
56 lines
2150 bytes
I just installed patches 5 through 10 of nn6.4 and was again amazed at how
well documented, organized and automated the package is. I did run into one
small snag, which I was easily able to fix, however. In the file term.c, in
patch10, a call to BATCH_CHECK is added at the beginning of the routine
flush_input(). The patched routine is:

flush_input()
    BATCH_CHECK;

#ifdef HAVE_TERMIO
    ioctl(0, TCFLSH, 0);
    do_flush_input = 1;
#else
#ifdef FREAD
    int arg = FREAD;
    ioctl(0, TIOCFLUSH, &arg);
#else
    ioctl(0, TIOCFLUSH, 0);
#endif
#endif
}

The problem occurs when HAVE_TERMIO is not defined, but FREAD is; the
declaration of arg is a syntax error, since BATCH_CHECK has already
generated code. To fix this, I moved things around some. Here's my modified
version of the routine:

flush_input()
{
#ifndef HAVE_TERMIO
#ifdef FREAD
    int arg = FREAD;
#endif
#endif

    BATCH_CHECK;

#ifdef HAVE_TERMIO
    ioctl(0, TCFLSH, 0);
    do_flush_input = 1;
#else
#ifdef FREAD
    ioctl(0, TIOCFLUSH, &arg);
#else
    ioctl(0, TIOCFLUSH, 0);
#endif
#endif
}

This seems to work fine, and capture the intent of the subroutine. Did I
miss something? I'm surprised I haven't heard about this problem from
elsewhere. Of course, I haven't been reading this group for long. I apologize
if this has all already been resolved.
--
Jim Elliott		      "Like a bridge he'll come between us, not a wall"
elliott@veronica.cs.wisc.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads