home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_07 / 9n07116a < prev    next >
Text File  |  1991-05-09  |  498b  |  29 lines

  1. /*
  2.  * xr.cpp - a cross-reference generator
  3.  */
  4. #include <assert.h>
  5. #include <ctype.h>
  6. #include <stdio.h>
  7.  
  8. #include "xrt.h"
  9.  
  10. int getword(char *word, size_t lim);
  11.  
  12. #define MAXWORD 100
  13.  
  14. int main()
  15.     {
  16.     char word[MAXWORD];
  17.     unsigned lineno = 1;
  18.  
  19.     while (getword(word, MAXWORD) != EOF)
  20.         if (isalpha(word[0]))
  21.             xrt_add(word, lineno);
  22.         else if (word[0] == '\n')
  23.             ++lineno;
  24.     xrt_print();
  25.     xrt_destroy();
  26.     return 0;
  27.     }
  28.  
  29.