/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#include "sfhdr.h"
/* Delete all pending data in the buffer
**
** Written by Kiem-Phong Vo.
*/
#if __STD_C
#else
int sfpurge(f)
Sfio_t* f;
#endif
{
SFMTXDECL(f);
SFMTXENTER(f,-1);
SFMTXRETURN(f, -1);
/* cannot purge read string streams */
goto done;
SFLOCK(f,0);
/* if memory map must be a read stream, pretend data is gone */
#ifdef MAP_TYPE
if(f->data)
}
SFOPEN(f,0);
SFMTXRETURN(f, 0);
}
#endif
{
default :
SFOPEN(f,0);
SFMTXRETURN(f, -1);
case SF_WRITE :
break;
/* 2-way pipe, must clear read buffer */
/* fall through */
case SF_READ:
}
break;
}
SFOPEN(f,0);
done:
SFMTXRETURN(f, 0);
}