#!/usr/bin/tcl #### A revised copy of: #### "friends" #### #### A customizable Tcl script for printing out processed finger information #### #### Data from finger is more useful than from rwho because it includes #### the name of the person, not just their username. #### #### Also, location data has been updated. #### #### 11/27/02 #### Samuel Lipoff #### lipoff@fas.harvard.edu #### ### friends ### v1.71 ### 3/2/02 ### The Basketball Edition ### phli@hotmail.com ### ### A customizable Tcl script for printing out processed rwho information ### Setup info ## To setup friends v1.5 correctly, first create a bin directory if you do ## not have one already (type ls at the prompt to check): ## fas% mkdir ~/bin ## Next, edit your .cshrc file to add this line: ## ## set path=($path ~/bin) ## ## Again, this is not necessary if you already have a bin directory set up. ## ## Next, create a file using pico containing the login names of everyone you are ## interested in, one on each line . e.g.: ## ## fas% pico ## ## jharvard ## lsummers ## jknowles ## ## and save the file as ~/.friends. ## ## If you followed all these instructions correctly, you should be all set. # set friends_file "/.friends" # Process command line arguments # ... Defaults set ALL false set FORMAT true set COLOR true # ... Settings if { [ regexp {^.*-(nc|nf)*a.*$} $argv ] } { set ALL true } if { [ regexp {^.*-(a|nc)*nf.*$} $argv ] } { set FORMAT false } if { [ regexp {^.*-(a|nf)*nc.*$} $argv ] } { set COLOR false } ### ANSI escape codes ## Here are handles for the ANSI escape codes you might want to use to style ## your output. See the Style and Formatting section below for more ## information. ## Note: not all escape codes work with all terminal emulators. For example, ## if your terminal doesn't support ANSI color, then obviously you won't see ## any colors regardless of what setting you use. # # Declarations set PLAIN {} set BOLD {} set UNDERLINE {} set BLINK {} set INVERTED {} set INVISIBLE {} set BLACK {} set RED {} set GREEN {} set YELLOW {} set BLUE {} set MAGENTA {} set CYAN {} set WHITE {} set BGBLACK {} set BGRED {} set BGGREEN {} set BGYELLOW {} set BGBLUE {} set BGMAGENTA {} set BGCYAN {} set BGWHITE {} # Settings if { $FORMAT } { # Font Format set PLAIN {} set BOLD {} set UNDERLINE {} set BLINK {} set INVERTED {} set INVISIBLE {} if { $COLOR} { # Foreground Colors set BLACK {} set RED {} set GREEN {} set YELLOW {} set BLUE {} set MAGENTA {} set CYAN {} set WHITE {} # Background Colors set BGBLACK {} set BGRED {} set BGGREEN {} set BGYELLOW {} set BGBLUE {} set BGMAGENTA {} set BGCYAN {} set BGWHITE {} } } ### Formatting and Style selection ## Variables controlling the style and column width of the output. Set them to ## whatever style and format you desire. The possible Style codes are set ## above. ## # # General Codes set HEADER "$UNDERLINE" set BODY "" # Column Specific Codes # The first element of each list should indicate whether or not the list # will appear in the output. # # The second element of each list will be the column width formatting. (see # "man 3 printf" for more information on the syntax of the formatting command) # # The third element will be the style, e.g. coloring, underlining, etc. (see # above for possible style codes you can use). # # The fourth element will be used as the list header in the readout. You can # set this to anything you want although if it is too long it will be truncated. # set login_list "{{ON} {%-8.8s } {$GREEN} {Login}} " set name_list "{{ON} {%-24.24s } {$RED} {Name}} " set host_list "{{ON} {%-5.5s } {} {Host }} " set idle_list "{{ON} {%5.5s } {$BLUE} {Idle }} " set remotehost_list "{{ON} {%-34.34s } {} {Remote Host}}" set location_list "{{ON} {%-28.28s} {$CYAN} {Location}} " proc head_index { headed_list index } { return [ lindex [ lindex $headed_list 0 ] $index ] } proc on_p { headed_list } { return [ expr { [ head_index $headed_list 0 ] == "ON" } ] } # Query current rwho data to see who is currently online. # Filter the rwho data using the friends list you provided. # Grep returns an error if it finds no one, so we must catch this. set retval [ catch { if { $ALL } { set inputs [ split [ exec finger -width 32,4,4,40 ] \n ] } else { set inputs [ split [ exec finger -width 32,4,4,40 | grep -wf $env(HOME)$friends_file ] \n ] } } ] if { $retval != 0 } { puts "$BODY\No one is online!$PLAIN" exit 0 } # Process input columns (Builds all lists even if some won't be used) foreach input $inputs { lappend login_list [ string range $input 0 7 ] lappend name_list [ string range $input 9 41 ] lappend idle_list [ string range $input 48 52 ] lappend host_list [ string range $input 57 61 ] lappend remotehost_list [ string range $input 63 end ] } ### Location Translation Arrays ## These arrays of locations are constantly being updated. ## You can add locations as you find them by adding key/value pairs to the ## appropriate array. ## The key entries are regular expressions. Check "man n regexp" for more ## information # array set roam_key_array { {^roam23-[0-9]*\.fas\.harvard} {Science Center Basement} {^roam36-[0-9]*\.fas\.harvard} {Science Center} {^roam37-[0-9]*\.fas\.harvard} {Science Center} {^roam39-32\.fas\.harvard} {Science Center eMac Kiosk} {^roam59-[0-9]*\.fas} {Maxwell Dworkin} {^roam67-[0-9]*\.student\.harvard} {Canaday} {^roam68} {Paine} {^roam69-[0-9]*\.student\.harvard} {Holworthy} {^roam70} {University Hall} {^roam71-[0-9]*\.student\.harvard} {Canaday} {^roam72} {Widener} {^roam73-[0-9]*\.student\.harvard} {Thayer} {^roam75-[0-9]*\.student\.harvard} {Weld} {^roam76} {Barker Center West} {^roam77-[0-9]*\.student\.harvard} {Wigglesworth} {^roam78} {Barker Center East} {^roam79-[0-9]*\.student\.harvard} {Grays} {^roam80} {Boylston} {^roam81-[0-9]*\.student\.harvard} {Matthews} {^roam82} {Sever, Emerson, Robinson, Carpenter, Harvard Hall} {^roam83-[0-9]*\.student\.harvard} {Strauss, Mass Hall, Lehman} {^roam84} {Fogg Art Museum} {^roam85-[0-9]*\.student\.harvard} {Stoughton, Hollis, Mower, Lionel} {^roam86} {Sackler Museum} {^roam87-[0-9]*\.student\.harvard} {Hurlbut, Pennypacker} {^roam88} {FDO, Prescott Street} {^roam89-[0-9]*\.student\.harvard} {Greenough} {^roam93} {WJH} {^roam94} {WJH} {^roam95} {WJH} {^roam96} {MCZ} {^roam97} {MCZ Labs} {^roam98} {Herbaria} {^roam99} {Lamont} {^roam100} {Shannon, Tozzer, Semitic Museum, 2 Divinity, Bryant} {^roam101} {Fairchild} {^roam102} {Peabody} {^roam103} {Perkins (GSAS)} {^roam104} {Cruft} {^roam105} {Conant, Richards (GSAS)} {^roam106} {MCB} {^roam107} {MCB} {^roam108} {38 Kirkland Street} {^roam109} {MCB} {^roam110} {Busch} {^roam111} {MCB} {^roam112} {Vanserg} {^roam113} {Adapt} {^roam114} {Coolidge Hall (Reischauer)} {^roam116} {Coolidge Hall} {^roam118} {Memorial Hall, Lowell Hall} {^roam119} {MCZ, OEB} {^roam121} {UA Help Desk (SCB13)} {^roam125} {Widener Ref Kiosk} {^roam129-[0-9]*\.student\.harvard} {Eliot (O hub)} {^roam131-[0-9]*\.student\.harvard} {Adams (Apthorp, Russell, Westmorley)} {^roam133-[0-9]*\.student\.harvard} {10 DeWolfe} {^roam135-[0-9]*\.student\.harvard} {20 DeWolfe} {^roam141-[0-9]*\.student\.harvard} {Lowell House} {^roam142-[0-9]*\.fas\.harvard} {Lowell House} {^roam143-[0-9]*\.student\.harvard} {Lowell House} {^roam145-[0-9]*\.student\.harvard} {Old Quincy (B, F hubs)} {^roam147-[0-9]*\.student\.harvard} {New Quincy (S hub)} {^roam149-[0-9]*\.student\.harvard} {New Quincy (M hub)} {^roam151-[0-9]*\.student\.harvard} {Old Leverett} {^roam153-[0-9]*\.student\.harvard} {Leverett F Tower, Library} {^roam155-[0-9]*\.student\.harvard} {Leverett F Tower, G Tower} {^roam157-[0-9]*\.student\.harvard} {Dunster (C, E, K hubs)} {^roam159-[0-9]*\.student\.harvard} {Dunster (A, H, M hubs)} {^roam161-[0-9]*\.student\.harvard} {Mather Lowrise} {^roam163-[0-9]*\.student\.harvard} {Mather Lowrise, Tower} {^roam165-[0-9]*\.student\.harvard} {Winthrop} {^roam166} {University Hall} {^roam167-[0-9]*\.student\.harvard} {Winthrop} {^roam168} {OCS} {^roam169-.*\.student\.harvard} {Eliot (F, J hubs)} {^roam170-[0-9]*\.fas\.harvard} {Advocate, OFA, 78 Mt Auburn} {^roam171-.*\.student\.harvard} {Eliot (B, C, H hubs)} {^roam172} {Weld Boat House, MAC} {^roam173-[0-9]*\.student\.harvard} {Kirkland (Smith, Bryan)} {^roam174-[0-9]*\.hsa\.harvard} {HSA (67 Mt Auburn, 17 Holyoke)} {^roam175-[0-9]*\.student\.harvard} {Kirkland (Smith)} {^roam177-[0-9]*\.student\.harvard} {Claverly, Apley} {^roam179-[0-9]*\.student\.harvard} {Adams (Randolph)} {^roam181-[0-9]*\.student\.harvard} {Currier (Daniels, Gilbert)} {^roam182} {Hilles Library} {^roam183-[0-9]*\.student\.harvard} {Currier (Bingham, Tuchman)} {^roam185-[0-9]*\.student\.harvard} {Pfoho (Jordan, Moors)} {^roam186} {Loeb} {^roam187-[0-9]*\.student\.harvard} {Pfoho (Comstock, Wolbach)} {^roam188} {Byerly} {^roam189-[0-9]*\.student\.harvard} {Cabot House (E-H)} {^roam191-[0-9]*\.student\.harvard} {Cabot House (I-L, Walker St)} {^roam192} {Registrar} {^roam193-[0-9]*\.student\.harvard} {Cabot House (A-D, M-N)} {^roam197-[0-9]*\.dce\.harvard} {51 Brattle Street (Ext School)} {^roam203-[0-9]*\.student\.harvard} {Harkness Commons iMac Kiosk} {^roam212-[0-9]*\.fas\.harvard} {Littauer} {^roam223-[0-9]*\.law\.harvard} {Langdell Library} {^roam225-[0-9]*\.law\.harvard} {Langdell Library} {^roam227-[0-9]*\.law\.harvard} {Langdell Library} {^roam240-[0-9]*\.fas} {Wireless (FAS)} {^roam241-[0-9]*\.fas} {Wireless (FAS)} {^roam248-[0-9]*\.fas} {Rockefeller Ctr (61 Kirkland)} } array set net_key_array { {^net-13915\.fas\.harvard\.edu} {SC B11 (PC Lab)} {^net-141(4[0-9]|5[^26]|6[01])\.fas\.harvard\.edu} {SC B11 (PC Lab)} {^net-2924[12]\.fas\.harvard\.edu} {SC B11 (PC Lab)} {^net-30000\.fas\.harvard\.edu} {SC B11 (PC Lab)} {^net-31[78][0-9][0-9]\.fas\.harvard\.edu} {SC B11c (Mac Lab)} {^net-13774\.student\.harvard\.edu} {SC B14 PC} {^net-14(27[78]|3[01][0-9])\.fas\.harvard.edu} {SC B14 PC} {^net-1716[67]\.fas\.harvard\.edu} {SC B14 PC} {^net-19072\.fas\.harvard\.edu} {SC B14 PC} {^net-193[8-9][0-9]\.fas\.harvard\.edu} {SC B14 Mac} {^net-1940[^8]\.fas\.harvard\.edu} {SC B14 Mac} {^net-1941[05]\.fas\.harvard\.edu} {SC B14 Mac} {^net-36275\.fas\.harvard\.edu} {SC B14 iMac} {^net-43714\.fas} {SC B14 Help Desk} {^net-19408\.fas\.harvard\.edu} {SC 120 (Inst Comp Lab)} {^net-1941[^05]\.fas\.harvard\.edu} {SC 120 (Inst Comp Lab)} {^net-194[2-4][0-9]\.fas\.harvard\.edu} {SC 120 (Inst Comp Lab)} {^net-(8443|12511)\.fas\.harvard\.edu} {Biology Labs North} {^net-2(4884|8722)\.fas\.harvard.\edu} {Biology Labs North} {^net-29(704|929)\.fas\.harvard\.edu} {Biology Labs North} {^net-31(119|65[567])\.fas\.harvard\.edu} {Biology Labs North} {^net-35(180|516)\.fas\.harvard\.edu} {Biology Labs North} {^net-36(176|586|736|918)\.fas\.harvard\.edu} {Biology Labs North} {^net-36(59[67]|77[67]|97[03])\.fas\.harvard\.edu} {Biology Labs North} {^net-37(223|733)\.fas\.harvard\.edu} {Biology Labs North} {^net-38(192|331)\.fas\.harvard\.edu} {Biology Labs North} {^net-39(114|222|471)\.fas\.harvard\.edu} {Biology Labs North} {^net-37047\.fas\.harvard\.edu} {Loker Basement iMac} {^net-30845} {Robinson Hall Library} {^net-32342} {Harvard-Yenching Library} {^net-25235\.fas\.harvard\.edu} {Electronic Music Studio (Paine)} {^net-44210\.fas\.harvard\.edu} {Paine Music Library} {^net-5857\.wjh\.harvard\.edu} {WJH 2nd Floor iMac} {^net-rrpc} {Littauer Library} {^net-[0-9]*\.wjh\.harvard\.edu} {William James Hall} {^net-[1-4][0-9]*\.hsa\.harvard\.edu} {HSA (67 Mt Auburn, 17 Holyoke)} } array set rest_key_array { {^quincy} {Quincy Computer Lab} {^oquincy} {Quincy Computer Lab} {^eliotc} {Eliot Computer Lab} {^lowell-lab} {Lowell Computer Lab} {^dunster} {Dunster Computer Lab} {^barnard-} {Cabot Computer Lab} {^standn-} {Winthrop Computer Lab} {^leverett} {Leverett Computer Lab} {^kirkland-lab} {Kirkland Computer Lab} {^kirkland-mac} {Kirkland Computer Lab (Mac)} {^comstock-} {Pforzheimer Computer Lab} {^child-lab} {Child Hall Computer Lab (GSAS)} {^lehman-lab} {Lehman Hall Computer Lab} {^tuchman-} {Currier Computer Lab} {^cur-} {Currier Computer Lab} {^qin} {Quincy Kiosk} {^lehman-kiosk} {Lehman Hall Kiosk} {^station[0-6]\.mcb\.harvard} {BioLabs Basement B108} {^leverli} {Leverett Library} {^jord.*\.harvard\.edu} {Jordan} {^greenough-[0-9]*\.student\.harvard\.edu} {Greenough} {^grays-17246.student} {Room 13 (Grays)} {^harvfoun} {Harvard Foundation (Thayer Bsmt)} {^ewc[0-9]*\.student\.harvard} {Evening w/Champions Office (Eliot)} {^hulmac[0-9]*\.harvard} {Harvard University Archives} {^whrb-[0-9]*\.student} {WHRB (Pennypacker Basement)} {^scbw-} {SC Basement} {^scb13-} {UA Help Desk (SCB13)} {^scetr} {SC B14 iMac} {^sc1-[0-9]*\.fas\.harvard\.edu} {Cabot Science Library} {^sc-225[89][0-9]\.fas\.harvard\.edu} {SC iMac Kiosk} {^sc-27010} {Cabot Science Library} {^sunray[12]\.fas\.harvard\.edu} {SC/Littauer Sun Ray Kiosk} {^scadm28} {Cabot Science Library} {^cassin-8\.fas} {SCAS Office (PBH)} {^busch-[0-9]*\.fas\.harvard} {Adolphus Busch Hall} {^station[0-6]\.mcb\.harvard} {BioLabs Basement B108} {^wjh[0-9]*\.wjh\.harvard\.edu} {William James Hall} {^wjh-[0-9]*\.wjh\.harvard\.edu} {William James Hall} {\.wjh\.harvard\.edu} {William James Hall} {^cspub.*\.wjh\.harvard\.edu} {WJH 1301 (Computer Lab)} {^wlurie\.fas\.harvard\.edu} {Robinson Hall (2F)} {^divin2-circdesk} {Harvard-Yenching Library} {^wjh-23427\.wjh\.harvard\.edu} {WJH 13th Floor iMac} {^rc133\.harvard\.edu} {Schlesinger Library (Radcliffe)} {\.cfa\.harvard\.edu} {Center for Astrophysics} {^hcs\.harvard\.edu} {Harvard Computer Society} {^murr-} {Murr Center} {^peab-} {Peabody Museum} {^hillel[0-9]*\.harvard} {Hillel} {^lrcpc[0-9]*\.fas\.harvard\.edu} {Lamont Language Lab (PC)} {^lrcmac[0-9]*\.fas\.harvard\.edu} {Lamont Language Lab (Mac)} {^fogg-[0-9]*\.fas\.harvard} {Fogg Art Museum} {^memhall.*\.fas\.harvard\.edu} {Loker iMac Kiosk} {^barker-kiosk[0-9]*\.fas\.harvard} {Barker iMac Kiosk} {^lamont-[0-9]*\.fas\.harvard\.edu} {Lamont iMac Kiosk} {^lamont-kiosk[0-9]*\.fas\.harvard} {Lamont iMac Kiosk} {^arch[0-8]*\.harvard\.edu} {Lamont Library (Gov Docs)} {^hillesi-kiosk.*\.fas\.harvard\.edu} {Hilles iMac Kiosk} {^hillesi-[0-9]*\.fas\.harvard\.edu} {Hilles Library} {^hillesiopen} {Hilles Library} {^hilliesiopen} {Hilles Library} {^hilles-lexis} {Hilles Library} {^hillesm-[0-9]*\.fas\.harvard\.edu} {Morse Music Library} {^hilles-[0-9]*\.fas\.harvard\.edu} {Hilles Library} {^white1\.fas\.harvard\.edu} {Coolidge Hall Library} {^white2\.fas\.harvard\.edu} {Coolidge Hall Library} {^hearst\.fas\.harvard\.edu} {Coolidge Hall Library} {^cool-[0-9]*\.fas\.harvard\.edu} {Coolidge Hall} {^slivings-4\.student} {Cabot House Office} {^lehman-mac[0-9]*\.student} {Lehman Hall} {^leh-ksk-} {Lehman Hall Kiosk} {^prescott8-[0-9]*\.fas} {Expos (8 Prescott)} {^slsmac[0-9]} {Cancer Cell Biology} {^laspau} {LASPAU (25 Mt Auburn)} {^indy-[0-9]*\.student.harvard.edu} {Harvard Independent} {^boylst-[0-9]*\.fas.harvard.edu} {Boylston Hall} {^boylston} {Boylston Hall} {^byerly-} {Byerly Hall} {^hfc-admin-.*\.harvard\.edu} {Faculty Club} {^sacram3-[0-9]*\.student} {Dudley Co-op (3 Sacramento)} {^nas[0-9].*\.fas\.harvard\.edu} {Harvard Modem Pool} {^biacore} {Biology Labs} {^ksg[ab][0-9]*\.harvard\.edu} {Kennedy School of Govt} {^ksg-[0-9]*-.*\.harvard\.edu} {Kennedy School of Govt} {^ccb97-.*\.harvard\.edu} {Zhuang Research Group} {^ccb96-.*\.harvard\.edu} {Lieber Research Group} {^p[1-9].harvard\.edu} {Park Research Group} {^ccb[0-8]*-.*\.harvard\.edu} {Harvard Chemistry} {^ccb[0-9][0-5]-.*\.harvard\.edu} {Harvard Chemistry} {^ccb[0-9][8-9]-.*\.harvard\.edu} {Harvard Chemistry} {^chemlib} {Chemistry Department Library} {^cfsa*-[0-9]*\.fas\.harvard\.edu} {Concord Field Station} {^wab[0-9]*\.harvard\.edu} {Warren Alpert (200 Longwood)} {\.jcrt\.harvard\.edu} {Jnt Cen Rad Ther (HMS)} {\.cbr\.harvard\.edu} {Center for Blood Res (HMS)} {\.mcb\.harvard\.edu} {Dept of Molecular Cell Biology} {^joslin[0-9]*\.harvard\.edu} {Joslin Diabetes Ctr (HMS)} {\.joslin\.harvard\.edu} {Joslin Diabetes Ctr (HMS)} {^sph[0-9]*-.*\.harvard\.edu} {Sch Pub Health (LMA)} {\.sph\.harvard\.edu} {Sch Pub Health (LMA)} {\.physics\.harvard\.edu} {Harvard Physics} {\.deas\.harvard\.edu} {Engineering and Applied Sciences} {\.eas\.harvard\.edu} {Engineering and Applied Sciences} {\.eecs\.harvard\.edu} {Maxwell Dworkin} {\.hrl\.harvard\.edu} {Robotics Laboratory} {^pbh-.*\.fas\.harvard\.edu} {Phillips Brooks House} {^paine-.*\.fas\.harvard\.edu} {Paine Hall} {^sever-.*\.fas\.harvard} {Sever} {^svr-ksk-21838\.fas\.harvard} {Sever 2nd Floor iMac} {^emerson-.*\.fas\.harvard} {Emerson} {^robinson-.*\.fas\.harvard} {Robinson} {^carpenter-.*\.fas\.harvard} {Carpenter Center} {^loeb.*\.harvard\.edu} {ART Loeb Theater} {^dkirshe} {ART Loeb Theater} {^hrdc} {ART Loeb Theater} {^hrtv\.student\.harvard\.edu} {HRTV Studio (Pfoho Basement)} {^hir.*\.student\.harvard\.edu} {HIR (Thayer Basement)} {^hn*mun.*\.student\.harvard\.edu} {Model UN (Thayer Basement)} {^congress[0-9]*\.student\.harvard} {Model Congress (Thayer Basement)} {^litt-[0-9]*\.fas\.harvard\.edu} {Littauer} {^littw2-[0-9]*\.fas\.harvard\.edu} {Littauer} {^littauer-} {Littauer} {^litt-cir-} {Littauer Library} {^ling} {Boylston} {^sobral} {Boylston} {^rlc} {Boylston} {^wtr-} {SC B11 (PC Lab)} {^etr-1941[05]\.fas\.harvard\.edu} {SC B14 (Mac)} {^div2-} {2 Divinity Ave} {^bryant5-} {5 Bryant St} {^mczlabs} {Museum of Comparative Zoology} {^imspc[0-9]*\.fas.harvard} {Instructional Media Services} {^tech-mac[1-4]\.fas\.harvard\.edu} {Tech Showcase Mac (SC 119)} {^tech-g4(-dv)*\.fas\.harvard\.edu} {Tech Showcase G4 (SC 119)} {^tech-pc[3-7]\.fas\.harvard\.edu} {Tech Showcase PC (SC 119)} {^dhcp230-[0-9]*\.harvard\.edu} {Agassiz House (Radcliffe)} {^sfp222-[0-9]*\.harvard\.edu} {Soldiers Field Park} {^wbasketball} {Lavietes Pavilion} {^holyoke(17)*} {HSA (67 Mt Auburn, 17 Holyoke)} {^(mt)*aub[iu]rn(67)*-[0-9]*\.hsa\.harvard\.edu} {HSA (67 Mt Auburn, 17 Holyoke)} {^hsa-[0-9]*\.hsa\.harvard\.edu} {HSA (67 Mt Auburn, 17 Holyoke)} {^hsacs[0-9]*\.hsa\.harvard\.edu} {HSA (67 Mt Auburn, 17 Holyoke)} {^ws[0-3][0-9]\.fas\.harvard\.edu} {SCB14 Linux/UNIX Workstation} {^is[01][0-9]\.fas\.harvard\.edu} {Harvard IS Login} {^ice[0-9]\.fas\.harvard\.edu} {Harvard NICE Login} {^65\.105\.} {Concentric Networks} {^140.247.124} {Widener Library} {^140.247.174} {HSA (67 Mt Auburn, 17 Holyoke)} {\.thecrimson\.com} {The Harvard Crimson} {^cust-206-40\.} {The Harvard Lampoon} {\.yale\.edu} {Yale (sucks)} {\.princeton\.edu} {Princeton} {^128\.103\.29\.} {The Harvard Crimson} {^128\.103\.152\.[0-9]*} {Lamont Ref Kiosk} {^128\.103\.170\.[0-9]*} {Graduate School of Design} {^128\.103\.171\.[0-9]*} {Graduate School of Design} {^128\.103\.179\.[0-9]*} {8 Story St (Ed School)} {^128\.6\.} {Rutgers University} {^134\.174\.} {Harvard Medical School} {^140\.247\.12[56]\.[0-9]*} {Lamont/Widener} {^140\.247\.135\.[0-9]*} {20 DeWolfe} {^161\.114} {Compaq} {\.mgh\.harvard\.edu} {Mass General Hospital} {\.law\.harvard\.edu} {Harvard Law School} {\.med\.harvard\.edu} {Harvard Medical School} {\.arp\.harvard} {Anderson Research Group} {\.dfci\.harvard\.edu} {Dana Farber Cancer Institute} {\.hbs\.edu} {Harvard Business School} {\.jhu\.edu} {Johns Hopkins University} {\.bu\.edu} {Boston University} {\.dartmouth\.edu} {Dartmouth College} {\.rutgers\.edu} {Rutgers University} {\.nber\.org} {NBER (1050 Mass Ave)} {\.aol\.com} {AOL} {\.home\.com} {@Home} {\.rr\.com} {Road Runner} {\.mediaone\.net} {MediaOne} {\.attbi\.com} {AT&T Broadband} {^pool.*\.bos\.east} {Verizon DSL} {\.east\.verizon\.net} {Verizon DSL} {\.supernet\.com} {EarthLink} {\.choice\.net} {Voyager} {\.uu\.} {UUNET} {\.mit\.edu} {MIT} {\.cybercom\.net} {Cybercom Shell} {\.comcast\.net} {Comcast} {\.uk} {England} {\.fr} {France} {\.se} {Sweeden} {\.cn} {China} {\.hk} {Hong Kong} {\.tw} {Taiwan} {\.jp} {Japan} {\.my} {Malaysia} } # Get Keys set roam_key_list [ array names roam_key_array ] set net_key_list [ array names net_key_array ] set rest_key_list [ array names rest_key_array ] # Translate hosts into locations if { [ on_p $location_list ] } { for { set i 1 } { $i < [ llength $remotehost_list ] } { incr i } { set remote [ lindex $remotehost_list $i ] set local [ lindex $host_list $i ] set unknown true if { [ regexp -nocase {^ws[0-9]*} $local ] } { lappend location_list "SCB14 Alpha [ string range $local 2 3 ]" set unknown false } elseif { [ regexp -nocase {^roam} $remote ] } { foreach roam_key_name $roam_key_list { if { [ regexp -nocase $roam_key_name $remote ] } { lappend location_list $roam_key_array($roam_key_name) set unknown false break } } } elseif { [ regexp -nocase {^net} $remote ] } { foreach net_key_name $net_key_list { if { [ regexp -nocase $net_key_name $remote ] } { lappend location_list $net_key_array($net_key_name) set unknown false break } } } else { foreach rest_key_name $rest_key_list { if { [ regexp -nocase $rest_key_name $remote ] } { lappend location_list $rest_key_array($rest_key_name) set unknown false break } } } # if no value was found, append a blank placeholder if { $unknown } { lappend location_list {} } } } # Build output_list set output_list {} if { [ on_p $login_list ] } { lappend output_list $login_list } if { [ on_p $name_list ] } { lappend output_list $name_list } if { [ on_p $host_list ] } { lappend output_list $host_list } if { [ on_p $idle_list ] } { lappend output_list $idle_list } if { [ on_p $remotehost_list ] } { lappend output_list $remotehost_list } if { [ on_p $location_list ] } { lappend output_list $location_list } # Output headers with header formatting puts -nonewline $HEADER foreach output $output_list { puts -nonewline [ format [ head_index $output 1 ] [ head_index $output 3 ] ] } puts "$PLAIN" # Output results with desired formatting for { set i 1 } { $i < [ llength $login_list ] } { incr i } { puts -nonewline $BODY foreach output $output_list { set style [ head_index $output 2 ] puts -nonewline $style puts -nonewline [ format [ head_index $output 1 ] [ lindex $output $i ] ] puts -nonewline $PLAIN$BODY } puts "$PLAIN" }