[comp.os.minix] 1.3 ar fix

nwc@cunixc.columbia.edu (Nick Christopher) (06/04/88)

The problem with ar v(1.3) was that the field length for the member name was
14.  Now the maximum file name is 14 characters which is a field length of 15
with the trailing NULL. Hence the fence post error in the comparisons. I was
tempted to change the size of the name field to 15 so that the full file name
could be properly represented however this would make ALL old archives
incompatible since there header records would be of a different size.  So I
just changed the strcmp to strncmp(x,y,14) which seemed to clear things up.

# This is a shell archive, cut here.
echo x - ar.c.dif
gres '^X' '' > ar.c.dif << '/'
X690c690
X< 				if (strcmp(basename(argv[a-1]),member->ar_name) == 0) {
X---
X> 				if (strncmp(basename(argv[a-1]),member->ar_name,14) == 0) {
X732c732
X< 		if (posname && strcmp(posname, member->ar_name) == 0)
X---
X> 		if (posname && strncmp(posname, member->ar_name,14) == 0)
X737c737
X< 				if (strcmp(basename(argv[a-1]),member->ar_name) == 0) {
X---
X> 				if (strncmp(basename(argv[a-1]),member->ar_name,14) == 0) {
/


-- 
		"I am the Lorvax. I speak for the machines."
______________________________________________________________________________
nwc%cunixc@columbia, columbia!cunixc!nwc  BITNET: nwcus@cuvma 
            USENET: topaz!columbia!cunixc!nwc