File:  [gforth] / gforth / filedump.fs
Revision 1.5: download - view: text, annotated - select for diffs
Thu Sep 19 22:17:31 1996 UTC (23 years ago) by pazsan
Branches: MAIN
CVS tags: v0-3-0, v0-2-1, v0-2-0, HEAD
Steps to make 0.2.0 dist-ready.

#! /usr/local/lib/gforth/0.2.0/kernel.fi
\ file hex dump

Create buffer $10 allot

: dumpline ( addr handle -- flag )
  buffer $10 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>