gurba-0.40/
gurba-0.40/bin/
gurba-0.40/lib/
gurba-0.40/lib/cmds/guild/fighter/
gurba-0.40/lib/cmds/monster/
gurba-0.40/lib/cmds/race/catfolk/
gurba-0.40/lib/cmds/race/dwarf/
gurba-0.40/lib/cmds/verb/
gurba-0.40/lib/daemons/data/
gurba-0.40/lib/data/boards/
gurba-0.40/lib/data/messages/
gurba-0.40/lib/data/players/
gurba-0.40/lib/design/
gurba-0.40/lib/domains/gurba/
gurba-0.40/lib/domains/gurba/guilds/fighter/
gurba-0.40/lib/domains/gurba/monsters/
gurba-0.40/lib/domains/gurba/objects/armor/
gurba-0.40/lib/domains/gurba/objects/clothing/
gurba-0.40/lib/domains/gurba/objects/weapons/
gurba-0.40/lib/domains/gurba/vendors/
gurba-0.40/lib/kernel/cmds/admin/
gurba-0.40/lib/kernel/daemons/
gurba-0.40/lib/kernel/include/
gurba-0.40/lib/kernel/lib/
gurba-0.40/lib/kernel/net/
gurba-0.40/lib/kernel/sys/
gurba-0.40/lib/logs/
gurba-0.40/lib/pub/
gurba-0.40/lib/std/modules/languages/
gurba-0.40/lib/std/races/
gurba-0.40/lib/std/races/monsters/
gurba-0.40/lib/wiz/fudge/
gurba-0.40/lib/wiz/spud/
gurba-0.40/src/host/beos/
gurba-0.40/src/host/pc/res/
gurba-0.40/src/kfun/
gurba-0.40/src/lpc/
gurba-0.40/src/parser/
gurba-0.40/tmp/
/* Command to copy a file 
 * Fudge
 */

void main( string str ) {
  string file;
  string dest;
  string file_name;
  string where;
  string *parts;
  string in;

  if( sscanf( str, "%s %s", str, where ) != 2 ) {
    write( "Please specify a source and a destination." );
    return;
  }

  file = normalize_path( str, this_player()->query_env( "cwd" ) );
  if( file == "" ) {
    write( file + ": Permission denied." );
    return;
  }

  if( file_exists( file ) == -1 ) {
    write( file + ": Unable to copy directories." );
    return;
  }

  if( file_exists( file ) == 0 ) {
    write( file + ": File doesn't exist." );
    return;
  }

  parts = explode( file, "/" );
  file_name = parts[ sizeof( parts ) - 1 ];

  dest = normalize_path( where, this_player()->query_env( "cwd" ) );
  if( dest == "" ) {
    write( dest + ": Permission denied." );
    return;
  }

  if( file_exists( dest ) == -1 ) {
    if( dest[strlen( dest ) -1] != '/' ) {
      dest += "/";
    }
    
    dest += file_name;
  }

  if( file_exists( dest ) == -1 ) {
    write( dest + ": Unable to create destination." );
    return;
  }

  if( file_exists( dest ) > 0 ) {
    remove_file( dest );
  }

  in = read_file( file );
  write_file( dest, in );

}