/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1996-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Phong Vo <[email protected]> *17* Glenn Fowler <[email protected]> *18* *19***********************************************************************/20#include "rshdr.h"2122/*23* announce sp open for write on path24*/2526#if __STD_C27int rsfilewrite(Rs_t* rs, Sfio_t* sp, const char* path)28#else29int rsfilewrite(rs, sp, path)30Rs_t* rs;31Sfio_t* sp;32char* path;33#endif34{35if ((rs->events & RS_FILE_WRITE) && rsnotify(rs, RS_FILE_WRITE, sp, (Void_t*)path, rs->disc) < 0)36return -1;37return 0;38}3940/*41* announce sp open for read on path42*/4344#if __STD_C45int rsfileread(Rs_t* rs, Sfio_t* sp, const char* path)46#else47int rsfileread(rs, sp, path)48Rs_t* rs;49Sfio_t* sp;50char* path;51#endif52{53if ((rs->events & RS_FILE_READ) && rsnotify(rs, RS_FILE_READ, sp, (Void_t*)path, rs->disc) < 0)54return -1;55return 0;56}5758/*59* close file stream60*/6162#if __STD_C63int rsfileclose(Rs_t* rs, Sfio_t* sp)64#else65int rsfileclose(rs, sp)66Rs_t* rs;67Sfio_t* sp;68#endif69{70int n;7172if (rs->events & RS_FILE_CLOSE)73{74if ((n = rsnotify(rs, RS_FILE_CLOSE, sp, (Void_t*)0, rs->disc)) < 0)75return -1;76if (n)77return 0;78}79if (sp != sfstdout)80return sfclose(sp);81return 0;82}838485