[net.sources.bugs] How do I compile ttype?

ken@turtlevax.UUCP (Ken Turkowski) (11/19/85)

When I try compiling ttype.c with the -ltermcap flag, I get the following
message.  What else do I need?

Undefined:
_initscr
_stdscr
_CA
__tty
__rawmode
__pfast
__tty_ch
__echoit
_LINES
_wmove
_wclrtoeol
_COLS
_subwin
_wclear
_wgetch
_wrefresh
_printw
_wstandend
_wstandout
_wclrtobot
_endwin
-- 
Ken Turkowski @ CIMLINC (formerly CADLINC), Menlo Park, CA
UUCP: {amd,decwrl,hplabs,seismo,spar}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.DEC.COM

brooks@leadsv.UUCP (Brooks Price) (11/20/85)

-lcurses -ltermlib should be included in the compile line...

Brooks Price

jdg@husky.uucp (Jeff Gortatowsky) (11/22/85)

-=-=-=-==-=-=-=-=-=-= Low cal Line -=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-
>   When I try compiling ttype.c with the -ltermcap flag, I get the following
>   message.  What else do I need?

>  Undefined:
>  _initscr
 
>   Ken Turkowski @ CIMLINC (formerly CADLINC), Menlo Park, CA
>   UUCP: {amd,decwrl,hplabs,seismo,spar}!turtlevax!ken
>   ARPA: turtlevax!ken@DECWRL.DEC.COM

Try -ltermcap AND -lcurses together...

Jeff Gortatowsky       {allegra,seismo}!rochester!ritcv!husky!jdg
Eastman Kodak Company  {eagle,astrovax,netword!}sun!sunrise!husky!jdg
 
These comments are mine alone and not Eastman Kodak's or anyone else's
at/in this relative space and time.
-- 
Jeff Gortatowsky       {allegra,seismo}!rochester!ritcv!husky!jdg
Eastman Kodak Company  {eagle,astrovax,netword!}sun!sunrise!husky!jdg
 
These comments are mine alone and not Eastman Kodak's or anyone else's
at/in this relative space and time.

garyjohn@hpspkla.UUCP (garyjohn) (12/02/85)

I also have a problem compiling ttype.  Our system apparently does not
have timeb.h.  Could someone please post it?  Thanks in advance.

Gary Johnson

jpn@teddy.UUCP (12/03/85)

>I also have a problem compiling ttype.  Our system apparently does not
>have timeb.h.  Could someone please post it?  Thanks in advance.
>

Please DONT!!!!!

If your system does not have timeb.h, then it also doesn't have ftime(),
the function that uses the type "struct timeb".  If you don't have this
function, then you need a total rewrite of the program (if that is even
possible)!  ftime returns time in units SMALLER than one second.  System III/V
do not support this functionality (a major flaw, in my opinion) making
timing tasks such as in ttype much more difficult.

John P. Nelson, Moderator, mod.sources
(decvax!genrad!panda!jpn  seismo!harvard!wjh12!panda!jpn)

stephenf@elecvax.eecs.unsw.oz (Stephen Frede) (12/06/85)

>If your system does not have timeb.h, then it also doesn't have ftime(),
>the function that uses the type "struct timeb".  If you don't have this
>function, then you need a total rewrite of the program (if that is even
>possible)!  ftime returns time in units SMALLER than one second.  System III/V
>do not support this functionality (a major flaw, in my opinion) making
>timing tasks such as in ttype much more difficult.

V7/SysV times(2) system call returns a value in tics (1/60 or 1/100 sec in
the US, usually 1/50 sec in Australia)
The ttype program does not use the value for anything very crucial.
The following routine will probably be close enough.


#ifdef BSD
#include <sys/timeb.h>
#else
	struct timeb	/* only two elements used */
	{
		time_t		time;
		unsigned long	millitm;
	};
#define	index	strchr
#define	rindex	strrchr
#endif	/* BSD */

	/* ... */

#ifndef BSD
ftime(t)
struct timeb *t;
{
	struct tm	tbuf;

	time(&t->time);
	t->millitm = (times(&tbuf) % HZ) * (1000/HZ);
}
#endif	/* BSD */

garyjohn@hpspkla.UUCP (garyjohn) (12/06/85)

I received several responses to my (misguided) request for timeb.h,
including explanations of why it wouldn't do me any good.  It turned out
that the patches needed to make the program run on our SysV system
weren't very extensive, far from a "total rewrite".  Of course, the
calculated typing speeds are probably grossly inaccurate since the
program now has only 1 second timing resolution, but I was more
interested in a tool for practice than in precise evaluation of my
skill, anyway.

Many thanks to everyone who responded.

Gary Johnson

thomas@utah-gr.UUCP (Spencer W. Thomas) (12/09/85)

In article <1929@elecvax.eecs.unsw.oz> stephenf@elecvax.eecs.unsw.oz (Stephen Frede) writes:
>V7/SysV times(2) system call returns a value in tics (1/60 or 1/100 sec in
>the US, usually 1/50 sec in Australia)
>The ttype program does not use the value for anything very crucial.
>The following routine will probably be close enough.

This will not work because, while ftime returns REAL TIME in small
units, times returns CPU TIME, obviously not the same thing, unless your
process is using 100% of the CPU.

-- 
=Spencer   ({ihnp4,decvax}!utah-cs!thomas, thomas@utah-cs.ARPA)
	"Ask not what your kernel can do for you, but rather what you
	 can do for you kernel!"

hansen@pegasus.UUCP (Tony L. Hansen) (12/09/85)

< If your system does not have timeb.h, then it also doesn't have ftime(),
< the function that uses the type "struct timeb".  If you don't have this
< function, then you need a total rewrite of the program (if that is even
< possible)!  ftime returns time in units SMALLER than one second.  System
< III/V do not support this functionality (a major flaw, in my opinion) making
< timing tasks such as in ttype much more difficult.

To get < 1 second timing information on System III/V, one can make use of
the times(2) system call. In addition to filling in a structure with
information that is not needed for this purpose, it returns the elapsed real
time, in 60ths or 100ths of a second depending on the processor, since an
arbitrary (fixed per process) point in the past.

By using this system call, I have been able to get the functionality needed
for programs such as ttype.

I'm not going to debate flawness issue.

					Tony Hansen
					pegasus!hansen

jsisi@trwrba.UUCP (Gerald W. Irmler) (12/10/85)

The referenced article stated the System V times call returned the CPU time.

I haven't looked at the code, but I quote from the times(2) manual page:

"Upon successful completion, *times* returns the elaspsed real time, in HZ,
since an arbitrary time in the past (e.g. system start-up time).
This point does not change from one invocation of *times* to another."

Thus I think one can use times(2) to fake a suitable ftime unless the manual
page is in error.

	Dan Jones
	ihnp4!trwrb!jcc-one!djones
	NOT the path in the header.