]> git.phdru.name Git - extfs.d.git/blobdiff - dummy
Version 0.3.0. Copyin.
[extfs.d.git] / dummy
diff --git a/dummy b/dummy
index 7970131229abd51627c4ba3736de27b2c90985a8..0baad44d1922675295dadaa871d021acd95220a2 100755 (executable)
--- a/dummy
+++ b/dummy
@@ -9,19 +9,20 @@ License: GPL.
 
 """
 
-__version__ = "0.1.0"
-__revision__ = "$Id: dummy,v 1.2 2004/06/12 22:42:29 phd Exp $"
-__date__ = "$Date: 2004/06/12 22:42:29 $"[7:-2]
+__version__ = "0.3.0"
+__revision__ = "$Id: dummy,v 1.6 2004/06/13 10:23:20 phd Exp $"
+__date__ = "$Date: 2004/06/13 10:23:20 $"[7:-2]
 __author__ = "Oleg Broytmann <phd@phd.pp.ru>"
 __copyright__ = "Copyright (C) 2004 PhiloSoft Design"
 
+
 import sys
 
 def log_error(msg):
    sys.stderr.write(msg + '\n')
 
 def error(msg):
-   sys.stderr.write(msg + '\n')
+   log_error(msg + '\n')
    sys.exit(1)
 
 
@@ -37,11 +38,37 @@ def mcdummy_list():
    # Emit a dummy listing
    print "-r--r--r-- 1 user group 0 Jun 13 02:20 file0"
    print "-r--r--r-- 1 user group 1 Jun 13 02:21 file1"
-   print "-r--r--r-- 1 user group 2 Jun 13 02:22 file2"
+   print "dr--r--r-- 1 user group 2 Jun 13 02:22 subdir"
+   print "-r--r--r-- 1 user group 3 Jun 13 02:23 subdir/file3"
+   print "-r--r--r-- 1 user group 4 Jun 13 02:23 subdir/file4"
+
+
+def mcdummy_copyout():
+   """Extract a file from the VFS"""
+   # Ignore the VFS name (sys.argv[2])
+   dummy_filename = sys.argv[3]
+   real_filename = sys.argv[4]
+
+   real_file = open(real_filename, 'w')
+   real_file.write("Copied from %s\n" % dummy_filename)
+   real_file.write("Copied  to  %s\n" % real_filename)
+   real_file.close()
+
+
+def mcdummy_copyin():
+   """Put a file to the VFS"""
+   # Ignore the VFS name (sys.argv[2])
+   dummy_filename = sys.argv[3]
+   real_filename = sys.argv[4]
+
+   real_file = open(real_filename + "-dummy.tmp", 'w')
+   real_file.write("Copied from %s\n" % real_filename)
+   real_file.write("Copied  to  %s\n" % dummy_filename)
+   real_file.close()
 
 
-command = sys.argv[1]
 g = globals()
+command = sys.argv[1]
 procname = "mcdummy_" + command
 
 if not g.has_key(procname):