Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Visual Trek: Help on libs for SVR2?

7 views
Skip to first unread message

John R. Rosenberg

unread,
Sep 10, 1985, 11:50:35 AM9/10/85
to
Does anyone know what library to use as a replacement
for the -ltermlib option on the cc that loads
this game? SVR2 has no such library. Replacing
it with curses loads the modules, but the
program does not function properly. Any help
will be appreciated.

Thanks...

John Rosenberg AT&T NS
ihnp4!ihu1m!johnnyr

"Ramming speed, Mr. Sulu!"

Lord Kahless

unread,
Sep 11, 1985, 7:52:45 PM9/11/85
to
> Does anyone know what library to use as a replacement
> for the -ltermlib option on the cc that loads
> this game? SVR2 has no such library.
> John Rosenberg AT&T NS
> ihnp4!ihu1m!johnnyr

try changing the make file to -ltermcap. (It makes mille work.)

By the way, the factory version wouldn't work with a vt102 terminal
on our 4.2 system. I have a patch, if anybody else found the same
bug.

ucbvax!ucdavis!vega!ccrdave

Doug Anderson

unread,
Sep 12, 1985, 9:15:32 AM9/12/85
to

Thank God some one else is having the same problem I
am. I was beginning to think I was just screwed up or
somthing.

If anyone has the time to research this please post it
to the net.

Thanks

Doug Anderson

Doug Gwyn <gwyn>

unread,
Sep 12, 1985, 9:20:01 PM9/12/85
to
> > Does anyone know what library to use as a replacement
> > for the -ltermlib option on the cc that loads
> > this game? SVR2 has no such library.
> > John Rosenberg AT&T NS
> > ihnp4!ihu1m!johnnyr
>
> try changing the make file to -ltermcap. (It makes mille work.)

What -ltermcap?? Try -lcurses. Geez.

Eric Hestenes

unread,
Sep 15, 1985, 4:46:25 AM9/15/85
to
> > Does anyone know what library to use as a replacement
> > for the -ltermlib option on the cc that loads
> > this game? SVR2 has no such library.

where do these def'ns reside? I can't get a successful compile.


Undefined:
_sqrt
_atan2
_tan
_tgetent
_tgetstr
_tgoto

Eric Hestenes
arpanet: hest...@nprdc.ARPA
other: ucbvax!sdcsvax!sdcsla!hestenes or hest...@sdcsla.UUCP

Doug Anderson

unread,
Sep 17, 1985, 9:13:36 AM9/17/85
to

Curses doesn't work either. At least not on my 3B2.

Doug Anderson

Steven Spearman

unread,
Sep 18, 1985, 8:46:22 AM9/18/85
to
My understanding is that the 'termcap' routines are
only partially supported in SVR2 as a compatability mode
in curses. Users are expected to convert programs to
use curses instead since this support will go away in
future releases.

I guess this incompatability with the rest of the Unix
community is progress.

Steve Spearman ihnp4!ihopb!spear

Lord Kahless

unread,
Sep 18, 1985, 7:58:11 PM9/18/85
to
> > Does anyone know what library to use as a replacement
> > for the -ltermlib option on the cc that loads
> > this game? SVR2 has no such library. Replacing
> > it with curses loads the modules, but the
> > program does not function properly.
> > John Rosenberg AT&T NS
> > ihnp4!ihu1m!johnnyr

There are various problems w/ sys V vtrek.

1) The i/o sets you to RAW! Look in the termio module.

2) The way to make it compile w/o diagnostics (NOT run) is
to change termlib to termcap in the make file. Anybody who
can fix the tty stuff would have my thanks.

3) The afore mentioned term problems. I posted one fix, another
was posted.

ucbvax!ucdavis!vega!ccrdave

Guy Harris

unread,
Sep 19, 1985, 3:01:20 AM9/19/85
to
> > Does anyone know what library to use as a replacement
> > for the -ltermlib option on the cc that loads
> > this game? SVR2 has no such library. Replacing
> > it with curses loads the modules, but the
> > program does not function properly.

