home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / PROGRAMM / BUILDER.ZIP / TUTOR2.BLD < prev    next >
Text File  |  1992-11-17  |  3KB  |  113 lines

  1. ' First we declare our variables
  2. Longint Flag
  3. String Temp, BCFFilename, filename, directory
  4.  
  5. ' Check to see if we have the minimum number of command line parameters
  6. if ParamCount < 4
  7.  
  8. ' It not call the help screen
  9.   ShowHelp
  10. end
  11.  
  12. ' Force the second parameter to uppercase and assign it to a string
  13. BCFFilename:= Uppercase "%2"
  14.  
  15. ' Add the default extention .BCF if none was given
  16. Flag:= HasExtension BCFFilename
  17. If not (Flag) BCFFilename:= BCFFilename+".BCF"
  18.  
  19. ' Force the third parameter to uppercase and assign it to a string
  20. filename:= Uppercase "%3"
  21.  
  22. ' Force the fourth parameter to uppercase and assign it to a string
  23. Directory:= Uppercase "%4"
  24.  
  25. ' Check for no specified directory, and assign one if needed
  26. if Directory == ""
  27.    Directory:= CurrentDrive
  28.    Temp:= CurrentDir
  29.    Directory:= Directory+Temp
  30. end
  31.  
  32. Temp:= Uppercase "%1"
  33. ' verify the parameters
  34. select Temp from
  35.   Case "A":
  36.      Addfile
  37.   Case "C":
  38.      CopyFile
  39.   Case "D":
  40.      DeleteFile
  41. end
  42.  
  43. ' If we get here then %1 was not one of the commands, so we
  44. ' want to display the help screen.
  45.  
  46. ShowHelp
  47.  
  48. ' Now we list our subroutine
  49.  
  50. Sub ADDFile
  51. ' Add a file to a BCF or create one if the BCF does not exist.
  52. ' We wil check flag for any errors.
  53.   Flag:= BCFADD BCFFilename, filename
  54.   if not Flag
  55.      say "Error adding "; filename; " to "; BCFFilename
  56.      exit 1
  57.   end else
  58.      say filename;" added to "; BCFFilename
  59.      exit 0
  60.   end
  61. end
  62.  
  63. sub CopyFile
  64. ' Copy a file from a BCF.
  65. ' We will check flag to any errors.
  66. Flag:= BCFCopy BCFFilename, filename, directory
  67.   if not flag
  68.      say "Error copying "; filename;" to ";directory;" from ";BCFFilename
  69.      exit 1
  70.   end else
  71.      say filename;" copied from ";BCFFilename;" to ";directory
  72.      exit 0
  73.   end
  74. end
  75.  
  76. sub DeleteFile
  77. ' Delete a file from BCF
  78. ' We will check flag for any errors.
  79.  
  80. Flag:= BCFDelete BCFFilename, filename
  81.   if not flag
  82.      say "Error deleting "; filename; " from "; BCFFilename
  83.      exit 1
  84.   end else
  85.      say filename; " deleted from ";BCFFilename
  86.      exit 0
  87.   end
  88. end
  89.  
  90. sub ShowHelp
  91. ' Display a help screen
  92.     Say "<Bright Red>Error<Normal> invalid command line"
  93.     say "BCF.EXE BUILDER Compressed File Utility"
  94.     say "Copyright hyerkinetix, inc. 1991"
  95.     say "BUILDER compressed file utility to add, delete and copy"
  96.     say "files to/from a .BCF file"
  97.     say
  98.     say "Command line format"
  99.     say "BCF [a/c/d] BCFFilename filename <directory>"
  100.     say "a - add a file to the BUILDER Compressed File"
  101.     say "c - copy a file from the BUILDER Compressed File to the"
  102.     say "    optional directory"
  103.     say "d - delete a file from the BUILDER Compressed File"
  104.     say "BCFFilename - name of the BCF file to be acted upon"
  105.     say "filename - filename to add/copy/delete. COPY/DELETE support wildcards."
  106.     say "directory - optional destination parameter for the copy command."
  107.     say
  108.     exit 1
  109. end
  110.  
  111.  
  112.  
  113.