🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #967

Bug in patch10, term.c?

#967
From: 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
Technical Details
Message-ID: <11407@spool.cs.wisc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!mcsun!uunet!cs.utexas.edu!uwm.edu!uwvax!veronica.cs.wisc.edu!elliott

Show Full Headers
Complete Article Headers
Message-ID: <11407@spool.cs.wisc.edu>
Subject: Bug in patch10, term.c?
Date: Thu, 04 Oct 1990 00:16:51 +0000
From: elliott@veronica.cs.wisc.edu (James Elliott)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!mcsun!uunet!cs.utexas.edu!uwm.edu!uwvax!veronica.cs.wisc.edu!elliott
Newsgroups: news.software.nn
Summary: Addition of BATCH_CHECK to term.c breaks some compiles
Keywords: BATCH_CHECK
Sender: news@spool.cs.wisc.edu
Lines: 56
Posted: Thu Oct 4 01:16:51 1990