home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / vfs / extfs / ftplist < prev    next >
Encoding:
Text File  |  1996-05-17  |  1.3 KB  |  53 lines

  1. #! /bin/sh
  2. # This fs implements a simple database of your favourite ftp servers.
  3. # The `archive' is a text file containing a list of ftp URL's one per line
  4. # like this (followed optionaly by name under which the link will be
  5. # shown - shouldn't contain spaces inside)
  6. #
  7. ## ftp://sunsite.unc.edu/pub/Linux sunsite
  8. ## ftp://tsx-11.mit.edu/pub/linux tsx-11
  9. ## ftp://ftp.cvut.cz/pub/linux cvut
  10. ## ftp://jj@jfch.vc.cvut.cz:21/ my_machine
  11. #
  12. # You should refer only to directories, not to particular files.
  13. # The file has to use `ftplist' extension (if you don't like it, change
  14. # it in extfs.ini). So the file name should match regex ^.*ftplist$
  15. #
  16.  
  17. mcftplistfs_list ()
  18. {
  19.     { ls -l $1; cat $1 } | awk -v uid=${UID-0} '
  20. /^[\ \    ]*(#.*)?$/ { next }
  21. {
  22. if (NF > 8) {
  23.     a[1]=$6
  24.     a[2]=$7
  25.     a[3]=$8
  26.     next
  27. }
  28. if ($1 ~ /^ftp:\/\//) {
  29.     if ($1 ~ /\/$/) {
  30.     a[4]=substr($1, 7, length($1) - 7)
  31.     a[5]=$1
  32.     } else {
  33.         a[4]=substr($1, 7)
  34.     a[5]=sprintf("%s/", $1)
  35.     }
  36.     if (NF >= 2)
  37.     a[4]=$2
  38.     else {
  39.         i=split(a[4], b, "/")
  40.         a[4]=b[1]
  41.         for (j = 2; j <= i; j++)
  42.             a[4]=sprintf("%s_%s", a[4], b[j])
  43.     }
  44.     printf "lrwxrwxrwx   1 %-8d %-8d %8d %s %2d %5s %s -> %s\n", uid, 0, length(a[5]), a[1], a[2], a[3], a[4], a[5]
  45. }
  46. }' 2>/dev/null
  47. }
  48.  
  49. case "$1" in
  50.   list) mcftplistfs_list $2; exit 0;;
  51. esac
  52. exit 1
  53.