File:  [gforth] / gforth / filedump.fs
Revision 1.2: download - view: text, annotated - select for diffs
Thu Jun 8 15:28:26 1995 UTC (24 years, 7 months ago) by pazsan
Branches: MAIN
CVS tags: HEAD
Added dump handling for incomplete lines

    1: #! /usr/stud/paysan/bin/gforth
    2: \ file hex dump
    3: 
    4: Create buffer $10 allot
    5: 
    6: : dumpline ( addr handle -- flag )
    7:   buffer $10 2dup 0 fill rot read-file throw
    8:   dup /dump !  $10 <> swap 6 u.r ." : "  buffer .line cr ;
    9: 
   10: : init  cr $10 base ! ;
   11: 
   12: : filedump  ( addr count -- )  init r/o bin open-file throw >r
   13:   0  BEGIN  $10 bounds  r@ dumpline  UNTIL  drop
   14:   r> close-file throw ;
   15: 
   16: script? [IF]
   17:    : alldump argc @ 2 ?DO I arg 2dup type ." :" filedump LOOP ;
   18:    alldump bye
   19: [THEN]

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>