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

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


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

\ Skips everything until the read string from the input
\ source defined by SOURCE starts with the string defined
\ by count pair a/n

\ Load definitions when needed
[UNDEFINED] COMPARE [IF]
[NEEDS lib/compare.4th]
[THEN]

[UNDEFINED] line-found? [IF]
defer line-found?

: scan-file                            ( -- f)
  begin
    refill dup
    if >r line-found? r> over if drop else swap then
    else exit then 0=
  until
;
                                       ( a n -- a n f)
:noname 2dup source drop over compare ; is line-found?
[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.