home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / vlib107 / vlibdemo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-01  |  2.1 KB  |  70 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 <io.h>
  16. #include <fcntl.h>
  17. #include <malloc.h>
  18. #include <stdio.h>
  19.  
  20. #include "vlib.h"
  21.  
  22. /*--------------------------------------------------------------*/
  23. /*---------------------------[ main ]---------------------------*/
  24. /*--------------------------------------------------------------*/
  25.  
  26. int main(int argc, char *argv[])
  27. {
  28.     register int Fore = vlIsMono() ? VL_LIGHTGREY : VL_YELLOW,
  29.         Back = vlIsMono() ? VL_BLACK : VL_BLUE,
  30.         result;
  31.  
  32.     BORDER bd_info = {{1}, {"┌─┐│└─┘"}, {VL_YELLOW}, {VL_BLUE}};
  33.  
  34.     if ( vlIsMono() )
  35.     {
  36.         bd_info.Foreground = VL_LIGHTGREY;
  37.         bd_info.Background = VL_BLACK;
  38.     }
  39.  
  40.     if ( argc < 2 )
  41.     {
  42.         puts("\nVlibDemo v.1.06v");
  43.         puts("Copyright 1992 DB/Soft Publishing Co.");
  44.         puts("All Rights Reserved");
  45.         puts("\nSyntax: VlibDemo <view file>");
  46.  
  47.     }
  48.     else
  49.     {
  50.         result = vlFileLister(argv[1], 1, 1, vlGetCols() - 2,
  51.             vlGetRows() - 2, Fore, Back, 0x2000, &bd_info);
  52.  
  53.         switch ( result )
  54.         {
  55.             case VLIB_DOSERR:
  56.                 puts("File not found");
  57.                 break;
  58.             case VLIB_ALLOCERR:
  59.                 puts("Not enough memory");
  60.                 break;
  61.             case 0:
  62.                 break;
  63.             default:
  64.                 printf("Error %d\n", result);
  65.                 break;
  66.         }
  67.     }
  68.     return 0;
  69. }
  70.