digest-doc.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Give this program DOC-mm.nn.oo as standard input and it outputs to
  2. standard output a file of nroff output containing the doc strings.
  3. Copyright (C) 1987, 1994, 2001 Free Software Foundation Inc.
  4. This file is part of GNU Emacs.
  5. GNU Emacs 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 2, or (at your option)
  8. any later version.
  9. GNU Emacs is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Emacs; see the file COPYING. If not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  16. Boston, MA 02111-1307, USA.
  17. See also sorted-doc.c, which produces similar output
  18. but in texinfo format and sorted by function/variable name. */
  19. #include <stdio.h>
  20. int
  21. main ()
  22. {
  23. register int ch;
  24. register int notfirst = 0;
  25. printf (".TL\n");
  26. printf ("Command Summary for GNU Emacs\n");
  27. printf (".AU\nRichard M. Stallman\n");
  28. while ((ch = getchar ()) != EOF)
  29. {
  30. if (ch == '\037')
  31. {
  32. if (notfirst)
  33. printf ("\n.DE");
  34. else
  35. notfirst = 1;
  36. printf ("\n.SH\n");
  37. ch = getchar ();
  38. printf (ch == 'F' ? "Function " : "Variable ");
  39. while ((ch = getchar ()) != '\n') /* Changed this line */
  40. {
  41. if (ch != EOF)
  42. putchar (ch);
  43. else
  44. {
  45. ungetc (ch, stdin);
  46. break;
  47. }
  48. }
  49. printf ("\n.DS L\n");
  50. }
  51. else
  52. putchar (ch);
  53. }
  54. return 0;
  55. }