--
--	Inmos Libraries
--	Copyright (C) 1988, 1989, 1990, 1991, 1993  Inmos Limited
--
--	This library is free software; you can redistribute it and/or
--	modify it under the terms of the GNU Lesser General Public
--	License as published by the Free Software Foundation; either
--	version 2 of the License, or (at your option) any later version.
--
--	This library is distributed in the hope that it will be useful,
--	but WITHOUT ANY WARRANTY; without even the implied warranty of
--	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--	Lesser General Public License for more details.
--
--	You should have received a copy of the GNU Lesser General Public
--	License along with this library; if not, write to the Free Software
--	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
--

--** @module hostio

#COMMENT "Host i/o library, V1.00, 10/03/89"
#COMMENT "(c) Copyright INMOS Limited 1989"
#INCLUDE "hostio.inc"
#USE "splib.lib"

--* Test for the existence of a file.
--
-- @param fs from server
-- @param ts to server
-- @param filename the name of the file to test for the existence of.
--   The name of the file must fit exactly into filename, i.e. there
--   are (SIZE filename) characters in the name of the file.  A
--   directory specification may form part of filename.
-- @param exists TRUE if the file exists; FALSE otherwise
PROC so.test.exists (CHAN OF SP fs, ts, VAL []BYTE filename, BOOL exists)
  BYTE  result :
  INT32 streamid :

  SEQ
    sp.open (fs, ts, filename, spt.binary, spm.input, streamid, result)
    IF
      result = spr.ok
        SEQ
          sp.close (fs, ts, streamid, result)
          exists := TRUE
      TRUE
        exists := FALSE
:
