function.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /******************************************************************************
  2. * This file is part of TinTin++ *
  3. * *
  4. * Copyright 2004-2019 Igor van den Hoven *
  5. * *
  6. * TinTin++ is free software; you can redistribute it and/or modify *
  7. * it under the terms of the GNU General Public License as published by *
  8. * the Free Software Foundation; either version 3 of the License, or *
  9. * (at your option) any later version. *
  10. * *
  11. * This program is distributed in the hope that it will be useful, *
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  14. * GNU General Public License for more details. *
  15. * *
  16. * *
  17. * You should have received a copy of the GNU General Public License *
  18. * along with TinTin++. If not, see https://www.gnu.org/licenses. *
  19. ******************************************************************************/
  20. /******************************************************************************
  21. * (T)he K(I)cki(N) (T)ickin D(I)kumud Clie(N)t *
  22. * *
  23. * coded by Sverre Normann 1999 *
  24. * recoded by Igor van den Hoven 2004 *
  25. ******************************************************************************/
  26. #include "tintin.h"
  27. DO_COMMAND(do_function)
  28. {
  29. char arg1[BUFFER_SIZE], arg2[BUFFER_SIZE];
  30. arg = sub_arg_in_braces(ses, arg, arg1, GET_ONE, SUB_VAR|SUB_FUN);
  31. arg = get_arg_in_braces(ses, arg, arg2, GET_ALL);
  32. if (*arg1 == 0)
  33. {
  34. show_list(ses->list[LIST_FUNCTION], 0);
  35. }
  36. else if (*arg1 && *arg2 == 0)
  37. {
  38. if (show_node_with_wild(ses, arg1, ses->list[LIST_FUNCTION]) == FALSE)
  39. {
  40. show_message(ses, LIST_FUNCTION, "#FUNCTION: NO MATCH(ES) FOUND FOR {%s}.", arg1);
  41. }
  42. }
  43. else
  44. {
  45. update_node_list(ses->list[LIST_FUNCTION], arg1, arg2, "", "");
  46. show_message(ses, LIST_FUNCTION, "#OK. FUNCTION {%s} HAS BEEN SET TO {%s}.", arg1, arg2);
  47. }
  48. return ses;
  49. }
  50. DO_COMMAND(do_unfunction)
  51. {
  52. delete_node_with_wild(ses, LIST_FUNCTION, arg);
  53. return ses;
  54. }