[comp.unix.i386] Building News 2.11.19 on 386/ix

dmocsny@uceng.UC.EDU (daniel mocsny) (12/14/89)

Hello again.

I'm trying to build News 2.11.19 under 386/ix 2.0.2 and I'm hitting a
funny little glitch in the program virtterm.c. Looks like the
parameter TIOCGWINSZ is #define'd in 386/ix's
/usr/include/sys/termio.h (#include'd in virtterm.c). This causes
conditional compilation of a code fragment around line 838 where the
declaration:

struct winsize ws;

appears. Cc barfs there with an "unknown size" error because (I guess)
it can't seem to find the declaration of winsize in any #included
files (which are: stdio.h, ctype.h, sys/types.h, sys/ioctl.h,
signal.h, and termio.h (which itself #include's sys/termio.h)). The
compiler then complains about some undefined variables ws_row and
ws_col which are components of winsize.

I grep'ed around /usr/include and its subdirectories, as well as
the /usr/lib/*.a files (with nm) and the only place I found another
mention of winsize was in /usr/include/sys/jioctl.h which has
the line:

struct jwinsize winsize

nested inside another struct, in the midst ofsome sinister-looking
code I don't want to try to figure out. The winsize struct doesn't
appear in any of the other News sources, near as I can grep.

So then, now that I have botched things up again, I appeal to
the towering intellects of the net. I think my localize.sh looks
pretty good, but what do I know. Somebody he'p me...

Questions:

1. Is TIOCGWINSZ supposed to get #define'd? If not, then what
parameter do I change to stop it?

2. If TIOCGWINSZ is supposed to get #define'd, then how come
cc doesn't find winsize anywhere? Is it off hiding in some obscure
.a or .h file where I don't see it?

Dan Mocsny
dmocsny@uceng.uc.edu

jackv@turnkey.gryphon.COM (Jack F. Vogel) (12/15/89)

In article <3136@uceng.UC.EDU> dmocsny@uceng.UC.EDU (daniel mocsny) writes:
 
[...  initial description deleted...]
 
>1. Is TIOCGWINSZ supposed to get #define'd? If not, then what
>parameter do I change to stop it?
 
Yes, your problem can be resolved in 2 steps: first make sure you have
the streams package installed, second #include <sys/ptem.h> that is
where the structure is defined.

Good Luck!

--
Jack F. Vogel			jackv@seas.ucla.edu
AIX Technical Support	              - or -
Locus Computing Corp.		jackv@ifs.umich.edu

mark@gizzmo.UUCP (mark hilliard) (12/20/89)

In article <3136@uceng.UC.EDU> dmocsny@uceng.UC.EDU (daniel mocsny) writes:
>Hello again.
>
>I'm trying to build News 2.11.19 under 386/ix 2.0.2 and I'm hitting a
>funny little glitch in the program virtterm.c. Looks like the

Here is a collection of news stuff for Interactive.  I dont know where
it all came from now, but I had the same problem as you and the net
responded:

Look about line 821, in function initterm().  Mine now reads:

	register char	*cp;
#ifdef USG
#undef TIOCGWINSZ			/* patch for 386/ix */
	struct termio	tio;
#else /* !USG */

Of course if you have changable window sizes you'll need a different fix.

--marc
-- 
// Marco S. Hyman
// ...!hoptoad!hsfmsh!dumbcat!marc

Subject: Re: Help with Interactive and news
In-Reply-To: <2069@kodak.UUCP>
>
>"virtterm.c", line 838: unknown size
>"virtterm.c", line 843: ws_row undefined
>"virtterm.c", line 843: member of structure or union required
>"virtterm.c", line 844: ws_col undefined
>"virtterm.c", line 844: member of structure or union required
>"virtterm.c", line 980: unknown siz*** Error code 1
>"virtterm.c", line 985: ws_row undefined
>"virtterm.c", line 985: member of structure or union required
>"virtterm.c", line 986: ws_col undefined
>"virtterm.c", line 986: member of structure or union required

Heh, you and me both. The problem is that the news source thinks that
if TIOCGWINSZ is defined, which it is in /usr/include/sys/termio.h, then
winsize (see virtterm.c line 838) is also defined, which it is NOT. It
IS defined in (I think) /usr/include/sys/ptem.h, which only exists if
you've got Streams installed. (Sorry to be verbose, but I've been 
fighting this since Saturday.) ANYWAY, what *I* did to get it to compile
was, at the top of virtterm.c, add the line #undef TIOCGWINSZ right
after the #ifdef USG. This got me through the compile, at least....
Good luck.
					--Al Evans--
---
Al Evans    {tntdev,texbell,ssbn}!inebriae!al
            al@inebriae.WLK.COM

Subject: Problems with rn


>ngdata.c: 132: extra tokens (ignored) after directive
>ngdata.c: 141: extra tokens (ignored) after directive
>ngdata.c: 168: extra tokens (ignored) after directive
>ngdata.c: 177: extra tokens (ignored) after directive
>"ngdata.c", line 187: syntax error
>"ngdata.c", line 194: dirp undefined
>"ngdata.c", line 197: warning: illegal pointer/integer combination, op =
>
>Stop.

The "extra tokens" messages are probably for the #defines used
to declare the types of the functions in ngdata.c.  Look them
up; they're in common.h.  So is the definition of `Null', which
may be causing the problem on line 197.  The errors on 187 and
194 are probably because undefined macros (ART_NUM) were used
on immediately-preceding lines.

Run ngdata.c through the C preprocessor by hand and see how
the interesting lines are expanded.
-- 

	Chuck Karish		karish@mindcraft.com
	(415) 493-9000		karish@forel.stanford.edu


Subject: Re: how about RN and Interactive?

-
-ngdata.c: 132: extra tokens (ignored) after directive
-ngdata.c: 141: extra tokens (ignored) after directive
-ngdata.c: 168: extra tokens (ignored) after directive
-ngdata.c: 177: extra tokens (ignored) after directive

	These are caused by comments after preprocessor directives such
as #else #endif, etc...

-"ngdata.c", line 187: syntax error

        You have a syntax error, probably related to a incorrect choice
in the configuration script..

-"ngdata.c", line 194: dirp undefined

	This is a problem with the directory access routines, such that
the structure dirp ( which, if I remember correctly, is a pointer to a
directory entry structure ) is undefined.   It is probably related to
the syntax error above.

-"ngdata.c", line 197: warning: illegal pointer/integer combination, op =

	This is probably caused by a call to signal to reset the default
signal handlers...

-Stop.
-
-If you can make any sence of this please help shed some light on it.

	Hope some of this is of use,
		Eric

--
Eric Schnoebelen
egsner!eric@texbell.swbt.com	now playing:	eric@egsner.cirr.com

Subject: Re: how about RN and Interactive?

: "ngdata.c", line 187: syntax error
: "ngdata.c", line 194: dirp undefined
: "ngdata.c", line 197: warning: illegal pointer/integer combination, op =
: 
I'll assume you're not a programmer.  Anyway, at the top of ngdata.c, after the
lines:
	#include "EXTERN.h"
	#include "common.h"

The next line is 
	#include "ndir.h"

Change it to:
	#include <dirent.h>
	#define direct dirent

You will also need to do this to "util.c", and make sure to NOT link with
rn's ndir.c.  What's happening is that rn wants to use a "struct direct",
but System V's <sys/dir.h> doesn't define what rn expects to see there.
Instead, this change makes it use the POSIX-standard "struct dirent" (notice
slight name change -- 'n' instead of 'c') and puts the header file as
<dirent.h>.  The '#define direct dirent' makes it so you don't need to edit
any other code.

Hope this helps,
  ---Jonathan Broome

  jon@wilbur.uucp  -or-  jonathan@ism780c.isc.com

Subject: Re: Help with Interactive and news


David Raines posted the following to the net a while back-------

I got the source for bnews-2.11 from UUNET.  Other than the standard
localize.sh changes for USG/SysV, the only thing that wouldn,t compile 
was virtterm.c.   Add the following includes:

	#include <sys/stream.h>
	#include <sys/ptem.h>

The 'winsize' structure is defined in ptem.h, which is dependent on stream.h.
Apparently this is a change from earlier versions.
-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+


Subject: Re: Help with Interactive and news

    
    David Raines posted the following to the net a while back-------
    
    I got the source for bnews-2.11 from UUNET.  Other than the standard
    localize.sh changes for USG/SysV, the only thing that wouldn,t compile 
    was virtterm.c.   Add the following includes:
    
    	#include <sys/stream.h>
    	#include <sys/ptem.h>
    
    The 'winsize' structure is defined in ptem.h, which is dependent on stream.h.
    Apparently this is a change from earlier versions.

Actually the better course is to do a '#undef TIOCGWINSZ'; on a stock 386/ix
the window size is fixed... Actually I don't like the idea of including into
user level programs headers, like <sys/stream.h>, that contain kernel level
declarations. AT&T ought to be less sloppy and surround the kernel only
parts of such headers with a nice #ifdef KERNEL. Name space pollution? No
thanks!
-- 
Piercarlo "Peter" Grandi           | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcvax!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk


Subject: Re: how about RN and Interactive?

+ngdata.c: 132: extra tokens (ignored) after directive
+ngdata.c: 141: extra tokens (ignored) after directive
+ngdata.c: 168: extra tokens (ignored) after directive
+ngdata.c: 177: extra tokens (ignored) after directive
+"ngdata.c", line 187: syntax error
+"ngdata.c", line 194: dirp undefined
+"ngdata.c", line 197: warning: illegal pointer/integer combination, op =


I ran into the same problem both on Sys V/386 and AIX PS/2: You have to
change the references to "struct direct" to "struct dirent" in the source
files ngdata.c and utils.c.

The problem arises because of System V's implementation of the directory
access library (opendir(), readdir(), etc., directory(3C) ). System V
"borrowed" these functions from BSD in preparation for the eventual move to
long file names. They gave the functions the same names as the Berkeley
counterparts, but the data structures aren't the same. "Configure" sees
the opendir()/readdir() functions and rightly decides to use them to
access directories. BUT, the rn code assumes that this is the BSD
implementation. The SysV equivalent of a "struct direct" in BSD is the
"struct dirent"; it's declared in /usr/include/sys/dirent.h (which is
included by /usr/include/dirent.h). The .h's will be picked up by
ndir.h in rn if you've done your Configure right. (At least it works
that way for SysV/386 3.2 and AIX PS/2.)

