[comp.sys.amiga] AREXX v1.06 DATE

lfk@amdahl.uts.amdahl.com (Lynn Kerby) (08/02/88)

What follows is a shell archive that contains a patch to correct 
a problem in the Arexx date() function.  This patch will only 
apply to the version of rexxsyslib.library that came out with the
v1.06 upgrade.

Now comes my turn to put in a plug for ARexx!  Not only is the 
program great, but support is outstanding - everytime I have
called the author, he was very helpful in getting the the fix
into my hands.  In this case, I decided to do him a favor and 
post the program I wrote to patch the library.

Watch out for the signature at the end and feed this to /bin/sh.

					Lynn Kerby
					lfk@uts.amdahl.com
--------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	README
#	rxpatch.c
#	rxpatch.uue
# This archive created: Tue Aug  2 00:14:00 1988
# By:	Lynn Kerby (Amdahl Corporation, Sunnyvale, CA)
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'README'
then
	echo shar: "will not over-write existing file 'README'"
else
cat << \SHAR_EOF > 'README'

This is a small program to patch (and unpatch if desired) the 
rexxsyslib.library file for AREXX v1.06.  It attempts to do
reasonable things on error, but doesn't go as far as it probably
could.  If you are not running v1.06, do not try running the
patch program!!

The problem is that the new DATE() function doesn't understand
that people like to see dates like 31-jul-88 instead of 00-aug-88.
I called Bill Hawes and he said the change was pretty minor, so
I decided to try finding the code in rexxsyslib.library that 
needed replacing.

If you don't feel like trusting my code, the change is pretty easy
to make using a filezap utility.
OFFSET	0x7c88
VER	0xb44064ee
REPL	0xb44062ee
(Using NewZAP, the mod goes at offset 0x88 in sector 63 of the file)

The program makes it a little easier.  Syntax is rxpatch [-r].  The
-r option will remove the patch if you want to get rid of it.  

All standard disclaimers apply, and please keep a copy of the old
rexxsyslib.library around in case something goes wrong!

				Lynn Kerby
				lfk@uts.amdahl.com
				...!amdahl!lfk

SHAR_EOF
if test 1071 -ne "`wc -c < 'README'`"
then
	echo shar: "error transmitting 'README'" '(should have been 1071 characters)'
fi
fi
if test -f 'rxpatch.c'
then
	echo shar: "will not over-write existing file 'rxpatch.c'"
else
cat << \SHAR_EOF > 'rxpatch.c'
/*
 * Program to patch the DATE() function of rexxsyslib.library to correct
 *  a problem with months that have more than 30 days.
 *
 * USAGE: rxpatch1 [-r]
 *
 * The program will only open LIBS:rexxsyslib.library.  The -r option
 *  removes the patch (If you really want to).
 *
 * Written by Lynn Kerby with patch info from Bill Hawes
 *
 * No warrantees expressed or implied.  Keep a copy of the old 
 *  rexxsyslib.library around just in case.
 */

#include <fcntl.h>

unsigned long offs=62*512+0x88;
unsigned long orig=0xb44064ee;
unsigned long repl=0xb44062ee;

main(argc, argv)
int argc;
char **argv;
{
	int libfd;
	long cur;
	int undoflag = 0;

	if (argc == 2) {
		if (*argv[1]++ == '-') {
			if (*argv[1] == 'r')
				undoflag = 1;
			else
				usage();
		} else 
			usage();
	} else {
		if (argc != 1)
			usage();
	}
	
	libfd = open("LIBS:rexxsyslib.library",O_RDWR);
	if (libfd == -1) {
		write(2,"ERROR:Unable to open rexxsyslib.library\n",40);
		exit(5);
	}
	(void) lseek(libfd,offs,0);
	if ((read(libfd,&cur,4)) == -1) {
		write(2,"ERROR:Read of rexxsyslib.library failed\n",40);
		exit(5);
	}
	if (undoflag) {
		if (cur != repl) {
			write(2,"ERROR: rexxsyslib.library not patched\n",38);
		} else {
			(void) lseek(libfd,offs,0);
			(void) write(libfd,&orig,4);
		}
	} else {
		if (cur == repl) {
			write(2,"ERROR: rexxsyslib.library already patched\n",42);
		} else if (cur != orig) {
			write(2,"ERROR: verify of data failed\n",29);
		} else {
			(void) lseek(libfd,offs,0);
			(void) write(libfd,&repl,4);
		}
	}
	close(libfd);
}

