2 * (c) Oleg Puchinin 2007
3 * graycardinalster@gmail.com
11 #include <gclib/gclib.h>
12 #include <gclib/gclib_c.h>
17 extern "C" DArray
* plugin_init (struct env_t
*env
);
20 char simple_plugin_opt (DArray
* d_opts
, int * pos
)
25 if (! d_opts
|| ! pos
)
28 count
= d_opts
->get_size ();
29 S
= d_opts
->get (*pos
);
30 if (EQ (S
, "--simple_plugin")) {
31 if (++(*pos
) >= count
)
32 return 0; // Missed argument for option "--simple-plugin".
39 char simple_plugin_opt2 (DArray
* d_opts
, int * pos
)
43 if (! d_opts
|| ! pos
)
46 S
= d_opts
->get (*pos
);
47 if (EQ (S
, "--simple_plugin")) {
48 // Do somethings at stage two.
54 void simple_plugin_short_info ()
56 printf ("Simple plugin.");
59 void simple_plugin_long_info ()
61 printf ("Simple plugin.\n");
62 printf ("Version: 1.0\n");
63 printf ("options: --simple-plugin\n");
66 DArray
* plugin_init (struct env_t
*env
)
72 plug
= CNEW (mod_t
, 1);
73 memset (plug
, 0, sizeof (mod_t
));
75 plug
->Version
= strdup ("1.0");
76 plug
->short_info
= simple_plugin_short_info
;
77 plug
->long_info
= simple_plugin_long_info
;
78 plug
->opt
= simple_plugin_opt
;
79 plug
->opt2
= simple_plugin_opt2
;
81 Ret
->add (LPCHAR (plug
));