1 #! /usr/local/bin/python -O
4 Dummy VFS for Midnight Commander. Just for a test.
10 __date__ = "$Date$"[7:-2]
11 __author__ = "Oleg Broytman <phd@phdru.name>"
12 __copyright__ = "Copyright (C) 2004-2010 PhiloSoft Design"
19 sys.stderr.write(msg + '\n')
28 It is not a program - it is a dummy VFS for Midnight Commander.
29 Put it in /usr/lib/mc/extfs.""")
33 """List the entire VFS"""
34 # Ignore the VFS name (sys.argv[2])
35 # Emit a dummy listing
36 print "-r--r--r-- 1 user group 0 Jun 13 02:20 file0"
37 print "-r--r--r-- 1 user group 1 Jun 13 02:21 file1"
38 print "dr--r--r-- 1 user group 2 Jun 13 02:22 subdir"
39 print "-r--r--r-- 1 user group 3 Jun 13 02:23 subdir/file3"
40 print "-r--r--r-- 1 user group 4 Jun 13 02:23 subdir/file4"
43 def mcdummy_copyout():
44 """Extract a file from the VFS"""
45 # Ignore the VFS name (sys.argv[2])
46 dummy_filename = sys.argv[3]
47 real_filename = sys.argv[4]
49 real_file = open(real_filename, 'a')
50 real_file.write("Copy from %s\n" % dummy_filename)
51 real_file.write("Copy to %s\n" % real_filename)
56 """Put a file to the VFS"""
57 # Ignore the VFS name (sys.argv[2])
58 dummy_filename = sys.argv[3]
59 real_filename = sys.argv[4]
61 real_file = open(real_filename + "-dummy.tmp", 'a')
62 real_file.write("Copy from %s\n" % real_filename)
63 real_file.write("Copy to %s\n" % dummy_filename)
68 """Remove a file from the VFS"""
69 # Ignore the VFS name (sys.argv[2])
70 dummy_filename = sys.argv[3]
72 real_file = open(".dummy.tmp", 'a')
73 real_file.write("Remove %s\n" % dummy_filename)
78 """Create a directory in the VFS"""
79 # Ignore the VFS name (sys.argv[2])
80 dummy_dirname = sys.argv[3]
82 real_file = open(".dummy.tmp", 'a')
83 real_file.write("Create %s\n" % dummy_dirname)
88 """Remove a directory from the VFS"""
89 # Ignore the VFS name (sys.argv[2])
90 dummy_dirname = sys.argv[3]
92 real_file = open(".dummy.tmp", 'a')
93 real_file.write("Remove %s\n" % dummy_dirname)
99 procname = "mcdummy_" + command
101 if not g.has_key(procname):
102 error("Unknown command %s" % command)