Oh, SysV couldn't call the new entry structure a "struct direct" because
of compatibility with existing SysV systems and code. In the old/current
SysV directory structure where a directory entry is an i-number + 14
characters, the old/current style of a directory entry is declared as
"struct direct" -- this goes back at least to V7. (See <sys/fs/s5dir.h>,
which is #included by <sys/dir.h>.)


John Rossmann		(uunet!synsys!john)


From atexnet!uunet!auspex!guy  Wed Aug 30 16:33:39 1989
Received: from kodak.UUCP by park.kp02.kodak.com (4.0/SMI-4.0)
	id AA01466; Wed, 30 Aug 89 16:36:41 EDT
Received: by kodak.UUCP (3.2/SMI-3.2)
	id AA21150; Wed, 30 Aug 89 16:36:09 EDT
Received: by atexnet.UUCP (smail2.5)
	id AA23032; 30 Aug 89 14:19:56 EDT (Wed)
Received: from auspex.UUCP by uunet.uu.net (5.61/1.14) with UUCP 
	id AA10882; Wed, 30 Aug 89 14:09:21 -0400
Received: by auspex.com (4.0/SMI-4.0)
	id AA02742; Wed, 30 Aug 89 11:08:43 PDT
Date: Wed, 30 Aug 89 11:08:43 PDT
From: uunet!auspex!guy (Guy Harris)
Message-Id: <8908301808.AA02742@auspex.com>
To: kodak!mark
Subject: Re: how about RN and Interactive?
Status: R

>ngdata.c: 132: extra tokens (ignored) after directive
>ngdata.c: 141: extra tokens (ignored) after directive
>ngdata.c: 168: extra tokens (ignored) after directive
>ngdata.c: 177: extra tokens (ignored) after directive

"rn" uses a C language construct that, while formerly not explicitly
prohibited, is now prohibited by ANSI C, namely sticking extra text at
the end of "#else" and "#endif", e.g. "#endif lint".  The S5R3 C
preprocessor prints a warning if it sees this; the "ignored" indicates
that it's cheerfully compiling the code, and warning you that other
compilers may not be so lenient.  You can ignore this error, or you can
make the code legal by changing

	#endif lint

to

	#endif /* lint */

>"ngdata.c", line 187: syntax error
>"ngdata.c", line 194: dirp undefined
>"ngdata.c", line 197: warning: illegal pointer/integer combination, op =

This looks as if "rn" isn't prepared for the notion of a non-BSD system
that has the directory library standard, but in POSIX rather than BSD
form.  S5R3 is such a system....

It would be nice if Larry Wall's "Configure" script could deal with this
automatically, but at least in the version of "rn" we have here, it
doesn't (and I don't know that it's been fixed since).  I presume he'll
fix it at some point.  Until then, try changing "ndir.h" by replacing

	#	include <sys/dir.h>

with

	#	include <dirent.h>
	#	define	direct	dirent

and then make sure that "config.h" defines neither LIBNDIR nor USENDIR,
and that "Makefile" doesn't cause "ndir.o" to be compiled and linked in.