From:	SMTP%"bailey@HMIVAX.HUMGEN.UPENN.EDU" 20-SEP-1993 12:50:23.39
To:	EVERHART
CC:	
Subj:	Patch: Deleted last item still in item display

Message-Id: <9309182307.AA23777@uu7.psi.com>
Date:         Fri, 17 Sep 1993 16:33:49 GMT
Reply-To: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
Sender: ANU-NEWS Discussion <ANU-NEWS@VM1.NoDak.EDU>
Comments:     Warning -- original Sender: tag was news@NETNEWS.UPENN.EDU
From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
Organization: HHMI/Human Genetics, Univ of Pa.
Subject:      Patch: Deleted last item still in item display
To: Multiple recipients of list ANU-NEWS <ANU-NEWS@VM1.NoDak.EDU>

At present, if one deletes an item in the middle of a newsgroup, and later
deletes the last item in the group, News doesn't update the item display
correctly, so it looks like the last item is still there, even though it has
been deleted from the index file. Appended below my signature is a patch which
fixes this bug; the display is now updated to correctly reflect the deletion.

                    Regards,
                    Charles Bailey

!-------------------------------------------------------------------------------
!             Dept. of Genetics / Howard Hughes Medical Institute
! University of Pennsylvania School of Medicine  Rm. 430 Clinical Research Bldg.
!     422 Curie Blvd.  Philadelphia, PA 19104 USA      Tel. (215) 898-1699
!          Internet: bailey@genetics.upenn.edu  (IN 128.91.200.37)
!-------------------------------------------------------------------------------
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_UNPACK_VERIFY"))'
$!
$! This archive created:
$!  Name : 930917_NEWSDELETE.PATCH
$!  By   : bailey@hmivax.humgen.upenn.edu
$!  Date : 17-SEP-1993 11:53:03.11
$!  Using: VMS_SHARE 8.4, (C) 1993 Andy Harper, Kings College London UK
$!
$! Credit is due to these people for their original ideas:
$!    James Gray, Michael Bednarek
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. 930917_NEWSDELETE.PATCH;1
$!
$ set="set"
$ set symbol/scope=(nolocal,noglobal)
$ f=f$parse("SHARE_UNPACK_TEMP","SYS$SCRATCH:."+f$getjpi("","PID"))
$ e="write sys$error  ""%UNPACK"", "
$ w="write sys$output ""%UNPACK"", "
$ if .not. f$trnlnm("SHARE_UNPACK_LOG") then $ w = "!"
$ if f$getsyi("CPU") .gt. 127 then $ goto start
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto start
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$unpack: subroutine ! P1=filename, P2=checksum, P3=attributes,P4=size
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'"
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn' File skipped"
$ delete 'f'*
$ exit
$dirok:
$ x=f$search(P1)
$ if x .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped"
$ delete 'f'*
$ exit
$file_absent:
$ w "-I-UNPACK, Unpacking ", P5, " of ", P6, " - ", P1, " - ", P4, " Blocks"
$ n=P1
$ if P3 .nes. "" then $ n=f
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT/NOJOURNAL 'f'/OUT='n'
PROCEDURE GetHex(s,p)LOCAL x1,x2;x1:=INDEX(t,SUBSTR(s,p,1))-1;x2:=INDEX(t,
SUBSTR(s,p+1,1))-1;RETURN 16*x1+x2;ENDPROCEDURE;PROCEDURE SkipPartsep LOCAL m;
LOOP m:=MARK(NONE);EXITIF m=END_OF(b);DELETE(m);EXITIF INDEX(ERASE_LINE,
"-+-+-+-+-+-+-+-+")=1;ENDLOOP;ENDPROCEDURE;PROCEDURE ProcessLine LOCAL c,s,l,b,
n,p;c := ERASE_CHARACTER(1);s := ERASE_LINE;IF c = "X" THEN SPLIT_LINE; ENDIF;
MOVE_HORIZONTAL(-1);l := LENGTH(s);p := 1;LOOP EXITIF p > l;c := SUBSTR(s,p,1);
p := p+1;CASE c FROM ' ' TO '`' ['`']: COPY_TEXT(ASCII(GetHex(s,p))); p:=p+2;[
' ']: p:=p+1;[INRANGE,OUTRANGE]: COPY_TEXT(c);ENDCASE;ENDLOOP;ENDPROCEDURE;
PROCEDURE Decode LOCAL m;POSITION(BEGINNING_OF(b));LOOP m:=MARK(NONE);EXITIF m=
END_OF(b);DELETE(m);IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+-")=
1 THEN SkipPartSep;ELSE ProcessLine;MOVE_HORIZONTAL(1);ENDIF;ENDLOOP;
ENDPROCEDURE;SET(FACILITY_NAME,"UNPACK");SET(SUCCESS,OFF);SET(INFORMATIONAL,
OFF);t:="0123456789ABCDEF";f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);Decode;WRITE_FILE(b,GET_INFO(COMMAND_LINE,"output_file"));
QUIT;
$ if p3 .eqs. "" then $ goto dl
$ open/write fdl &f
$ write fdl "RECORD"
$ write fdl P3
$ close fdl
$ w "-I-CONVRFM, Converting record format to ", P3
$ convert/fdl=&f &f-1 &P1
$dl: delete 'f'*
$ checksum 'P1'
$ if checksum$checksum .nes. P2 then $ -
  e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ exit
