home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / vlib105.zip / VLIBDEMO.C < prev    next >
C/C++ Source or Header  |  1992-10-27  |  2KB  |  67 lines

  1. /*-------------------------------[ Vlib ]------------------------------*/
  2. /*                      Text File Viewer Library                       */
  3. /*---------------------------------------------------------------------*/
  4. /* Written by: Jeff Dunlop                                             */
  5. /* Copyright 1991 DB/Soft Publishing Co. All Rights Reserved           */
  6. /*---------------------------------------------------------------------*/
  7.  
  8. /*--------------------------[ vlibdemo.c ]-----------------------------*/
  9. /*                        Demo shell for VLib                          */
  10. /*---------------------------------------------------------------------*/
  11.  
  12. #ifdef __TURBOC__
  13. #   include <alloc.h>
  14. #endif
  15. #include <malloc.h>
  16. #include <stdio.h>
  17.  
  18. #include "vlib.h"
  19.  
  20. /*--------------------------------------------------------------*/
  21. /*---------------------------[ main ]---------------------------*/
  22. /*--------------------------------------------------------------*/
  23.  
  24. int main(int argc, char *argv[])
  25. {
  26.     int Fore = vlIsMono() ? VL_LIGHTGREY : VL_YELLOW,
  27.         Back = vlIsMono() ? VL_BLACK : VL_BLUE,
  28.         result;
  29.  
  30.     BORDER bd_info = {{1}, {"┌─┐│└─┘"}, {VL_YELLOW}, {VL_BLUE}};
  31.  
  32.     if ( vlIsMono() )
  33.     {
  34.         bd_info.Foreground = VL_LIGHTGREY;
  35.         bd_info.Background = VL_BLACK;
  36.     }
  37.  
  38.     if ( argc < 2 )
  39.     {
  40.         puts("\nVlibDemo v.1.03");
  41.         puts("Copyright 1992 DB/Soft Publishing Co.");
  42.         puts("All Rights Reserved");
  43.         puts("\nSyntax: VlibDemo <view file>");
  44.  
  45.     }
  46.     else
  47.     {
  48.         result = vlLister(argv[1], 1, 1, vlGetCols() - 2, vlGetRows() - 2,
  49.             (unsigned char)Fore, (unsigned char)Back, 0x2000, &bd_info);
  50.         switch ( result )
  51.         {
  52.             case VLIB_DOSERR:
  53.                 puts("File not found");
  54.                 break;
  55.             case VLIB_ALLOCERR:
  56.                 puts("Not enough memory");
  57.                 break;
  58.             case 0:
  59.                 break;
  60.             default:
  61.                 printf("Error %d\n", result);
  62.                 break;
  63.         }
  64.     }
  65.     return 0;
  66. }
  67.