On Thu, Feb 09, 2006 at 09:26:12AM +0530, Vishwanath Patil wrote:
> Can you tell me how do i compile and link the example files in the src
> directory, I have been trying them since last 8 hours. I will work on
> the lines you told me and try registering a command.
Here is an example module attached. Compile it with command:
gcc -fPIC -shared -nostdlib -I/path/to/lftp/include -I/path/to/lftp/src
example-module1.cc -o example-module1.so
Then load with command:
module /path/to/example-module1.so
It registers `test1' command which prints argc.
--
Alexander. | software is knowlege
#include <config.h>
#include "CmdExec.h"
Job *cmd_test1(CmdExec *parent)
{
parent->printf("test1 called with %d arguments\n",parent->args->count());
parent->exit_code=0;
return 0;
}
CDECL void module_init(int argc,const char *const *argv)
{
CmdExec::RegisterCommand("test1",cmd_test1,"test1 [args]","This test command
prints the number of arguments\n");
}