'   +----------------------------------------------------------------------+
'   |                                                                      |
'   |       PBClone  Copyright (c) 1990-1991  Thomas G. Hanlin III         |
'   |                                                                      |
'   +----------------------------------------------------------------------+

' This is another simple demo of the PBClone routines.  It allows you to
' view the files in an archive (.ARC, .LZH, .PAK, or .ZIP).
' Typically, this would be converted to an .EXE file using these steps:
'    BC VARCDEMO/O;
'    LINK VARCDEMO/EX,,NUL,PBCLONE;

   DECLARE SUB CloseA ()
   DECLARE SUB FindFirstA (Archive$, FileName$, ErrCode%)
   DECLARE SUB FindNextA (ErrCode%)
   DECLARE SUB GetNameA (FileName$, FileNameLen%)

   DEFINT A-Z

   Arc$ = LTRIM$(RTRIM$(COMMAND$))
   IF LEN(Arc$) = 0 THEN
      PRINT "Please specify the name of an archive."
      END
   END IF

   FindFirstA Arc$, "*.*", ErrCode
   IF ErrCode THEN
      PRINT "Unable to open specified archive."
      END
   END IF

   FileName$ = SPACE$(12)
   DO
      GetNameA FileName$, FLen
      PRINT LEFT$(FileName$, FLen); SPACE$(16 - FLen);
      FindNextA ErrCode
   LOOP UNTIL ErrCode

   CloseA
