X-Git-Url: https://git.phdru.name/?p=extfs.d.git;a=blobdiff_plain;f=dummy;h=4b0041c0dd038253ad42e53baa796022d35afdaf;hp=af8a1e931e26b5241eddfd6662ccea921ad9d9ac;hb=c5c4da7de52a81e0a4a58ad2753d379d6bb0c4c5;hpb=6795c809e183310c2f387d5ea5b3ac4cb9d8a130 diff --git a/dummy b/dummy index af8a1e9..4b0041c 100755 --- a/dummy +++ b/dummy @@ -1,19 +1,10 @@ -#! /usr/local/bin/python -O +#! /usr/bin/env python +"""Dummy VFS for Midnight Commander. Just for a test.""" -""" -Dummy VFS for Midnight Commander. Just for a test. - -Author: Oleg BroytMann . -Copyright (C) 2004 PhiloSoft Design. -License: GPL. - -""" - -__version__ = "0.1.1" -__revision__ = "$Id: dummy,v 1.3 2004/06/12 22:49:16 phd Exp $" -__date__ = "$Date: 2004/06/12 22:49:16 $"[7:-2] -__author__ = "Oleg Broytmann " -__copyright__ = "Copyright (C) 2004 PhiloSoft Design" +__version__ = "1.0.2" +__author__ = "Oleg Broytman " +__copyright__ = "Copyright (C) 2004-2012 PhiloSoft Design" +__license__ = "GPL" import sys @@ -38,11 +29,67 @@ 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, 'a') + real_file.write("Copy from %s\n" % dummy_filename) + real_file.write("Copy 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", 'a') + real_file.write("Copy from %s\n" % real_filename) + real_file.write("Copy to %s\n" % dummy_filename) + real_file.close() + + +def mcdummy_rm(): + """Remove a file from the VFS""" + # Ignore the VFS name (sys.argv[2]) + dummy_filename = sys.argv[3] + + real_file = open(".dummy.tmp", 'a') + real_file.write("Remove %s\n" % dummy_filename) + real_file.close() + + +def mcdummy_mkdir(): + """Create a directory in the VFS""" + # Ignore the VFS name (sys.argv[2]) + dummy_dirname = sys.argv[3] + + real_file = open(".dummy.tmp", 'a') + real_file.write("Create %s\n" % dummy_dirname) + real_file.close() + + +def mcdummy_rmdir(): + """Remove a directory from the VFS""" + # Ignore the VFS name (sys.argv[2]) + dummy_dirname = sys.argv[3] + + real_file = open(".dummy.tmp", 'a') + real_file.write("Remove %s\n" % dummy_dirname) + real_file.close() -command = sys.argv[1] g = globals() +command = sys.argv[1] procname = "mcdummy_" + command if not g.has_key(procname):