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, 5 months ago) by pazsan
Branches: MAIN
CVS tags: HEAD
Added dump handling for incomplete lines

#! /usr/stud/paysan/bin/gforth
\ file hex dump

Create buffer $10 allot

: dumpline ( addr handle -- flag )
  buffer $10 2dup 0 fill rot read-file throw
  dup /dump !  $10 <> swap 6 u.r ." : "  buffer .line cr ;

: init  cr $10 base ! ;

: filedump  ( addr count -- )  init r/o bin open-file throw >r
  0  BEGIN  $10 bounds  r@ dumpline  UNTIL  drop
  r> close-file throw ;

script? [IF]
   : alldump argc @ 2 ?DO I arg 2dup type ." :" filedump LOOP ;
   alldump bye
[THEN]

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