....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 205.196.210.190  /  Your IP : 216.73.216.241
Web Server : Apache
System : Linux pdx1-shared-a2-06 6.6.116-grsec-jammy-dirty #1 SMP Sat Nov 8 00:02:42 UTC 2025 x86_64
User : dh_2vi232 ( 5939701)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/bin/tknewsbiff
#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh8.6 "$0" ${1+"$@"}

package require Expect
if {[catch {package require Tk}]} {
    puts stderr "This script require Tk to run. You can install the tk8.6 package for that."
    exit 1
}

# Name: tknewsbiff
# Author: Don Libes
# Version: 1.2b
# Written: January 1, 1994

# Description: When unread news appears in your favorite groups, pop up
# a little window describing which newsgroups and how many articles.
# Go away when articles are no longer unread.
# Optionally, run a UNIX program (to play a sound, read news, etc.)

# Default config file in ~/.tknewsbiff[-host]

# These two procedures are needed because Tk provides no command to undo
# the "wm unmap" command.  You must remember whether it was iconic or not.
# PUBLIC
proc unmapwindow {} {
	global _window_open

	switch [wm state .] \
	iconic {
		set _window_open 0
	} normal {
		set _window_open 1
	}
	wm withdraw .
}
unmapwindow
# window state starts out as "iconic" before it is mapped, Tk bug?
# make sure that when we map it, it will be open (i.e., "normal")
set _window_open 1

# PUBLIC
proc mapwindow {} {
	global _window_open

	if {$_window_open} {
		wm deiconify .
	} else {
		wm iconify .
	}
}

proc _abort {msg} {
	global argv0

	puts "$argv0: $msg"
	exit 1
}

if {[info exists env(DOTDIR)]} {
	set home $env(DOTDIR)
} else {
	set home [glob ~]
}

set delay		  60
set width		  27
set height		  10
set _default_config_file  $home/.tknewsbiff
set _config_file	  $_default_config_file
set _default_server	  news
set server		  $_default_server
set server_timeout	  60

log_user 0

listbox .list -yscroll ".scrollbar set" -font "*-m-*" -setgrid 1
scrollbar .scrollbar -command ".list yview" -relief raised
.list config -highlightthickness 0 -border 0
.scrollbar config -highlightthickness 0
pack .scrollbar -side left -fill y
pack .list -side left -fill both -expand 1

while {[llength $argv]>0} {
	set arg [lindex $argv 0]

	if {[file readable $arg]} {
		if {0==[string compare active [file tail $arg]]} {
			set active_file $arg
			set argv [lrange $argv 1 end]
		} else {
			# must be a config file
			set _config_file $arg
			set argv [lrange $argv 1 end]
		}
	} elseif {[file readable $_config_file-$arg]} {
		# maybe it's a hostname suffix for a newsrc file?
		set _config_file $_default_config_file-$arg
		set argv [lrange $argv 1 end]
	} else {
		# maybe it's just a hostname for regular newsrc file?
		set server $arg
		set argv [lrange $argv 1 end]
	}
}

proc _read_config_file {} {
	global _config_file argv0 watch_list ignore_list

	# remove previous user-provided proc in case user simply
	# deleted it from config file
	proc user {} {}

	set watch_list {}
	set ignore_list {}

	if {[file exists $_config_file]} {
		# uplevel allows user to set global variables
		if {[catch {uplevel source $_config_file} msg]} {
			_abort "error reading $_config_file\n$msg"
		}
	}

	if {[llength $watch_list]==0} {
		watch *
	}
}

# PUBLIC
proc watch {args} {
	global watch_list

	lappend watch_list $args
}

# PUBLIC
proc ignore {ng} {
	global ignore_list

	lappend ignore_list $ng
}

# get time and server
_read_config_file

# if user didn't set newsrc, try ~/.newsrc-server convention.
# if that fails, fall back to just plain ~/.newsrc
if {![info exists newsrc]} {
	set newsrc $home/.newsrc-$server
	if {![file readable $newsrc]} {
		set newsrc $home/.newsrc
		if {![file readable $newsrc]} {
			_abort "cannot tell what newgroups you read
found neither $home/.newsrc-$server nor $home/.newsrc"
		}
	}
}