The problem is that Visual Trek uses the "termcap" library incorrectly (or,
at least, not in the way it's supposed to be used). The "curses"/"terminfo"
library has routines which emulate the behavior of the "tget..." routines
but only if you use them correctly.

The code in question (in excerpted form):

static char cm[20];

p = cm;
tgetstr("cm", &p);
p = cl;
tgetstr("cl", &p);
...

A more "correct" version would be

static char string[1024]; /* or however big it has to be */
static char *stringp = &string[0];
static char *cm;

cm = tgetstr("cm", &stringp);
cl = tgetstr("cl", &stringp);

The intent was that "tget<whatever>" would return the gotten
boolean/number/string. The pointer for "tgetstr" is merely to a buffer into
which the strings are to be dumped. The reason it works differently in
"curses"/"terminfo" is that "terminfo" reads the entire "terminfo" entry as
one big lump, and you then reference the capability strings directly from
that lump. The "tgetstr" routines merely return pointers into that lump;
they do not use the second argument in any way whatsoever.

Speaking of suspicious code:

gtty(0, &tty);
saveflags = tty.sg_flags;
tty.sg_flags |= RAW;
tty.sg_flags &= ~(ECHO | XTABS);
stty(0, &tty);

Programs should not use RAW mode unless they need an 8-bit data path to/from
the terminal (no parity, just 8 data bits) and no flow control. If the
program just wants to capture each character as it is typed, CBREAK mode is
just fine. You probably want to turn off CRMOD also (RAW mode disables all
output translations). The RAW should be CBREAK and the ECHO | XTABS should
probably include CRMOD (and maybe LCASE).

ioctl(0, TIOCGETP, &tty);
/* I consider "gtty" and "stty" to be deprecated */
saveflags = tty.sg_flags;
tty.sg_flags |= CBREAK;
tty.sg_flags &= ~(ECHO | XTABS | CRMOD | LCASE);
ioctl(0, TIOCSETP, &tty);

None of that will work right in System III or System V. Declare "tty" as a
"struct termio", declare "savetty" as "struct termio" also and throw out
"saveflags", and replace the code with

ioctl(0, TCGETA, &tty);
savetty = tty;
/*
* This assumes you want to turn off all output translations,
* which is very likely to be the case in any full-screen program.
*/
tty.c_oflag &= ~OPOST;
tty.c_lflag &= ~(ICANON | ECHO);
/* turning ICANON off is like turning CBREAK on */
ioctl(0, TCSETAW, &tty);

Note that in both these cases, the user's interrupt character will work
normally. This means that unless you want to disable the interrupt and quit
characters (for information on that, see below), you'll have to catch SIGINT
(and maybe SIGQUIT) and, if you get those signals, restore the modes, clear
the screen, and exit.

To disable the interrupt characters in V7 (and, hence, 4.xBSD):

struct tchars tc, savetc;

ioctl(0, TIOCGETC, &tc);
savetc = tc;
tc.t_intrc = '\377';
tc.t_quitc = '\377';
ioctl(0, TIOCSETC, &tc);

For S3/S5, just turn off the ISIG bit as well as the ICANON bit in
"c_lflags".

If you're running under 4.xBSD, you should also either

1) catch SIGTSTP and, when it is caught, reset the TTY modes, clear
the screen, reset the SIGTSTP handler if you're running under
4.2BSD, and send yourself a SIGTSTP with "kill"

or

2) disable the suspend and delayed-suspend characters as well.
To do this, look up the TIOCGLTC and TIOCSLTC "ioctl" calls in
TTY(4).

Moral - writing full-screen programs is more complicated than you probably
thought.

Guy Harris

Guy Harris

unread,
Sep 21, 1985, 5:59:27 PM9/21/85
to
> where do these def'ns reside? I can't get a successful compile.
> _sqrt
> _atan2
> _tan

The math library ("-lm").

> _tgetent
> _tgetstr
> _tgoto

On a system with the old "termcap" library, in the "termcap library"
("-ltermcap" or "-ltermlib"). On a system with the new "curses"/"terminfo"
library, in that library ("-lcurses") (although note that the code that uses
"tgetstr" uses it in a way that may be "correct", in that the documentation
doesn't explicitly say it's wrong, but won't work with the new library; see
earlier posting on this subject).

The Makefile posted with this game gives both "-lm" and "-ltermlib". Did
you use that Makefile or did you try compiling it on your own?

Guy Harris

Doug Gwyn <gwyn>

unread,
Sep 22, 1985, 12:10:55 AM9/22/85
to
> I guess this incompatability with the rest of the Unix
> community is progress.

Actually, it is. Termcap has severe problems that have been
fixed in terminfo. The (very few) primitive termlib routines
were closely tied to the termcap database structure, so they
do not all have a direct replacement in terminfo-based curses.

Lord Kahless

unread,
Sep 22, 1985, 1:23:07 AM9/22/85
to
> > > Does anyone know what library to use as a replacement
> > > for the -ltermlib option on the cc that loads
> > > this game? SVR2 has no such library.
>
> where do these def'ns reside? I can't get a successful compile.
>
>
> Undefined:
> _sqrt
> _atan2
> _tan
> _tgetent
> _tgetstr
> _tgoto
>
> arpanet: hest...@nprdc.ARPA
> other: ucbvax!sdcsvax!sdcsla!hestenes or hest...@sdcsla.UUCP

