#include <soul.h>
inherit COMMAND_BASE;
/** @ignore yes */
int cmd( string str ) {
string *filenames, err, fname, *failed, *succ, ret, load_err;
int size;
if( !str )
return notify_fail("Load what?\n");
filenames = TP->get_cfiles(str);
if( !sizeof(filenames) )
return notify_fail("No such file.\n");
failed = succ = ({ });
load_err = "";
foreach( fname in filenames ) {
if( !file_exists(fname) && file_exists(fname)+".c") {
failed += ({ fname });
continue;
}
err = sscanf( fname, SOUL_DIR+"%s", err ) == 1 ?
catch( SOUL_COMPILER->compile_file("/"+err) ) :
catch( fname->load_up_with_yellow() );
if( err )
load_err += sprintf("Failed to load %s, error: %s", fname, err );
else
succ += ({ fname });
}
ret = "";
if( size = sizeof(failed) )
ret += query_multiple_short(failed)+" "+( size == 1 ?
"is not a regular file" : "are not regular files")+".\n";
if( strlen(load_err) )
ret += load_err;
if( sizeof(succ) )
ret += sprintf("$I$5=$C$Loaded %s.\n", query_multiple_short(succ) );
TP->show_message("$P$Load$P$"+ret);
return 1;
} /* cmd() */