# PRIVATE
proc _read_newsrc {} {
	global db newsrc

	if {[catch {set file [open $newsrc]} msg]} {
		_abort $msg
	}
	while {-1 != [gets $file buf]} {
		if {[regexp "!" $buf]} continue
		if {[regexp "(\[^:]*):.*\[-, ](\[0-9]+)" $buf dummy ng seen]} {
			set db($ng,seen) $seen
		}
		# only way 2nd regexp can fail is on lines
		# that have a : but no number
	}
	close $file
}

proc _unknown_host {} {
	global server _default_server

	if {0==[string compare $_default_server $server]} {
		puts "tknewsbiff: default server <$server> is not known"
	} else {
		puts "tknewsbiff: server <$server> is not known"
	}

	puts "Give tknewsbiff an argument - either the name of your news server
or active file.  I.e.,

	tknewsbiff news.nist.gov
	tknewsbiff /usr/news/lib/active

If you have a correctly defined configuration file (.tknewsbiff),
an argument is not required.  See the man page for more info."
	exit 1
}

# read active file
# PRIVATE
proc _read_active {} {
	global db server active_list active_file
	upvar #0 server_timeout timeout

	set active_list {}

	if {[info exists active_file]} {
		spawn -open [open $active_file]
	} else {
		spawn telnet $server nntp
		expect {
			"20*\n" {
				# should get 200 or 201
			} "NNTP server*\n" {
				puts "tknewsbiff: unexpected response from server:"
				puts "$expect_out(buffer)"
				return 1
			} "unknown host" {
				_unknown_host
			} timeout {
				close
				wait
				return 1
			} eof {
				# loadav too high probably
				wait
				return 1
			}
		}
		exp_send "list\r"
		expect "list\r\n"	;# ignore echo of "list" command
		expect -re "215\[^\n]*\n" ;# skip "Newsgroups in form" line
	}
	
	expect {
		-re "(\[^ ]*) 0*(\[^ ]+) \[^\n]*\n" {
			set ng $expect_out(1,string)
			set hi $expect_out(2,string)
			lappend active_list $ng
			set db($ng,hi) $hi
			exp_continue
		}
		".\r\n" close
		".\r\r\n" close
		timeout close
		eof
	}

	wait
	return 0
}

# test in various ways for good newsgroups
# return 1 if good, 0 if not good
# PRIVATE
proc _isgood {ng threshold} {
	global db seen_list ignore_list

	# skip if we don't subscribe to it
	if {![info exists db($ng,seen)]} {return 0}

	# skip if the threshold isn't exceeded
	if {$db($ng,hi) - $db($ng,seen) < $threshold} {return 0}

	# skip if it matches an ignore command
	foreach igpat $ignore_list {
		if {[string match $igpat $ng]} {return 0}
	}

	# skip if we've seen it before
	if {[lsearch -exact $seen_list $ng]!=-1} {return 0}

	# passed all tests, so remember that we've seen it
	lappend seen_list $ng
	return 1
}

# return 1 if not seen on previous turn
# PRIVATE
proc _isnew {ng} {
	global previous_seen_list

	if {[lsearch -exact $previous_seen_list $ng]==-1} {
		return 1
	} else {
		return 0
	}
}

# schedule display of newsgroup in global variable "newsgroup"
# PUBLIC
proc display {} {
	global display_list newsgroup

	lappend display_list $newsgroup
}

# PRIVATE
proc _update_ngs {} {
	global watch_list active_list newsgroup

	foreach watch $watch_list {
		set threshold 1
		set display display
		set new {}

		set ngpat [lindex $watch 0]
		set watch [lrange $watch 1 end]

		while {[llength $watch] > 0} {
			switch -- [lindex $watch 0] \
			-threshold {
				set threshold [lindex $watch 1]
				set watch [lrange $watch 2 end]
			} -display {
				set display [lindex $watch 1]
				set watch [lrange $watch 2 end]
			} -new {
				set new [lindex $watch 1]
				set watch [lrange $watch 2 end]
			} default {
				_abort "watch: expecting -threshold -display or -new but found: [lindex $watch 0]"
			}
		}

		foreach ng $active_list {
			if {[string match $ngpat $ng]} {
				if {[_isgood $ng $threshold]} {
					if {[llength $display]} {
						set newsgroup $ng
						uplevel $display
					}
					if {[_isnew $ng]} {
						if {[llength $new]} {
							set newsgroup $ng
							uplevel $new
						}
					}
				}
			}
		}
	}
}

# initialize display

set min_reasonable_width 8

wm minsize . $min_reasonable_width 1
wm maxsize . 999 999
if {0 == [info exists active_file] && 
    0 != [string compare $server $_default_server]} {
	wm title . "news@$server"
	wm iconname . "news@$server"
}