Looks like you
1) aren't getting to the curses library, the tgetent, tgetstr,
and tgoto error
2) aren't getting to math library.

What sort of sys V system. There are zillions. Here's a generic
fix for the little UNISOFT port machines. It may work for you...
1) change the make file to -ltermcap. -lcurses may work on some
machines.
2) Use one of the posted terminal fixes.
3) If you get the program to compile and it acts incredibly freaky,
try replacing the direct setting of your tty, in the termio.c file,
with calls to the curses equivalents, noecho and crmode. That
worked. You will have some more butchering to do, but the rest is
obvious. I will post a running UNISOFT port version, if I get
requests.

Anyone have hack running on unisoft? Other games? I'd be interested...
Perhaps mutually benificial swaps can be arranged.

ucbvax!ucdavis!vega!ccrdave

opperman

unread,
Sep 23, 1985, 2:58:52 PM9/23/85
to
Can someone mail (e-mail) me an explanation of what vtrek is and
where I can get the source?

Thanks in advance,


C.J. Opperman
ihu1h!jomibase
IH 4H303 x5014
uucp: ihnp4!ihu1h!jomibase

--

C.J. Opperman
ihu1h!jomibase
IH 4H303 x5014
uucp: ihnp4!ihu1h!jomibase

Guy Harris

unread,
Sep 24, 1985, 2:32:55 AM9/24/85
to
> The (very few) primitive termlib routines were closely tied to the termcap
> database structure, so they do not all have a direct replacement in
> terminfo-based curses.

Say what? There are routines in the curses/terminfo library for emulating
the old termcap routines. The S5R2 documentation says they may go away at a
later date, but I'm not sure that statement is still operative.

Guy Harris

David Somner

unread,
Oct 2, 1985, 12:56:23 AM10/2/85
to


Same here! I don't see the sources anywhere!

David A. Somner
somner@lasspvax

(No thanks in advance, let's see if someone is helpful enough...)

"A curious device. It seems to be a collection of distinct columns
fused together. The type of coins which come out of the bottom
of a particular shaft are all the same, even though a mixture is
inserted in the single slit at the top. Somehow, internally they
are permuted about."

-- A barbarian describes a change maker in a modern
day city.

Lars Hammarstrand

unread,
Oct 3, 1985, 2:26:02 PM10/3/85
to
In article <9...@ucdavis.UUCP> ccr...@ucdavis.UUCP (Lord Kahless) writes:
>
>Anyone have hack running on unisoft? Other games? I'd be interested...
>Perhaps mutually benificial swaps can be arranged.
>
> ucbvax!ucdavis!vega!ccrdave

Sure, what's the problem with a UniPlus+ SysV port?, I think it's great and I
have hack and other games running on my machine.
I haven't heard that it should be any major difference between UniPlus+ and
UniPlus+, so what's the problem?.

Lars Hammarstrand.
Datorisering AB, Stockholm, SWEDEN.

UUCP: {seismo,decvax,philabs}!{mcvax,ukc,unido}!enea!daab!lasse
ARPA: decvax!mcvax!enea!daab!la...@berkley.ARPA
decvax!mcvax!enea!daab!la...@seismo.ARPA

Ps...
If you have a 1/2" tape station, I can send you a 1600 BPI tar tape with hack
and some other stuff.

D'arc Angel @ The Houses of the Holy

unread,
Oct 10, 1985, 11:48:11 AM10/10/85
to
> In article <6...@ihu1h.UUCP> jomi...@ihu1h.UUCP (opperman) writes:
> >Can someone mail (e-mail) me an explanation of what vtrek is and
> >where I can get the source?
> >
> > Thanks in advance,
> >
> > C.J. Opperman
> > ihu1h!jomibase
> > IH 4H303 x5014
> > uucp: ihnp4!ihu1h!jomibase
> >
>
>
> Same here! I don't see the sources anywhere!
>
> David A. Somner
> somner@lasspvax
>
> (No thanks in advance, let's see if someone is helpful enough...)
>
> day city.

me too, me too!!! perhaps another posting is in order....
--
god bless Lily St. Cyr
-Rocky Horror Picture Show

Name: James Turner
Mail: Imagen Corp. 2650 San Tomas Expressway, P.O. Box 58101
Santa Clara, CA 95052-9400
AT&T: (408) 986-9400
UUCP: ...{decvax,ucbvax}!decwrl!imagen!negami!turner

0 new messages