gnunet-template.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @file template/gnunet-template.c
  18. * @brief template for writing a tool
  19. * @author Christian Grothoff
  20. */
  21. #include "platform.h"
  22. #include "gnunet_util_lib.h"
  23. /* #include "gnunet_template_service.h" */
  24. /**
  25. * Final status code.
  26. */
  27. static int ret;
  28. /**
  29. * Main function that will be run by the scheduler.
  30. *
  31. * @param cls closure
  32. * @param args remaining command-line arguments
  33. * @param cfgfile name of the configuration file used (for saving, can be NULL!)
  34. * @param cfg configuration
  35. */
  36. static void
  37. run (void *cls,
  38. char *const *args,
  39. const char *cfgfile,
  40. const struct GNUNET_CONFIGURATION_Handle *cfg)
  41. {
  42. /* main code here */
  43. }
  44. /**
  45. * The main function.
  46. *
  47. * @param argc number of arguments from the command line
  48. * @param argv command line arguments
  49. * @return 0 ok, 1 on error
  50. */
  51. int
  52. main (int argc, char *const *argv)
  53. {
  54. static const struct GNUNET_GETOPT_CommandLineOption options[] = {
  55. /* FIMXE: add options here */
  56. GNUNET_GETOPT_OPTION_END};
  57. if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
  58. return 2;
  59. ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc,
  60. argv,
  61. "gnunet-template",
  62. gettext_noop ("help text"),
  63. options,
  64. &run,
  65. NULL))
  66. ? ret
  67. : 1;
  68. GNUNET_free ((void *) argv);
  69. return ret;
  70. }
  71. /* end of gnunet-template.c */