[comp.sys.ncr] Date Error on 4920 and 4940 Terminals

dougw@fdls.UUCP (Doug Walker) (03/20/90)

Mike Nolan posted a shell script to modify the date and time on an NCR 4940
terminal and asked for refinements.

We currently use this C program to perform this function on our NCR 32/650
under 02.01.01:

/* Courtesy of Northwest Analytical, Portland, Oregon */

#include <time.h>

main ()
{
     long tod;				/* Time of day in seconds */
     struct tm *ct;			/* Time fields */

     time(&tod);
     ct = localtime(&tod);

     printf("\033\001\015%02d\016%02d\017%02d",
            ct->tm_mday, ct->tm_mon+1, ct->tm_year);
    
     printf("\025%02d\026%02d\037", ct->tm_min, ct->tm_hour);
}

Also, here's a short shell script by Joel Barton, Oregon Department of
Agriculture, that will also do the job:

  set `date '+%d %m %y %M %H'`
  echo "^[^A^M$1^N$2^O$319^U$4^V$5^_"

The ^'s represent a CTRL v typed in vi.  Also, the $319 will need to be
changed to $320 for the 21st century.

-- 


-----------------------------------------------------------------
Doug Walker                        |   email: uunet!fdls!dougw  |
Oregon Department of Agriculture   |     Tel: (503) 378-3790    |
Food and Dairy Division            |     Fax: (503) 378-5529    |
635 Capitol Street NE              |                            |
Salem, OR  97310-0110              |                            |
------------------------------------------------------------------

wescott@Columbia.NCR.COM (Mike Wescott) (03/21/90)

In article <195@fdls.UUCP> dougw@fdls.UUCP (Doug Walker) writes:
>   set `date '+%d %m %y %M %H'`
>   echo "^[^A^M$1^N$2^O$319^U$4^V$5^_"
> 
> The ^'s represent a CTRL v typed in vi.

Control characters can be handled by echo in much the same way as
in C:

	echo "\033\001\r$1\016$2\017$319\025$4\026$5\037"

or even better, avoid the echo altogether:

	date "+^[^A^M%d^N%m^O%y19^U%M^V%H^_"


--
	-Mike Wescott
	 mike.wescott@ncrcae.Columbia.NCR.COM