home *** CD-ROM | disk | FTP | other *** search
/ Kyūkyoku!! X68000 Emulator / X68000Book.dat / mac / OLS / X68000 / Ko-Window / kow142s.lzh / wsrv / common.c < prev    next >
C/C++ Source or Header  |  1995-11-13  |  1KB  |  57 lines

  1. /* 1991 COR.*/
  2. /* 1995 11/12 microstrlib é╓ÅCÉ│ */
  3.  
  4. #include    <stdio.h>
  5. #include    "wlib.h"
  6.  
  7. static unsigned char    *CommonPtr;
  8.  
  9. /*  ïñùLù╠êµé╠èmò█  */
  10. unsigned char *
  11. CommonOpen( name )
  12. unsigned char    *name;
  13. {
  14.     return    CommonPtr= WindowGetCommon( (char*)name, 0 );
  15. }
  16.  
  17. /*  éPìsÉ╪éΦÅoé╡  */
  18. unsigned char *
  19. CommonGetLine( line )
  20. unsigned char    *line;
  21. {
  22.     if( !*CommonPtr )
  23.         return    NULL;
  24.     for(; *CommonPtr != '\n' && *CommonPtr ; *line++= *CommonPtr++ );
  25.     *line= '\0';
  26.     if( *CommonPtr == '\n' )
  27.         CommonPtr++;
  28.     return    CommonPtr;
  29. }
  30.  
  31. /*  éPâÅü[âhÉ╪éΦÅoé╡  */
  32. unsigned char *
  33. CommonGetWord( buf )
  34. unsigned char    *buf;
  35. {
  36.     unsigned char    c;
  37.     int        flag;
  38.  
  39. /*    while( isspace( c = *CommonPtr ) && c )*/
  40.     for(; (c= *CommonPtr) && c <= ' ' ; CommonPtr++ );
  41.     if( c == '\0' )
  42.         return    0;
  43.     CommonPtr++;
  44.     flag= ( c == '\"' );
  45.     if( flag )
  46.         c= *CommonPtr++;
  47.  
  48. /*    while( ((flag && c != '\"')||(!flag && !isspace( c )) ) && c  ){*/
  49.     while( ((flag && c != '\"')||(!flag && c > ' ') ) && c  ){
  50.         *buf++= c;
  51.         c= *CommonPtr++;
  52.     }
  53.     CommonPtr+= flag;
  54.     *buf= '\0';
  55.     return    CommonPtr;
  56. }
  57.