/* $Header: backpage.c,v 4.3 85/05/01 11:36:03 lwall Exp $
* Revision 4.3 85/05/01 11:36:03 lwall
* Baseline for release with 4.3bsd.
varyname
= filexp(VARYNAME
);
close(creat(varyname
,0600));
varyfd
= open(varyname
,2);
printf(cantopen
,varyname
) FLUSH
;
printf("vrdary(%ld) > %ld\n",(long)indx
, (long)maxindx
) FLUSH
;
subindx
= indx
% VARYSIZE
;
offset
= (indx
- subindx
) * sizeof(varybuf
[0]);
if (offset
!= oldoffset
) {
(void)lseek(varyfd
,oldoffset
,0);
write(varyfd
, (char *)varybuf
,sizeof(varybuf
));
(void)lseek(varyfd
,offset
,0);
read(varyfd
,(char *)varybuf
,sizeof(varybuf
));
/* write to virtual array */
printf("vwtary(%ld)\n",(long)indx
) FLUSH
;
printf("indx skipped %d-%d\n",maxindx
+1,indx
-1) FLUSH
;
subindx
= indx
% VARYSIZE
;
offset
= (indx
- subindx
) * sizeof(varybuf
[0]);
if (offset
!= oldoffset
) {
(void)lseek(varyfd
,oldoffset
,0);
write(varyfd
,(char *)varybuf
,sizeof(varybuf
));
(void)lseek(varyfd
,offset
,0);
read(varyfd
,(char *)varybuf
,sizeof(varybuf
));
varybuf
[subindx
] = newvalue
;