Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/src/cmd/4th/lib/savefile.4th

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


\ 4tH library - SAVE-FILE - Copyright 2003,2008 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

[UNDEFINED] within [IF]
[NEEDS lib/range.4th]
[THEN]

[UNDEFINED] save-file [IF]
: save-file >in @ cin source 4 ;        ( -- n1 h a n2 4)

: restore-file                          ( n1 h a n2 4 -- f)
  0<> >r over source over dup >r + between r> swap >r >r
  2dup r> -rot over + between r> or 0=  \ check if buffers do not overlap
  if rot :noname use ; catch 0= if source! >in ! r> 0= exit then then
  drop drop drop drop r>                \ Note: count is transformed to flag!
; 
[THEN]

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.