$ endsubroutine
$start:
$!
$ create 'f'
XANU`20News`20Patch
XPatch`20ID:`20930917_newsdelete.c!bailey@genetics.upenn.edu
XDate:`2017-Sep-1993
XAuthor:`20Charles`20Bailey`20`20bailey@genetics.upenn.edu
XNews`20Version:`206.1beta8
XNews`20Files:`20NewsDelete.C
XDescription:`20Clears`20array`20cell`20at`20end`20of`20grp_ia`20after`20deleti
Vng`20an`20item`20from`20the
Xia.`20`20This`20cell`20contains`20the`20information`20from`20the`20top`20item
V`20before`20the`20array`20was
Xmoved`20down`20to`20replace`20the`20deleted`20item,`20and,`20under`20some`20ci
Vrcumstances,
Xfind_itm_by_num`20would`20look`20here`20and`20think`20it`20had`20found`20a`20v
Valid`20item.
X***`20newsdelete.c
X---`20newsdelete_new.c
X**************
X***`2021,23
X`20`20**--
X`20`20**/
X`20`20`0C
X---`2021,26`20-----
X+`20**`20`20`206.1b8`20`2017-Sep-1993`20`20Charles`20Bailey`20`20bailey@geneti
Vcs.upenn.edu
X+`20**`20`20`20`20-`20zero`20empty`20grp_ia`20cell`20at`20end`20of`20array`20a
Vfter`20deleting`20item`20so
X+`20**`20`20`20`20`20`20find_itm_by_num`20doesn't`20think`20it's`20a`20valid
V`20item
X`20`20**--
X`20`20**/
X`20`20`0C
X**************
X***`20580,585
X`20`20`20`20if`20((gap->grp_c_itm`20==`20i)`20`26`26`20(cur_down_itm(g,1,0)`20
V!=`201))`20cur_up_itm(g,1,0);
X`20`20`20`20s_mapped`20=`20gap->grp_iavdsize;
X`20`20`20`20for`20(j`20=`20i+1;`20j`20<=`20gap->grp_count;`20++j)`20iap`5Bj-1
V`5D`20=`20iap`5Bj`5D;
X`20`20`20`20if`20(gap->grp_c_itm`20>`20i)`20`7B
X`20`20`20`20`20`20--gap->grp_c_itm;
X`20`20`20`20`20`20if`20((news_context`20>`201)`20`26`26`20(curr_g`20==`20g))
V`20curr_i`20=`20gap->grp_c_itm;
X---`20583,593`20-----
X`20`20`20`20if`20((gap->grp_c_itm`20==`20i)`20`26`26`20(cur_down_itm(g,1,0)`20
V!=`201))`20cur_up_itm(g,1,0);
X`20`20`20`20s_mapped`20=`20gap->grp_iavdsize;
X`20`20`20`20for`20(j`20=`20i+1;`20j`20<=`20gap->grp_count;`20++j)`20iap`5Bj-1
V`5D`20=`20iap`5Bj`5D;
X+`20
X+`20`20`20/*`20clear`20empty`20cell`20at`20end`20of`20ia`20so`20it`20doesn't
V`20look`20like`20a`20real`20item`20*/
X+`20`20`20/*`2017-Sep-1993`20`20Charles`20Bailey`20`20bailey@genetics.upenn.ed
Vu`20*/
X+`20`20`20memset(`26(iap`5Bgap->grp_count`5D),0,sizeof`20newsitm);
X+`20
X`20`20`20`20if`20(gap->grp_c_itm`20>`20i)`20`7B
X`20`20`20`20`20`20--gap->grp_c_itm;
X`20`20`20`20`20`20if`20((news_context`20>`201)`20`26`26`20(curr_g`20==`20g))
V`20curr_i`20=`20gap->grp_c_itm;
X***`20patchlist.h;-1
X---`20patchlist.h
X**************
X***`201,1
X`20`20=+=+=`20End`20=+=+=
X---`201,2`20-----
X+`20930917_newsdelete.c!bailey@genetics.upenn.edu
X`20`20=+=+=`20End`20=+=+=
$ call unpack 930917_NEWSDELETE.PATCH;1 -
 791652567 "FORMAT STREAM_LF;CARRIAGE_CONTROL CARRIAGE_RETURN" 4 1 1
$ v=f$verify(v)
$ exit
