1
0

clish_script_callback.c 726 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * clish_script_callback.c
  3. *
  4. *
  5. * Callback hook to action a shell script.
  6. */
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include "private.h"
  10. /*--------------------------------------------------------- */
  11. bool_t clish_script_callback(const clish_shell_t * shell, const char *script)
  12. {
  13. #ifdef DEBUG
  14. fprintf(stderr, "SYSTEM: %s\n", script);
  15. #endif /* DEBUG */
  16. return (0 == system(script)) ? BOOL_TRUE : BOOL_FALSE;
  17. }
  18. /*--------------------------------------------------------- */
  19. bool_t clish_dryrun_callback(const clish_shell_t * shell, const char *script)
  20. {
  21. #ifdef DEBUG
  22. fprintf(stderr, "DRY-RUN: %s\n", script);
  23. #endif /* DEBUG */
  24. return BOOL_TRUE;
  25. }
  26. /*--------------------------------------------------------- */