home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / MNO100.ZIP / MNOFILT.C < prev    next >
C/C++ Source or Header  |  1991-05-17  |  5KB  |  184 lines

  1. /*------------------------------------------------------------*/
  2. /* mnofilt.c       ( OS/2 )                                   */
  3. /*                                                            */
  4. /* This filter will write the stdin input file to the stdout  */
  5. /* output and display the contents on the monochrome display. */
  6. /*                                                            */
  7. /*------------------------------------------------------------*/
  8.  
  9. #include    <stdio.h>             /* Library I/O routines.    */
  10. #include    <stdlib.h>            /* Library common routines. */
  11. #include    <string.h>            /* Library string routines. */
  12.  
  13. #define     INCL_BASE
  14. #include    <os2.h>
  15.  
  16. #include    "SYMTYPES.H"
  17. #include    "MNOCALLS.H"
  18.  
  19. VIOPHYSBUF        viopbBuffer ;
  20.  
  21. USHORT            usStatus ;
  22. USHORT            fLockStatus ;
  23.  
  24. #define BOTTOM_MSG_LINE 21
  25.  
  26. CHAR              szText [ 200 ] = "" ;
  27. CHAR *            pszText ;
  28. PCH               pchText ;
  29. BYTE              bCell [ 2 ]    = { 0 } ;
  30.  
  31. USHORT            i ;
  32. USHORT            usTextLen   = 0 ;
  33. VIOCURSORINFO     vioci ;
  34.  
  35. BOOL              fSkipLine   = FALSE ;
  36.  
  37. /*------------------------------------------------------------*/
  38. /* Main function.                                             */
  39. /*------------------------------------------------------------*/
  40.  
  41. main ()
  42.    {
  43.                /*---------------------------------------------*/
  44.                /* Hide the cursor on the monohrome display.   */
  45.                /*---------------------------------------------*/
  46.  
  47.    usStatus = MnoGetCurType ( &vioci, 0 ) ;
  48.  
  49.    if ( usStatus )
  50.       fprintf (
  51.          stderr,
  52.          "Error - accessing MnoCalls DLL, status: %u\n",
  53.          usStatus ) ;
  54.  
  55.    vioci.attr  = 0xFFFF ;
  56.  
  57.    usStatus    = MnoSetCurType ( &vioci, 0 ) ;
  58.  
  59.  
  60.                /*---------------------------------------------*/
  61.                /* Set the previous screen to Normal intensity.*/
  62.                /*---------------------------------------------*/
  63.  
  64.    bCell [ 0 ] = 0x07 ;
  65.  
  66.  
  67.    for ( i  = 1 ; i <= BOTTOM_MSG_LINE ; i++ )
  68.  
  69.       usStatus = MnoWrtNAttr (
  70.             bCell,
  71.             67,
  72.             i,
  73.             1,
  74.             0 ) ;
  75.  
  76.  
  77.                /*---------------------------------------------*/
  78.                /* Set the default attribute to bright.        */
  79.                /*---------------------------------------------*/
  80.  
  81.    strcpy ( szText, "" ) ;
  82.  
  83.    usStatus    = MnoWrtTTY (
  84.          szText,
  85.          strlen ( szText ),
  86.          0 ) ;
  87.  
  88.                /*---------------------------------------------*/
  89.                /* Copy the file.                              */
  90.                /*---------------------------------------------*/
  91.  
  92.  
  93.    pszText     = gets ( szText ) ;
  94.  
  95.    while ( pszText )
  96.       {
  97.       usTextLen   = strlen ( szText ) ;
  98.       pchText     = pszText ;
  99.  
  100.       if ( usTextLen > 0 )
  101.          puts ( szText ) ;
  102.  
  103.       if ( strncmp ( szText, "Microsoft (R) Segm", 18 ) == 0 )
  104.          fSkipLine   = TRUE ;
  105.       else
  106.       if ( strncmp ( szText, "Copyright (C) Micr", 18 ) == 0 )
  107.          fSkipLine   = TRUE ;
  108.       else
  109.          fSkipLine   = FALSE ;
  110.  
  111.  
  112.       if (( usTextLen > 0 ) &&
  113.           ( ! fSkipLine ))
  114.          {
  115.  
  116.                /*---------------------------------------------*/
  117.                /* Scroll up by one line.                      */
  118.                /*---------------------------------------------*/
  119.  
  120.          bCell [ 0 ] = ' ' ;
  121.          bCell [ 1 ] = 0x07 ;
  122.  
  123.          usStatus    = MnoScrollUp (
  124.                1,
  125.                1,
  126.                BOTTOM_MSG_LINE,
  127.                67,
  128.                1,
  129.                bCell,
  130.                0 ) ;
  131.  
  132.                /*---------------------------------------------*/
  133.                /* Display the text on the bottom line.        */
  134.                /*---------------------------------------------*/
  135.  
  136.          usStatus    = MnoSetCurPos (
  137.                BOTTOM_MSG_LINE,
  138.                1,
  139.                0 ) ;
  140.  
  141.          if ( usTextLen > 67 )
  142.  
  143.             usStatus = MnoWrtTTY (
  144.                   szText,
  145.                   67,
  146.                   0 ) ;
  147.  
  148.          else
  149.          if ( usTextLen > 0 )
  150.  
  151.             usStatus = MnoWrtTTY (
  152.                   szText,
  153.                   usTextLen,
  154.                   0 ) ;
  155.  
  156.          }
  157.       else
  158.          {
  159.                /*---------------------------------------------*/
  160.                /* Set the bottom line back to bright.         */
  161.                /*---------------------------------------------*/
  162.  
  163.          bCell [ 0 ] = 0x0F ;
  164.  
  165.          usStatus    = MnoWrtNAttr (
  166.                bCell,
  167.                67,
  168.                BOTTOM_MSG_LINE,
  169.                1,
  170.                0 ) ;
  171.          }
  172.  
  173.       pszText  = gets ( szText ) ;
  174.       }
  175.  
  176.  
  177.    exit ( 0 ) ;
  178.  
  179.    return ( 0 ) ;
  180.  
  181.    }           /* End of main function.                       */
  182.  
  183.  
  184.