# PRIVATE
proc _update_window {} {
	global server display_list height width min_reasonable_width

	if {0 == [llength $display_list]} {
		unmapwindow
		return
	}

	# make height correspond to length of display_list or
	# user's requested max height, whichever is smaller
	
	if {[llength $display_list] < $height} {
		set current_height [llength $display_list]
	} else {
		set current_height $height
	}

	# force reasonable min width
	if {$width < $min_reasonable_width} {
		set width $min_reasonable_width
	}

	wm geometry . ${width}x$current_height
	wm maxsize . 999 [llength $display_list]

	_display_ngs $width

	if {[string compare [wm state .] withdrawn]==0} {
		mapwindow
	}
}

# actually write all newsgroups to the window
# PRIVATE
proc _display_ngs {width} {
	global db display_list

	set str_width [expr $width-7]

	.list delete 0 end
	foreach ng $display_list {
		.list insert end [format \
			"%-$str_width.${str_width}s %5d" $ng \
			[expr $db($ng,hi) - $db($ng,seen)]]
	}
}

# PUBLIC
proc help {} {
	catch {destroy .help}
	toplevel .help
	message .help.text -aspect 400 -text \
{tknewsbiff - written by Don Libes, NIST, 1/1/94

tknewsbiff displays newsgroups with unread articles based on your .newsrc\
and your .tknewsbiff files.\
If no articles are unread, no window is displayed.

Click mouse button 1 for this help,\
button 2 to force display to query news server immediately,\
and button 3 to remove window from screen until the next update.

Example .tknewsbiff file:}
	message .help.sample -font "*-r-normal-*-m-*" \
	-relief raised -aspect 10000 -text \
{set width	30		;# max width, defaults to 27
set height	17		;# max height, defaults to 10
set delay	120		;# in seconds, defaults to 60
set server	news.nist.gov	;# defaults to "news"
set server_timeout 60		;# in seconds, defaults to 60
set newsrc	~/.newsrc	;# defaults to ~/.newsrc
				;# after trying ~/.newsrc-$server
# Groups to watch.
watch comp.lang.tcl
watch dc.dining		-new "play yumyum"
watch nist.security	-new "exec red-alert"
watch nist.*
watch dc.general	-threshold 5
watch *.sources.*	-threshold 20
watch alt.howard-stern	-threshold 100 -new "play robin"

# Groups to ignore (but which match patterns above).
# Note: newsgroups that you don't read are ignored automatically.
ignore *.d
ignore nist.security
ignore nist.sport

# Change background color of newsgroup list
.list config -bg honeydew1

# Play a sound file
proc play {sound} {
	exec play /usr/local/lib/sounds/$sound.au
}}
	message .help.end -aspect 10000 -text \
"Other customizations are possible.  See man page for more information."

	button .help.ok -text "ok" -command {destroy .help}
	pack .help.text
	pack .help.sample
	pack .help.end -anchor w
	pack .help.ok -fill x -padx 2 -pady 2
}

spawn cat -u; set _cat_spawn_id $spawn_id
set _update_flag 0

# PUBLIC
proc update-now {} {
	global _update_flag _cat_spawn_id

	if {$_update_flag} return	;# already set, do nothing
	set _update_flag 1

	exp_send -i $_cat_spawn_id "\r"
}

bind .list <1> help
bind .list <2> update-now
bind .list <3> unmapwindow
bind .list <Configure> {
	scan [wm geometry .] "%%dx%%d" w h
	_display_ngs $w
}

# PRIVATE
proc _sleep {timeout} {	
	global _cat_spawn_id _update_flag

	set _update_flag 0

	# restore to idle cursor
	.list config -cursor ""; update

	# sleep for a little while, subject to click from "update" button
	expect -i $_cat_spawn_id -re "...."	;# two crlfs

	# change to busy cursor
	.list config -cursor watch; update
}

set previous_seen_list {}
set seen_list {}

# PRIVATE
proc _init_ngs {} {
	global display_list db
	global seen_list previous_seen_list

	set previous_seen_list $seen_list

	set display_list {}
	set seen_list {}

	catch {unset db}
}

for {} {1} {_sleep $delay} {
	_init_ngs

	_read_newsrc
	if {[_read_active]} continue
	_read_config_file

	_update_ngs
	user
	_update_window
}

Youez - 2016 - github.com/yon3zu
LinuXploit