From: SMTP%"bailey@GENETICS.UPENN.EDU" 24-JUN-1994 20:54:22.65 To: EVERHART CC: Subj: Patch: Return to last item read Date: Fri, 24 Jun 1994 15:32:17 EDT Reply-To: Charles Bailey Sender: ANU-NEWS Discussion From: Charles Bailey Organization: HHMI/Human Genetics, Univ of Pa. Subject: Patch: Return to last item read To: Multiple recipients of list ANU-NEWS A few weeks ago, someone (Peter Mahlquist?) posted a note mentioning a change in the startup behavior of version 6.1beta9 - you were returned to the last newsgroup read in the previous session, but not to the last item, if any. This came about because of various interactions within News which made it possible that you couldn't get back to that item in the new session. The enclosed patch restores the behavior of prior versions of News (i.e. it will try to go back to the last item read), with the following limitations: o If the saved newsgroup doesn't contain any new items, and News would have started with a Dir/New, it will now start with a Dir/Reg or a Dir/All, depending on whether you are registered for the saved newsgroup. This is because it's difficult to add a single group to the newsgroup directory list; this may change someday, but probably not soon. o If you have the UnReadItems or UnSeenStack profile options set, and the saved item is not displayed, then you will be left at the nearest item which is displayed. This is due to a less significant limitation in the existing code, and I may get the time to work around it for the next release. Since the code handling display levels and index displays is one of (IMHO) the most convoluted parts of News, I'm posting this patch with a special request for feedback. If News starts doing anything you think is odd after applying this patch, please let me know or post a description to this group. It's worked OK in testing here, but that's one setup among the many under which News is run. Thanks for your help. Regards, Charles Bailey !------------------------------------------------------------------------------- ! Computational Biology and Informatics Laboratory ! Dept. of Genetics, Univ. of Pennsylvania School of Medicine ! Philadelphia, PA USA 19104 Tel. (215) 573-3112 ! Internet: bailey@genetics.upenn.edu (IN 128.91.200.37) !------------------------------------------------------------------------------- $! ------------------ CUT HERE ----------------------- $ v='f$verify(f$trnlnm("SHARE_UNPACK_VERIFY"))' $! $! This archive created: $! Name : 940624_NEWSRC.PATCH $! By : bailey@genetics.upenn.edu $! Date : 24-JUN-1994 03:26:39.43 $! 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. 940624_NEWSRC.PATCH $! $ 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-HIGHVERS, Creating higher version of ", P1 $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:`20940624_newsrc.c!bailey@genetics.upenn.edu XDate:`2024-Jun-1994 XAuthor:`20Charles`20Bailey`20`20bailey@genetics.upenn.edu XNews`20Version:`206.1beta9 XNews`20Files:`20NewsRC.C XDescription:`20Attempts`20to`20restore`20context`20at`20beginning`20of`20sessi Von`20to`20newsgroup Xand`20item`20(if`20any)`20which`20were`20current`20when`20NewsRC`20file`20was V`20last`20updated. X***`20newsrc.c X---`20newsrc_new.c X************** X***`2046,48 X`20`20**-- X`20`20**/ X`20`20`0C X---`2046,51`20----- X+`20**`09V6.1b9`20`2024-Jun-1994`09bailey@genetics.upenn.edu X+`20**`09-`20moved`20code`20from`20read_reg_file()`20to`20reg_context()`20to V`20restore`20context X+`20**`09`20`20to`20group+item`20at`20which`20last`20session`20ended. X`20`20**-- X`20`20**/ X`20`20`0C X************** X***`2072,78 X`20`20`20`20`20`20old_dir_lev, X`20`20`20`20`20`20force_dir`20=`200; X`20`20 X!`20static`20int`20dotnewsrcexists`20=`200; X`20`20 X`20`20extern`20int`20lib$put_output(); X`20`20`0C X---`2075,81`20----- X`20`20`20`20`20`20old_dir_lev, X`20`20`20`20`20`20force_dir`20=`200; X`20`20 X!`20static`20char`20new_cg_name`5BSUBJLEN`5D; X`20`20 X`20`20static`20int`20dotnewsrcexists`20=`200; X`20`20 X************** X***`2074,79 X`20`20 X`20`20static`20int`20dotnewsrcexists`20=`200; X`20`20 X`20`20extern`20int`20lib$put_output(); X`20`20`0C X`20`20/* X---`2077,84`20----- X`20`20 X`20`20static`20char`20new_cg_name`5BSUBJLEN`5D; X`20`20 X+`20static`20int`20dotnewsrcexists`20=`200; X+`20 X`20`20extern`20int`20lib$put_output(); X`20`20`0C X`20`20/* X************** X***`20149,156 X`20`20 X`20`20int`20read_reg_file() X`20`20`7B X!`20`20`20char`20*in_line,`20*itm_list,`20new_name`5B128`5D,`20*old_dir_typ; X!`20`20`20int`20systime,`20f_itm,`20l_itm,`20g`20=`200,`20ca_i`20=`201,`20ca_m Vsize,`20new_cg; X`20`20`20`20FILE`20*dotnewsrc; X`20`20`20`20GRP_PTR`20l_ga,`20*ca; X`20`20 X---`20154,161`20----- X`20`20 X`20`20int`20read_reg_file() X`20`20`7B X!`20`20`20char`20*in_line,`20*itm_list,`20*old_dir_typ; X!`20`20`20int`20systime,`20f_itm,`20l_itm,`20g`20=`200,`20ca_i`20=`201,`20ca_m Vsize; X`20`20`20`20FILE`20*dotnewsrc; X`20`20`20`20GRP_PTR`20l_ga,`20*ca; X`20`20 X************** X***`20244,250 X`20`20`20`20`20`20++in_line; X`20`20`20`20`20`20`7D X`20`20#endif X!`20`20`20if`20((new_vals`20=`20sscanf(in_line,"%X`20%s`20%d",`26systime,new_n Vame,`26new_ci))`20>=`201)`20sys_reg_time`20=`20systime; X`20`20 X`20`20`20`20while`20((in_line`20=`20fgetl(newsrc))`20!=`200)`20`7B X`20`20`20`20`20`20if`20(!strlen(in_line)`20`7C`7C`20in_line`5B0`5D`20==`20'`5C Vn')`20continue; X---`20249,255`20----- X`20`20`20`20`20`20++in_line; X`20`20`20`20`20`20`7D X`20`20#endif X!`20`20`20if`20((new_vals`20=`20sscanf(in_line,"%X`20%s`20%d",`26systime,new_c Vg_name,`26new_ci))`20>=`201)`20sys_reg_time`20=`20systime; X`20`20 X`20`20`20`20while`20((in_line`20=`20fgetl(newsrc))`20!=`200)`20`7B X`20`20`20`20`20`20if`20(!strlen(in_line)`20`7C`7C`20in_line`5B0`5D`20==`20'`5C Vn')`20continue; X************** X***`20356,363 X`20`20`20`20`20`20`7D X`20`20`20`20if`20(fclose(newsrc))`20_ck_close(newsrc); X`20`20`20`20newsrc`20=`200; X-`20`20`20if`20((new_vals`20>=`202)`20`26`26`20(new_cg`20=`20ga_exact_name(new V_name)))`20curr_g`20=`20new_cg; X-`20`20`20else`20new_vals`20=`202; X`20`20`20`20set_level(1); X`20`20 X`20`20`20`20if`20(profile_filter`20`26`26`20!reorder_groups)`20`7B X---`20361,366`20----- X`20`20`20`20`20`20`7D X`20`20`20`20if`20(fclose(newsrc))`20_ck_close(newsrc); X`20`20`20`20newsrc`20=`200; X`20`20`20`20set_level(1); X`20`20 X`20`20`20`20if`20(profile_filter`20`26`26`20!reorder_groups)`20`7B X************** X***`20457,463 X`20`20`20`20`20`20`20`20if`20(g`20<`20ca_i)`20ga`5Bg`5D`20=`20ca`5Bg`5D; X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20ga_size`20=`20ca_i`20-`201; X-`20`20`20`20`20curr_g`20=`20ga_exact_name(new_name); X`20`20`20`20`20`20`7D X`20`20 X`20`20`20`20sysprv(); X---`20460,465`20----- X`20`20`20`20`20`20`20`20if`20(g`20<`20ca_i)`20ga`5Bg`5D`20=`20ca`5Bg`5D; X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20ga_size`20=`20ca_i`20-`201; X`20`20`20`20`20`20`7D X`20`20 X`20`20`20`20sysprv(); X************** X***`20498,504 X`20`20`0C X`20`20int`20reg_context() X`20`20`7B X!`20`20`20int`20i; X`20`20`20`20ITM_PTR`20iap; X`20`20`20`20struct`20dir_class`20*ch`20=`20c_head; X`20`20 X---`20500,506`20----- X`20`20`0C X`20`20int`20reg_context() X`20`20`7B X!`20`20`20int`20i,`20new_cg`20=`200; X`20`20`20`20ITM_PTR`20iap; X`20`20`20`20struct`20dir_class`20*ch`20=`20c_head; X`20`20 X************** X***`20515,520 X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`7D X`20`20 X`20`20`20`20if`20(smg_active)`20`7B X`20`20`20`20`20`20if`20(force_dir)`20do_dir(force_dir,0); X`20`20`20`20`20`20else`20`7B X---`20517,525`20----- X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`7D X`20`20 X+`20`20`20if`20((new_vals`20>=`202)`20`26`26`20(new_cg`20=`20ga_exact_name(new V_cg_name)))`20curr_g`20=`20new_cg; X+`20`20`20else`20new_vals`20=`202; X+`20 X`20`20`20`20if`20(smg_active)`20`7B X`20`20`20`20`20`20if`20(force_dir)`20do_dir(force_dir,0); X`20`20`20`20`20`20else`20`7B X************** X***`20538,543 X`20`20`20`20`20`20`20`20if`20((!*profile_dirstr)`20`26`26`20old_dir_lev) X`20`20`20`20`20`20`20`20`20`20do_dir(old_dir_lev,curr_class`20!=`20(struct`20d Vir_class`20*)`200); X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`7D X`20`20 X`20`20`20`20if`20((new_vals`20==`203)`20`26`26`20(ga`5Bcurr_g`5D->grp_count)) V`20`7B X---`20543,552`20----- X`20`20`20`20`20`20`20`20if`20((!*profile_dirstr)`20`26`26`20old_dir_lev) X`20`20`20`20`20`20`20`20`20`20do_dir(old_dir_lev,curr_class`20!=`20(struct`20d Vir_class`20*)`200); X`20`20`20`20`20`20`20`20`7D X+`20`20`20`20`20if`20(new_cg`20`26`26`20!ga`5Bnew_cg`5D->grp_display_indx)`20 V`7B X+`20`20`20`20`20`20`20if`20(ga`5Bnew_cg`5D->grp_reg)`20do_dir(DIR_REGISTER`20+ V`201,0); X+`20`20`20`20`20`20`20else`20do_dir(DIR_ALL`20+`201,0); X+`20`20`20`20`20`20`20`7D`20`20 X`20`20`20`20`20`20`7D X`20`20 X`20`20`20`20if`20(new_cg)`20cur_set_grp(new_cg); X************** X***`20540,545 X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`7D X`20`20 X`20`20`20`20if`20((new_vals`20==`203)`20`26`26`20(ga`5Bcurr_g`5D->grp_count)) V`20`7B X`20`20`20`20`20`20set_level(2); X`20`20`20`20`20`20if`20(new_ci`20<=`20ga`5Bcurr_g`5D->grp_ia`5B1`5D.itm_num) X---`20549,555`20----- X`20`20`20`20`20`20`20`20`7D`20`20 X`20`20`20`20`20`20`7D X`20`20 X+`20`20`20if`20(new_cg)`20cur_set_grp(new_cg); X`20`20`20`20if`20((new_vals`20==`203)`20`26`26`20(ga`5Bcurr_g`5D->grp_count)) V`20`7B X`20`20`20`20`20`20set_level(2); X`20`20`20`20`20`20if`20(new_ci`20<=`20ga`5Bcurr_g`5D->grp_ia`5B1`5D.itm_num) X***`20patchlist.h;-1 X---`20patchlist.h X************** X***`201,1 X`20`20=+=+=`20End`20=+=+= X---`201,2`20----- X+`20940624_newsrc.c!bailey@genetics.upenn.edu X`20`20=+=+=`20End`20=+=+= $ call unpack 940624_NEWSRC.PATCH - 544336787 "FORMAT STREAM_LF;CARRIAGE_CONTROL CARRIAGE_RETURN" 9 1 1 $ v=f$verify(v) $ exit