Usage Example 3

HTTPFS/Midnight Commander Snapshots

The Midnight Commander is a directory browser/file manager for Unix-like operating systems [MC]. Its interface is similar to that of John Socha's Norton Commander for DOS as well as to Microsoft Windows' Explorer. The Midnight Commander (MC) can show the contents of two directories at the same time. Besides the file names, the views may display size, type, modification date, and other file attributes. The MC lets you select a group of files from the current view, and perform a number of operations (copy, rename, view, edit, etc) on the current file or selection with one or few keystrokes or mouse clicks.

MC supports remote file access via MCFS, a remote file access protocol that requires that an MCFS server be running on a remote machine. I provide an "adapter" -- an MCFS server linked to a HTTPFS client -- that translates MCFS orders to HTTPFS requests. Thus Midnight Commander gains an ability to access remote files via HTTPFS for free, without any modifications to its code.

The following sample session hopefully shows what good the HTTPFS/MC alliance can do. This is a transcript of an actual session on a Linux/i686 computer, with only hostnames changed.

First we start the Midnight Commander application, mc. This application is included with any Linux distribution (S.u.S.E. distribution, v5 and v6, in our case). The Midnight Commander was not modified in any way.

At the MC prompt, we enter the following directory change command

     cd mc:sol-server/winnt-server:80/
           cgi-bin/admin/MCHFS-server.pl/wwwroot

Here is what we see:

LeftFileCommandOptionsRight
.../admin/MCHFS-server.pl/wwwroot
Name Size MTime
/..
/NTAdmin
/samples
 back1.jpg
 default.htm
 
 
 
 
0
0
0
999
4051
May 18 13:22
Jan 8 1998
Jan 8 1998
May 15 1998
Aug 9 1996
 default.htm
~
Name Size MTime
/..
/.ncftp
/http-vfs
*.bash_profile
 extfs.ini
 lilo1.conf
 
 
 
1024
1024
1024
1555
194
487
May 4 20:12
Dec 18 09:58
May 7 16:56
Mar 30 14:00
Jan 22 16:05
Mar 11 16:20
/..

Hint: VFS coolness: tap enter on a tar file to examine its contents.
~> 
1Help2Menu 3View4Edit5Copy6RenMov7Mkdir8Delete9PullDn10Quit

The cd command above had MC display the listing of a wwwroot directory on a remote computer winnt-server, which runs IIS. Note the window title in the upper left corner. The mc:sol-server component in the "directory name" above refers to a computer that executes the MC/HTTPFS adapter. The adapter may run on the same computer with MC, or alongside the HTTPFS server, or on some other site.
 

The remote wwwroot directory tree can be navigated as usual. For example, you may move down to the /NTAdmin or /samples directory and climb back. If you select a file -- e.g., default.htm -- and press F3, a viewer is launched to show that remote file's contents.
File: default.htm Col 02715 bytes  [grow]0%
                  Microsoft Internet Information Server

              The Web Server Designed For Windows NT Server

     _Why not add the [1]latest features to your Internet Information
                                 Server?_

  [INLINE]
  [2]Documentation
  Microsoft. Internet Information Server (IIS) makes it easier to do
  business with internal or external customers down the hall or around
  the world. To learn more about how Internet Information Server will
  help you in your business, browse the IIS [3]online documentation.
1Help2UnWrap 3Quit4Hex5Line6RxSrch7Search8Raw9Format10Quit

Ironically an application launched to display default.htm is lynx, a standard (to MC) viewer of HTML content.

 

We switch to another MC pane and change the directory again:

     cd mc:sol-server/sol-server/cgi-bin/
           admin/MCHFS-server.pl/DeepestRoot/tmp
This command has MC display the listing of a /tmp directory on a remote computer sol-server (SunSparc/Solaris 2.6).
LeftFileCommandOptionsRight
.../admin/MCHFS-server.pl/wwwroot
Name Size MTime
/..
/NTAdmin
/samples
 back1.jpg
 default.htm
 
 
 
 
0
0
0
999
4051
May 18 13:22
Jan 8 1998
Jan 8 1998
May 15 1998
Aug 9 1996
 default.htm
...CHFS-server.pl/DeepestRoot/tmp
Name Size MTime
/..
/.X11-pipe
 SurfaceOb.java
 XMLGener~or.java
 mailcap
=psb_back_socket
 
 
 
1024
512
4912
997
1554
0
May 14 21:33
May 20 17:15
May 17 23:18
May 17 23:18
May 17 21:52
May 14 18:23
 mailcap

Hint: Need to quote a character? Use Control-q and the character.
~> 
1Help2Menu 3View4Edit5Copy6RenMov7Mkdir8Delete9PullDn10Quit

Again, you can navigate this remote directory as a local filesystem tree. The current file is mailcap. Pressing F4 launches a built-in editor, so you can edit a remote file "inplace" so to speak:

mailcap [----] 0: 1+ 0= 1/ 34 - *0/1554b=105
text/x-omf ;        echo %{area} \; cp %s metar.omf
text/x-omf-advisories ;     echo %{area} \; cp %s taf.omf
text/x-omf-forecasts ;      echo %{area} \; cp %s taf.omf
text/x-omf-uar ;            echo %{area} \; cp %s rto.omf
text/x-omf-btsc ;           echo %{area} \; cp %s rto.omf
text/x-omf-synop ;          echo %{area} \; cp %s rto.omf

image/gif ;     echo %{AREA}\; cp %s %{CLASS}.gif
text/html ;     echo %{AREA}\; cp %s %{CLASS}.html
text/plain ;    echo %{AREA}\; cp %s %{timestamp}.txt

*/* ;   echo \"can't handle %t\"
1Help2Save 3Mark4Replac5Copy6Move7Search8Delete9PullDn10Quit

 

To remind, the right MC pane lists /tmp directory on sol-server. The left pane still shows the contents of a remote directory DocumentRoot/wwwroot on a WinNT host winnt-server. The current file is still mailcap. Pressing F5 initiates copying of that file from one remote computer onto the other:
Copy
Copy file "mailcap" with source mask:
*
[x] using shell Patterns
to:
mc:sol-server/winnt-server:80/cgi-bin/admin/MCHFS-server[^]
[ ] follow sYmlinks  [x] Dive into subdir if exists
[x] preserve Attributes   [ ] Stable Symlinks
[ Ok ]  [ Background ]  [ Cancel ]
 

 

This is how the MC window panes look like after the file is copied. Note that one or both remote systems may be outside a firewall.
LeftFileCommandOptionsRight
.../admin/MCHFS-server.pl/wwwroot
Name Size MTime
/..
/NTAdmin
/samples
 back1.jpg
 default.htm
 mailcap
 
 
 
0
0
0
999
4051
1560
May 18 13:22
Jan 8 1998
Jan 8 1998
May 15 1998
Aug 9 1996
May 21 1999
 default.htm
...CHFS-server.pl/DeepestRoot/tmp
Name Size MTime
/..
/.X11-pipe
 SurfaceOb.java
 XMLGener~or.java
 mailcap
=psb_back_socket
 
 
 
1024
512
4912
997
1560
0
May 14 21:33
May 20 17:15
May 17 23:18
May 17 23:18
May 21 1999
May 14 18:23
 mailcap

Hint: Tired of these messages? Turn them off from the Options/Layout menu.
~> 
1Help2Menu 3View4Edit5Copy6RenMov7Mkdir8Delete9PullDn10Quit

 
Prev example Back to the Paper Next example

 


Last updated June 25, 1999

This site's top page is http://pobox.com/~oleg/ftp/