home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / s1 / shredder / !Shredder / SourceCode / FileShredS < prev   
Encoding:
Text File  |  1994-10-23  |  4.5 KB  |  142 lines

  1. ;  SSSSSS
  2. ;  SSSSSS     fff  t
  3. ;  SSS    ooo f   ttt
  4. ;  SSS    o o ff   t
  5. ;  SSSSSS ooo f    tt
  6. ;  SSSSSS
  7. ;  SSSSSS  t       fff fff
  8. ;     SSS ttt u u  f   f
  9. ;     SSS  t  u u  ff  ff
  10. ;  SSSSSS  tt uuu  f   f
  11. ;  SSSSSS
  12.  
  13. ; © SoftStuff 1994
  14. ; Written by Peter Jones
  15.  
  16. ; Written using Zap
  17.  
  18. ; version 1.02 (23-Oct-1994)-corrected help on Shred so that it will includue;                            syntax, and amended punctuation.
  19.  
  20. ; This is the module source using the utterly brilliant extASM, byEvind Hagen
  21.  
  22. #type       &FFA                                 ; make it a module
  23. #base       0                                    ; code offset
  24. #name        FileShred                            ; module name
  25. #smile      ON                                   ; make life better :-)
  26. #set        newline = 13
  27. .module_header
  28.  
  29.    dcd      &00000000                            ; no start-up code
  30.    dcd      &00000000                            ; no initialisation code
  31.    dcd      &00000000                            ; no finialisation code
  32.    dcd      &00000000                            ; no service call code
  33.    dcd      module_title                         ; the module's title
  34.    dcd      module_help                 ; help for the module
  35.    dcd        command_table             ; the command table
  36.    dcd        &00000000                 ; no swis
  37.    dcd        &00000000                 ; no swis
  38.    dcd        &00000000                 ; no swis
  39.    dcd      &00000000                 ; no swis
  40.  
  41. .shred_code
  42.  
  43. ; © SoftStuff 1994
  44. ; Written by Peter Jones
  45. ; do not copy this out and pretend its your code. I WILL NOT BE PLEASED.
  46.  
  47. #set            filename   = 6                 ; the names to be used
  48. #set        filehandle = 7
  49. #set        position   = 8
  50. #set        filesize   = 9
  51.  
  52.  stmfd          r13!,{r14}                     ; remember the return address
  53.  
  54.  mov            filename,r0                    ; remember the filename
  55.  
  56.  mov        r0,#&C2                   ; &C2=open file for output
  57.  mov            r1,filename                    ; get reddy to rumble
  58.  swi        OS_Find                ; perform OS_Find
  59.  mov        filehandle,r0                  ; remember the filehandle
  60.  
  61.  mov        r0,#&05                        ; 5=read file info
  62.  swi        XOS_File               ; perform OS_File
  63.  bvs        muckup                    ; in case anything goes wrong
  64.  mov        filesize,r4                    ; remember filesize
  65.  
  66.  mov        position,#0               ; intialise position counter
  67.  
  68.  mov        r1,filehandle                  ; get ready to overwrite file
  69.  mov        r0,#"0"                   ; with 0's
  70.  
  71. .putit
  72.  
  73.  swi        OS_BPut                        ; put a 0 onto the file
  74.  
  75.  add        position,position,#1           ; increament the positon
  76.  cmp        position,filesize           ; are we at end of file?
  77.  bne        putit                   ; if not write another byte
  78.  
  79.  mov        r0,#&00                   ; &80=close file
  80.  swi        XOS_Find                       ; perform OS_File
  81.  bvs        muckup                   ; just in case
  82.  
  83.  mov        r0,#&06                        ; &06=delete file
  84.  mov        r1,filename               ; the condemned
  85.  swi        OS_File                   ; kill it!!!!!!!!!!!!!!!
  86.  
  87.  ldmfd        r13!,{pc}                      ; go back to OS
  88.  
  89. .muckup                                        ; in case of something nasty
  90.  
  91.  mov            r1,filehandle
  92.  swi        OS_Find                        ; close the lucky file
  93.  
  94.  mov        pc,r14                         ; go back to OS
  95.  
  96.  
  97. .shred_help                                    ; help on the command
  98.  
  99.   dcb      "*Shred will shred a file by overwrittng it and then deleting"
  100.   dcb      "it. The file will be unrecoverable, so no prying eyes may see"
  101.   dcb      " it."
  102.   dcb       newline
  103.   dcb       "ONLY USE WITH FILES YOU HAVE FINISHED WITH OR LATIN COURSEWORK."
  104.   dcb       newline
  105.   dcb       "Sorry, this module can only cope with files, no directories. If"
  106.   dcb       " you want to shred a directory, please use the desktop frontend."
  107.   dcb      newline
  108.  
  109. .shred_syntax                                  ; syntax for the command
  110.  
  111.    dcb      "Syntax: *Shred <filename>"
  112.    dcb        0
  113.    align
  114.  
  115. .module_title
  116.  
  117.    dcb      "FileShred"                        ; the module's name
  118.    dcb        0
  119.    align
  120.  
  121. .module_help                                   ; help on the module
  122.  
  123.    dcb      "FileShred ",9,"1.02 (23 Oct 1994) © SoftStuff & Peter Jones",0
  124.    align
  125.  
  126. .command_table                                 ; the command table
  127.  
  128.    dcb      "Shred",0                          ; the command
  129.    align
  130.  
  131.      dcd    shred_code                         ; the code for the command
  132.      dcd    &00010001                         ; the flags for 'Shred'
  133.      dcd    shred_syntax               ; the syntax for 'Shred'
  134.      dcd    shred_help                   ; the help for 'Shred'
  135.  
  136.    dcb 0                                       ; finish the table off
  137.  
  138.  
  139.  
  140.  
  141.  
  142.