[news.software.b] SOLUTION: Setting Time Zone in received news

dt@yenta.alb.nm.us (David B. Thomas) (07/04/90)

redwards@viar.UUCP (Robert L. Edwards) writes:

>Help!

>We are running bnews 2.11 most recent version as of June 1990.  Is
>there any way to display the time in the Date: line in the header in
>the local time zone rather than in GMT?

>It's driving me crazy!


The problem is that init (and thus getty or uugetty) has no idea what
the timezone is (no TZ environment variable).  So, when a uucp login
occurs, getty execs login, which execs uucico...and no TZ ever gets
set up.

My solution was to write a new uucp login shell, which sets up TZ, then
execs uucico.  I call it, uutizo, and here it is.

(You may have to switch things around for your flavor of unix.  This was
written for a unix pc.  This principle is 100% portable, however.)

/*
 * uutizo.c
 *
 *	Program to be used as the login shell for any uucp login.
 *	It first sets the environment variable TZ to the correct
 *	timezone, the execs uucico.
 *
 *	This prevents the use of incorrect times (the EDT default)
 *	when a uucp login runs rnews, rmail or updates the uucp log.
 *
 *	Configure all two defines below, then compile.
 *
 *	To install, copy the executable into /usr/lib/uucp,
 *		$ su
 *		# cp uutizo /usr/lib/uucp
 *		# cd /usr/lib/uucp
 *		# chown uucp uutizo
 *		# chgrp bin uutizo
 *		# chmod 755 uutizo
 *
 *	then replace all occurrences of 'uucico' with 'uutizo' in /etc/passwd.
 *		
 */

#define TZDEF	"TZ=MST7MDT"		/* TZ=<contents of /etc/TZ>	*/
#define UUCICO	"/usr/lib/uucp/uucico"	/* uucico on your system	*/


main(argc, argv)
int	argc;
char	*argv[];
{

	if (putenv (TZDEF))
		perror (argv[0]);

	execv (UUCICO, argv);
}

						David