home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / REND.LZH / READER / WORD.C < prev    next >
C/C++ Source or Header  |  1995-07-13  |  589b  |  38 lines

  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #ifdef UNIX
  4. #define toupper(c) (('A' <= (c) && (c) <= 'Z') ? ((c) - 'A' + 'a') : (c))
  5. #endif
  6.  
  7. static    int        getword( char* );
  8.  
  9. void    main()
  10. {
  11.     int        n ;
  12.     char    buf[100] ;
  13.  
  14.     n = 0 ;
  15.     for(;;)
  16.     {
  17.         if ( getword( buf ) == EOF )
  18.             break ;
  19.         printf( "#define WORD_%s\t\t%d\n", buf, n++ );
  20.     }
  21. }
  22.  
  23. static    int        getword( buf )
  24. char    *buf ;
  25. {
  26.     int        c ;
  27.  
  28.     while( ( c = getchar() ) != '\"' && c != EOF );
  29.     if ( c == EOF )
  30.         return( EOF );
  31.     while( ( c = getchar() ) != '\"' )
  32.         *buf++ = toupper( c );
  33.     *buf = '\0' ;
  34.  
  35.     return( 0 );
  36. }
  37.  
  38.