usage()
{
	write(2,"USAGE: rxpatch [-r]\n",20);
	exit(0);
}

SHAR_EOF
if test 1611 -ne "`wc -c < 'rxpatch.c'`"
then
	echo shar: "error transmitting 'rxpatch.c'" '(should have been 1611 characters)'
fi
fi
if test -f 'rxpatch.uue'
then
	echo shar: "will not over-write existing file 'rxpatch.uue'"
else
cat << \SHAR_EOF > 'rxpatch.uue'
begin 755 rxpatch
M   #\P         #          (   -&    &0    $   /I   #1D[Z!.I.
M5?_X0FW_^ QM  ( "&8T(&T "B)H  12J  $#!$ +68<(&T "B)H  0,$0!R
M9@@[?  !__A@!$ZZ AY@!$ZZ AA@# QM  $ "&<$3KH""C\\  )(>@$H3KH"
MQEQ/.T#__@QM_____F8</SP *$AZ 28_/  "3KH(ZE!//SP !4ZZ";A43T)G
M+RR  C\M__Y.N@'^4$\_/  $2&W_^C\M__Y.N@/"4$^P?/__9AP_/  H2'H!
M"S\\  ).N@BF4$\_/  %3KH)=%1/2FW_^&="("W_^K"L@ IG%#\\ "9(>@$(
M/SP  DZZ"'I03V B0F<O+( "/RW__DZZ 9903S\\  1(;( &/RW__DZZ"%90
M3V!>("W_^K"L@ IF%#\\ "I(>@#M/SP  DZZ"#A03V! ("W_^K"L@ 9G%#\\
M !U(>@#Z/SP  DZZ"!I03V B0F<O+( "/RW__DZZ 3903S\\  1(;( */RW_
M_DZZ!_903S\M__Y.N@G^5$].74YU3$E"4SIR97AX<WES;&EB+FQI8G)A<GD 
M15)23U(Z56YA8FQE('1O(&]P96X@<F5X>'-Y<VQI8BYL:6)R87)Y"@!%4E)/
M4CI296%D(&]F(')E>'AS>7-L:6(N;&EB<F%R>2!F86EL960* $524D]2.B!R
M97AX<WES;&EB+FQI8G)A<GD@;F]T('!A=&-H960* $524D]2.B!R97AX<WES
M;&EB+FQI8G)A<GD@86QR96%D>2!P871C:&5D"@!%4E)/4CH@=F5R:69Y(&]F
M(&1A=&$@9F%I;&5D"@!.50  /SP %$AZ !@_/  "3KH&^%!/0F=.N@?(5$].
M74YU55-!1T4Z(')X<&%T8V@@6RUR70H  $Y5  !(YPP@."T "$ZZ!T(P!,'\
M  8D0-7L@!I*1&T*N&R #FP$2I)F$#E\  * 'G#_3-\$,$Y=3G4P+0 .2,!3
M@"\ +RT "B\23KH)2BH L+S_____3^\ #&8,3KH(_CE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L;( D3N[^8DSO
M  , !"QL@"1.[O\Z(F\ !"QL@"1.[O[:+&R )$[N_WPB;P $("\ ""QL@"1.
M[O\N(&\ !"QL@"1.[OZ,+&R )")O  0@+P (3N[]V")O  0L;( D3N[^ADSO
M  , !"QL@"1.[O[.(&\ !"QL@"1.[OZ 3.\#   $+&R 0D[N_Z @;P $+&R 
M0D[N_Z8@;P $+&R 0D[N_[(   /L     0    $   5@         _(   /J
L    !@  ?(BT0&3NM$!B[@ 4                 _(   /K     0   _+J
 
end
SHAR_EOF
if test 4798 -ne "`wc -c < 'rxpatch.uue'`"
then
	echo shar: "error transmitting 'rxpatch.uue'" '(should have been 4798 characters)'
fi
fi
exit 0
#	End of shell archive
-- 
     Lynn Kerby  -  Amdahl Corporation
                    Sunnyvale, CA
                    ...amdahl!lfk
		    lfk@uts.amdahl.com

Disclaimer: Any and all opinions expressed herein are my own and do not
            necessarily represent the views of anyone, especially my
            employer.