print-copyr.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Print a copyright notice suitable for the current locale.
  2. Copyright (C) 2001 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. /* Written by Paul Eggert. */
  15. #if HAVE_CONFIG_H
  16. # include <config.h>
  17. #endif
  18. #include "print-copyr.h"
  19. #include <stdio.h>
  20. #if ENABLE_NLS
  21. # include "unicodeio.h"
  22. #else
  23. # define unicode_to_mb(code, callback, error_callback, callback_arg) \
  24. error_callback (code, callback_arg)
  25. #endif
  26. #define COPYRIGHT_SIGN 0x00A9
  27. /* Print "(C)". */
  28. static int
  29. print_parenthesized_c (unsigned int code, void *callback_arg)
  30. {
  31. FILE *stream = callback_arg;
  32. return fputs ("(C)", stream);
  33. }
  34. /* Print "Copyright (C) " followed by NOTICE and then a newline,
  35. transliterating "(C)" to an actual copyright sign (C-in-a-circle)
  36. if possible. */
  37. void
  38. print_copyright (char const *notice)
  39. {
  40. fputs ("Copyright ", stdout);
  41. unicode_to_mb (COPYRIGHT_SIGN, print_unicode_char, print_parenthesized_c,
  42. stdout);
  43. fputc (' ', stdout);
  44. puts (notice);
  45. }