home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / next / sysadmin / 7194 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  2.4 KB

  1. Path: sparky!uunet!stanford.edu!morrow.stanford.edu!morrow.stanford.edu!usenet
  2. From: lane@sumex-aim.stanford.edu (Christopher Lane)
  3. Newsgroups: comp.sys.next.sysadmin
  4. Subject: Script to print out app/suffix mappings
  5. Date: 23 Dec 1992 22:38:15 GMT
  6. Organization: Stanford University
  7. Lines: 74
  8. Distribution: usa
  9. Message-ID: <1haponINN4oo@morrow.stanford.edu>
  10. References: <1992Dec23.081421.27143@urz.unibas.ch>
  11. Reply-To: lane@sumex-aim.stanford.edu (Christopher Lane)
  12. NNTP-Posting-Host: ssrg-next-1.stanford.edu
  13.  
  14. In article <12261@cayman.COM>  writes:
  15. > Where is the mapping between a given filename suffix and the app that is
  16. > launched with the icon is clicked in the File Browser?
  17.  
  18. Although the answer to this is clearly to use the Inspector tool as Robert  
  19. Frank <frank@ifi.unibas.ch> replied earlier, for those interested in knowing  
  20. the actual set of application to suffix mappings currently in effect, the  
  21. following 'csh' script will dump them (after a fashion) to stdout in the form:
  22.  
  23.     ais ImageViewer
  24.     anim Icon
  25.     anim Movie
  26.     BackModule BackSpace
  27.     BackO BackSpace
  28.     bbx Improv
  29.     bcvt GraphicsWorkshop
  30.     book FrameMaker
  31.     Brush ImageViewer
  32.     bshlf Librarian
  33.     ....
  34.  
  35. To use it, save it to a file (e.g. called 'mappings') and then just invoke it  
  36. with no arguments to get the current set of mappings based on Workspace's  
  37. ApplicationPaths default or pass in selected applications (e.g. /NextDemos/*).
  38.  
  39. - Christopher
  40.  
  41. #!/bin/csh -f
  42. # Print a listing of application to extension mappings to stdout
  43. # C.D.lane (lane@sumex-aim.stanford.edu) 12/23/92
  44. #
  45. # Copyright: 1992 by The Leland Stanford Junior University.  This
  46. # program may be distributed without restriction for non-commercial use.
  47.  
  48. set program = $0
  49. set temp = "/tmp/${program:t}.${user}.$$.T"
  50. set data = "/tmp/${program:t}.${user}.$$.D"
  51. unset program
  52.  
  53. set owner = Workspace; set default = ApplicationPaths
  54.  
  55. onintr exit
  56.  
  57. if ( $#argv > 0 ) then
  58.     set files = `glob ${argv:q}`
  59. else
  60.     set files = ''
  61.     foreach file (`dread $owner $default | awk '{print $3}' | tr ':' ' '`)
  62.         set files = `glob ${files:q} $file/*`
  63.     end
  64. endif
  65.  
  66. while ( $#files > 0 )
  67.     set file = $files[1]
  68.     
  69.     if ( ${file:e} == "app" ) then
  70.         set tail = ${file:t}
  71.         set file = ${file}/${tail:r}
  72.     endif
  73.     
  74.     size -m $file |& grep __ICON >> /dev/null
  75.     if ( $status == 0)  then
  76.         segedit $file -extract __ICON __header $temp
  77.         grep -e '^S' < $temp | awk '{print $2 " " $3}' >> $data
  78.     endif
  79.     
  80.     shift files
  81. end
  82.  
  83. sort -uf < $data
  84.  
  85. exit:
  86.  
  87. rm -rf $temp $data
  88.