home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / internet / tms / sourcecode / tmsv1_0.asc < prev    next >
Encoding:
Text File  |  1999-03-12  |  2.7 KB  |  111 lines

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