[net.sources] expensive clock problems?

flamer@omsvax.UUCP (Jim Trethewey) (02/10/84)

I have received a couple of responses regarding the EXPENSIVE CLOCK
posting of a few days ago.  Since the problems have seemed universal,
I am posting to the net.

--------------------------------------------------------------------
First letter From intelca!hplabs!ihnp4!houxa!dcs 
--------------------------------------------------------------------

Not being a unix expert, I had a couple of problems trying to compile the
'expensive clock program' clock.c that you posted on the net.  First, the
file <ident.h> (i.e., /usr/include/ident.h) does not exist on my system.
Apparently, this file is used only to define "myname", so, by eliminating the
reference to <ident.h> and #defining myname, I got out of that problem.  The
other problem is that, when trying to compile (and load) with the -l flags you
specify (-lcurses -ltermcap -ljobs), I get the message:
	ld *command*: can't find library library libjobs.a .
Leaving out the -ljobs allows the loading to proceed without any problem, but
then execution produces a bus error and core dump.

My question:  What is myname supposed to be (I just supplied my login, but it
would be nice to define it as it is defined in <ident.h>), and what is
libjobs.a all about?

As far as I know, we're on Bell Labs UN*X 5.0.  Thanks for any info you can
give.

--------------------------------------------------------------------
Second Letter From intelca!hplabs!seismo!uwvax!heurikon!jeff 
--------------------------------------------------------------------

1)  I don't seem to have ident.h, so I commented the #include out.
2)  I got "myname" undefined errors, so I commented out the two
	lines where "myname" appears.
3)  I don't have a "jobs" lib, so I linked without it.
The resulting pgm works, but it needs a few repairs.  Do you have
any quick suggestiong for me before I start diggin?  (We're running
UniPlis sys 3 and 5.)

--------------------------------------------------------------------
Third Letter From intelca!hplabs!ihnp4!dwx3bS!vqh 
--------------------------------------------------------------------

I now have an expensive digital clock on my desk thanks to you.
	One bug report: the in_char should be declared as int 
(instead of char) to make sure the program'll run on machines that
don't do sign extend.
	One question: what's ident.h and myname ?  They're not
available on my system (UNIX V.)

--------------------------------------------------------------------
Answer From Me omsvax!flamer
--------------------------------------------------------------------

The program I sent I have gotten to work on BSD 4.1c and Xenix-86 R2.0 (from
V7).  I have no experience with Sys V.  So take things I say as conjecture,
you may have to appeal to a local guru or the net for help...

First, <ident.h> is used by BSD's getty (the program that looks for terminals
and says 'login:' and then calls the login utility) to print out a banner.
Our system's <ident.h> looks like this:

char myname[] = "OMS Engineering VAX/UNIX";

and hence, terminals always say:

OMS Engineering VAX/UNIX

login:

If you are not the system administrator, try sending mail to him (her?)
and ask that an ident.h be installed.  Otherwise, just putting the 
declaration directly in clock.c will be fine.

As an aside, an amazing number of people had the same problem when I
posted nwrite last July.

The reason for the -ljobs problem is roughly this:  the libjobs library
is what gives BSD all those extra fancy signals for jobs control (if you
are unfamiliar with this concept, the most visible addition it gives you
is the ability to type a control Z while you're running something which
generates a SIGSUSP and causes your process to be suspended and placed
in the background.  It can be restarted in the foreground with 'fg' or
in the background with 'bg' or terminated with 'kill'.  All background
jobs are displayable with 'jobs').

Since you are not running BSD, you either:
1) should just ignore the -ljobs (which seems to have mixed results)
2) find the Sys V equivalent.

I don't know the manner in which Sys V deals with signals, but there might
be a library you have to locate and link in.  Maybe it's called -lsigs
or -lsignals or something like that.  The general area to go hunting for that
stuff is /usr/lib.

Any debate on the difference between (and relative merits of) type int
versus type char?

Good luck.  Anyone who gets really confused can call 503-681-5444.

		    Jim Trethewey
		    Intel @ Hillsboro (aka the Portland sticks), OR

jhall@ihuxu.UUCP (John R. Hall) (02/14/84)

I made a few mods and have a version that runs on either Berkeley
or System V with appropriate code ifdef'd.  I've tried it
on Vax/780's running System V and 4.1a BSD.  If anyone wants a copy,
send mail.  If there's enough interest, I'll post it to the net.
The System V version simulates the myname declaration in BSD's
ident.h via a call to uname.

Peace,
-- 
--John R. Hall, ...ihnp4!ihuxu!jhall

guy@rlgvax.UUCP (Guy Harris) (02/17/84)

> First, <ident.h> is used by BSD's getty (the program that looks for terminals
> and says 'login:' and then calls the login utility) to print out a banner....
> If you are not the system administrator, try sending mail to him (her?)
> and ask that an ident.h be installed.  Otherwise, just putting the
> declaration directly in clock.c will be fine.

The preferred way under USG UNIX (as all the BTLers out there have probably
already concluded) is to do a "uname" system call and suck the name out
of the "sysname" or "nodename" field.  In fact, under 4.2BSD you should get
the name from a "gethostname" system call.

> 2) find the Sys V equivalent.  (to -ljobs)

There isn't one, so you'd probably have to ignore it.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy