[comp.unix.xenix.sco] clock and echo problems

mrm@sceard.Sceard.COM (M.R.Murphy) (12/31/90)

This is probably just a case of RTFM, but here goes:

Compaq Deskpro 386, Xenix 2.3.2, and the system clock loses an hour or
two a day. CMOS clock is ok. This seems like it probably shouldn't happen :-)

Anybody notice that under csh,
 % echo "--"
works, but under /bin/sh,
 $ echo "--"
doesn't work?
Any good reason for such behavior from /bin/echo ?
-- 
Mike Murphy  mrm@Sceard.COM  ucsd!sceard!mrm  +1 619 598 5874

cliffb@cjbsys.bdb.com (cliff bedore) (01/02/91)

In article <1990Dec31.012532.17992@sceard.Sceard.COM> mrm@Sceard.COM (M.R.Murphy) writes:
>This is probably just a case of RTFM, but here goes:
>
>Compaq Deskpro 386, Xenix 2.3.2, and the system clock loses an hour or
>two a day. CMOS clock is ok. This seems like it probably shouldn't happen :-)
>
>Anybody notice that under csh,
> % echo "--"
>works, but under /bin/sh,
> $ echo "--"
>doesn't work?
>Any good reason for such behavior from /bin/echo ?
>-- 
>Mike Murphy  mrm@Sceard.COM  ucsd!sceard!mrm  +1 619 598 5874

Yes.  in csh there is a built-in echo which gives the first result and since sh
doesn't have a bulit-in /bin/echo takes over.  (I went crazy on our Ultrix
system til I figured this out.)     

Oops, I just noticed that sh has a bulit-in echo also but it seems to work just
like /bin/echo

anyhow that is the difference.

Cliff

mrm@sceard.Sceard.COM (M.R.Murphy) (01/03/91)

In article <1991Jan1.234705.4226@cjbsys.bdb.com> cliffb@cjbsys.bdb.com (cliff bedore) writes:
>In article <1990Dec31.012532.17992@sceard.Sceard.COM> mrm@Sceard.COM (M.R.Murphy) writes:
>>This is probably just a case of RTFM, but here goes:
>>
>>Compaq Deskpro 386, Xenix 2.3.2, and the system clock loses an hour or
>>two a day. CMOS clock is ok. This seems like it probably shouldn't happen :-)
>>
>>Anybody notice that under csh,
>> % echo "--"
>>works, but under /bin/sh,
>> $ echo "--"
>>doesn't work?
>>Any good reason for such behavior from /bin/echo ?
>>-- 
>>Mike Murphy  mrm@Sceard.COM  ucsd!sceard!mrm  +1 619 598 5874
>
>Yes.  in csh there is a built-in echo which gives the first result and since sh
>doesn't have a bulit-in /bin/echo takes over.  (I went crazy on our Ultrix
>system til I figured this out.)     
>
>Oops, I just noticed that sh has a bulit-in echo also but it seems to work just
>like /bin/echo
>
>anyhow that is the difference.
>
>Cliff

I'm sorry I wasn't clear in my original posting regarding /bin/echo. I know
that csh has echo builtin (as does ksh with echo aliased to print - :-), and
I know that /bin/sh uses /bin/echo rather than a builtin echo. What I wanna know
is how come
 /bin/echo --
doesn't work. Echo -- works with the builtin echo of csh and ksh. BTW,
/bin/echo -- works on all the non-Xenix implementations of Unix(tm) that I
bothered to seek out. Maybe it's because the Xenix /bin/echo uses getopt,
but it really shouldn't :-)

The clock problem is a real pain. I know about resetting the clock from the
cmos clock every so often with something run from cron, but that seems so gross,
so kludged, so pragmatic, and so troubled by the possibility of rerunning
something that should only be run once a day or once an hour, that I hate to
do it that way. I'm familiar with the use of locks and one-shots to avoid
multiple invocations, but I'd still rather have some nice, easy way to tweak
things to make the software clock more accurate.

Suggestions? Useful suggestions? Anatomically possible suggestions?
-- 
Mike Murphy  mrm@Sceard.COM  ucsd!sceard!mrm  +1 619 598 5874

mike@bria.AIX (Mike Stefanik/78125) (01/04/91)

In article <1991Jan3.061037.26249@sceard.Sceard.COM> mrm@Sceard.COM (M.R.Murphy) writes:
>I'm sorry I wasn't clear in my original posting regarding /bin/echo. I know
>that csh has echo builtin (as does ksh with echo aliased to print - :-), and
>I know that /bin/sh uses /bin/echo rather than a builtin echo. What I wanna 
>know is how come
> /bin/echo --
>doesn't work. Echo -- works with the builtin echo of csh and ksh. BTW,
>/bin/echo -- works on all the non-Xenix implementations of Unix(tm) that I
>bothered to seek out. Maybe it's because the Xenix /bin/echo uses getopt,
>but it really shouldn't :-)

You seem to be correct about /bin/echo using the getopt() function; however,
you always could use:

	/bin/echo "\055\055"
:-)

>The clock problem is a real pain. I know about resetting the clock from the
>cmos clock every so often with something run from cron, but that seems so
>gross,so kludged, so pragmatic, and so troubled by the possibility of rerunning
>something that should only be run once a day or once an hour, that I hate to
>do it that way. I'm familiar with the use of locks and one-shots to avoid
>multiple invocations, but I'd still rather have some nice, easy way to tweak
>things to make the software clock more accurate.

I ran into this problem myself at one point in time; I would just have the
following done every 10 minutes by cron:

	date `cat /dev/clock` >/dev/null 2>&1

BTW: /dev/clock reads the CMOS clock.

-----------------------------------------------------------------------------
Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation
UUCP: ...!uunet!bria!mike
"If it was hard to code, it should be harder to use!"