home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / emacs-18.59-bin.lha / lib / emacs / 18.59 / etc / digest-doc.c < prev    next >
C/C++ Source or Header  |  1987-03-21  |  930b  |  48 lines

  1. /* Give this program DOCSTR.mm.nn as standard input
  2.    and it outputs to standard output
  3.    a file of nroff output containing the doc strings.
  4.  
  5.    See also sorted-doc.c, which produces similar output
  6.    but in texinfo format and sorted by function/variable name.  */
  7.  
  8. #include <stdio.h>
  9. main ()
  10. {
  11.   register int ch;
  12.   register int notfirst = 0;
  13.  
  14.   printf (".TL\n");
  15.   printf ("Command Summary for GNU Emacs\n");
  16.   printf (".AU\nRichard M. Stallman\n");
  17.   while ((ch = getchar ()) != EOF)
  18.     {
  19.       if (ch == '\037')
  20.     {
  21.       if (notfirst)
  22.         printf ("\n.DE");
  23.       else
  24.         notfirst = 1;
  25.  
  26.       printf ("\n.SH\n");
  27.  
  28.       ch = getchar ();
  29.       printf (ch == 'F' ? "Function " : "Variable ");
  30.  
  31.       while ((ch = getchar ()) != '\n')  /* Changed this line */
  32.         {
  33.           if (ch != EOF)
  34.           putchar (ch);
  35.           else
  36.         {
  37.           ungetc (ch, stdin);
  38.           break;
  39.         }
  40.         }
  41.       printf ("\n.DS L\n");
  42.     }
  43.       else
  44.     putchar (ch);
  45.     }
  46.   return 0;
  47. }
  48.