108 lines (85 with data), 1.6 kB
#!/r/u/geoff/swlpc/bin/lpc
#if 0
/*
*
* LPC / C interface
*
*/
#endif
int handle;
reset()
{
int x;
handle = load_shared_object("modules/os.so");
}
query_handle()
{
return handle;
}
query_destruct()
{
unload_shared_object(handle);
}
string char_grab_file(string file, int fromV, int toV)
{
return ext_c_call(handle, "lpc_char_grab_file", file, fromV, toV);
}
int copy_file(string src, string dst)
{
return ext_c_call(handle, "lpc_copy_file", src, dst);
}
int file_size(string file)
{
return ext_c_call(handle, "lpc_file_size", file);
}
array list_files(string path)
{
return ext_c_call(handle, "lpc_list_files", path);
}
int remove_file(string path)
{
return ext_c_call(handle, "lpc_remove_file", path);
}
int rename_file(string src, string dst)
{
return ext_c_call(handle, "lpc_rename_file", src, dst);
}
int write_file(string file, string str)
{
return ext_c_call(handle, "lpc_write_file", file, str);
}
int mkdir(string path)
{
return ext_c_call(handle, "lpc_mkdir", path);
}
int rmdir(string path)
{
return ext_c_call(handle, "lpc_rmdir", path);
}
int chmod(string path, int mode)
{
return ext_c_call(handle, "lpc_chmod", path, mode);
}
array stat(string path)
{
return ext_c_call(handle, "lpc_stat", path);
}
/*
* Name: time
* Purpose: return seconds since 1970
*/
int time()
{
return ext_c_call(handle, "lpc_time");
}
#if 0
/*
* Name: argv()
* Purpose: get the arguments passed to this script as an array
* of strings.
*/
array argv()
{
return ext_c_call(handle, "lpc_argv");
}
#endif