anplug.c 626 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <clish/plugin.h>
  4. CLISH_PLUGIN_SYM(anplug_fn)
  5. {
  6. printf("anplug: Another plugin\n");
  7. return 0;
  8. }
  9. CLISH_PLUGIN_INIT
  10. {
  11. char *conf;
  12. printf("anplug: INIT shell = %p\n", clish_shell);
  13. /* Set a name of plugin to use in sym@plugin */
  14. clish_plugin__set_name(plugin, "another_plug");
  15. /* Add symbols */
  16. clish_plugin_add_sym(plugin, anplug_fn, "an_fn");
  17. /* Show plugin config from <PLUGIN>...</PLUGIN> */
  18. conf = clish_plugin__get_conf(plugin);
  19. if (conf)
  20. printf("%s", conf);
  21. return 0;
  22. }
  23. CLISH_PLUGIN_FINI
  24. {
  25. printf("anplug: FINI this = %p\n", clish_shell);
  26. return 0;
  27. }