home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / internet / tms / sourcecode / tmsv2_0.asc < prev    next >
Encoding:
Text File  |  1999-04-29  |  2.5 KB  |  113 lines

  1. ;
  2. ; TagMySig..... TMS V2.00
  3. ; (C) Loki - s^D 1999
  4. ; http://www.satanicdreams.freeserve.co.uk
  5. ; loki@sdsoft.freeserve.co.uk
  6. ;
  7. ; THIS CODE IS COPYRIGHT! YOU MAY NOT USE ANY PART OF IT WITHOUT
  8. ; EXPRESSED PERMISSION FROM THE AUTOUR!!! (Just mail me and ask
  9. ; I`m not likely to say no) :)
  10. ; However, if you are in possession of a shotgun (or pretend you are)
  11. ; Then you are free to use it however you like SIR! :)
  12. ;
  13. ; Have fun!
  14. ;
  15.  
  16. Dim Sig$(60)
  17.  
  18. ThePars=NumPars
  19.  
  20. If ThePars=0     ; If there were no arguments passed, goto help
  21.   JMP Help
  22. EndIf
  23.  
  24. If Par$(1)="?"   ; If the user passes `?' as first arg, goto Help
  25.   JMP Help
  26. EndIf
  27.  
  28. If ThePars<>5
  29.   If ThePars<>4
  30.     If ThePars<>3
  31.       NPrint "Required arguments missing!!"   ; if not passed 3 or 4 or 5 args
  32.       End
  33.     EndIf
  34.   EndIf
  35. EndIf
  36.  
  37. If ReadFile(0,Par$(1))
  38.   FileInput 0                ; Use file for input
  39.   RRandomize Timer           ; Make as random as we can
  40.   FileLen$=Str$(Lof(0))+".0"
  41.   TagPos.l=Int(Rnd(1.0)*Val(FileLen$))
  42.  
  43.   While Byte$<>Chr$(10)
  44.     FileSeek 0,TagPos.l        ; Seek to Random position in the file
  45.     Byte$=Inkey$(1)          ; Get 1 byte of info from file.
  46.     TagPos.l-1
  47.   Wend
  48.  
  49.   TagPos.l+1
  50.   Byte$=""
  51.  
  52.   While Byte$<>Chr$(10)      ; Search until we have a CR (carriage return)
  53.     If Eof(0)
  54.       CloseFile 0
  55.       End
  56.     EndIf
  57.     TagPos.l+1                 ; Move forward in the file
  58.     FileSeek 0,TagPos.l        ; Seek to above pos
  59.     Byte$=Inkey$(1)          ; Grab a byte
  60.     TagLine$+Byte$           ; add byte to end of string to makeup tagline
  61.   Wend
  62.  
  63.   TagLine$=UnLeft$(TagLine$,1)  ; Rip the CR off string
  64.  
  65. Else
  66.   NPrint "Cant load your tag-lines file!"  ; Error and end
  67.   CloseFile 0
  68.   End
  69. EndIf
  70. CloseFile 0
  71.  
  72. If ReadFile(0,Par$(2))      ; attempt to read the sig!
  73.   FileInput 0
  74.   While NOT Eof(0)
  75.     Sig$(FSize)=Edit$(500)   ; parse sig into the array
  76.     FSize+1
  77.   Wend
  78. EndIf
  79. CloseFile 0
  80.  
  81. If WriteFile(0,Par$(2))
  82.   FileOutput 0
  83.   For TMP=0 To (FSize-1)
  84.     If TMP=Val(Par$(3))
  85.       If ThePars=4 OR ThePars=5
  86.         If ThePars=5
  87.           TagLine$+Par$(5)
  88.         EndIf
  89.         NPrint Par$(4)+TagLine$
  90.       Else
  91.         NPrint TagLine$
  92.       EndIf
  93.     Else
  94.       NPrint Sig$(TMP)
  95.     EndIf
  96.   Next
  97. EndIf
  98.  
  99. End
  100.  
  101. Help
  102.   NPrint "TMS (TagMySig) V1.00 - (C) Loki - s^D 1999"
  103.   NPrint "MailTo: loki@sdsoft.freeserve.co.uk"
  104.   NPrint "   URL: http://www.satanicdreams.freeserve.co.uk"
  105.   NPrint ""
  106.   NPrint "Usage: TMS <TagLines_File> <Signature_File> <Strip_Line> [<Prefix_Text>] [<Suffix_Text>]"
  107.   NPrint ""
  108.   NPrint "Please see the docs for more info on usage."
  109.   End
  110.  
  111.  
  112.  
  113.