A mail formatter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

97 lines
2.1 KiB

  1. /*
  2. * fmail - Mail formatter
  3. * Copyright (C) 2011 Damien Goutte-Gattat
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifdef HAVE_CONFIG_H
  19. #include <config.h>
  20. #endif
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <getopt.h>
  24. /* Help and informations about the program. */
  25. static void
  26. usage(int status)
  27. {
  28. puts("\
  29. Usage: fmail [options]\n\
  30. Read a mail from standard input and send it.\n");
  31. puts("Options:\n\
  32. -h, --help Display this help message.\n\
  33. -v, --version Display the version message.\n\
  34. ");
  35. printf("Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
  36. exit(status);
  37. }
  38. static void
  39. info(void)
  40. {
  41. printf("\
  42. fmail %s\n\
  43. Copyright (C) 2011 Damien Goutte-Gattat\n\
  44. \n\
  45. This program is released under the GNU General Public License.\n\
  46. See the COPYING file or <http://www.gnu.org/licenses/gpl.html>.\n\
  47. ", VERSION);
  48. exit(EXIT_SUCCESS);
  49. }
  50. /* Main function. */
  51. int
  52. main(int argc, char *argv[])
  53. {
  54. char c;
  55. struct option options[] = {
  56. { "help", 0, NULL, 'h' },
  57. { "version", 0, NULL, 'v' },
  58. { NULL, 0, NULL, 0 }
  59. };
  60. setprogname(argv[0]);
  61. while ( (c = getopt_long(argc, argv, "hv",
  62. options, NULL)) != -1 ) {
  63. switch ( c ) {
  64. case 'h':
  65. usage(EXIT_SUCCESS);
  66. break;
  67. case '?':
  68. usage(EXIT_FAILURE);
  69. break;
  70. case 'v':
  71. info();
  72. break;
  73. }
  74. }
  75. return EXIT_SUCCESS;
  76. }