mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
80 lines
2.9 KiB
C
80 lines
2.9 KiB
C
/*
|
|
* CDE - Common Desktop Environment
|
|
*
|
|
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
|
*
|
|
* These libraries and programs are free software; you can
|
|
* redistribute them and/or modify them 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.
|
|
*
|
|
* These libraries and programs are distributed in the hope that
|
|
* they 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 these libraries and programs; if not, write
|
|
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
|
* Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
/* $XConsortium: stdvbuf.c /main/3 1995/11/01 18:40:31 rswiston $ */
|
|
/***************************************************************
|
|
* *
|
|
* AT&T - PROPRIETARY *
|
|
* *
|
|
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
|
|
* AT&T CORP. *
|
|
* *
|
|
* Copyright (c) 1995 AT&T Corp. *
|
|
* All Rights Reserved *
|
|
* *
|
|
* This software is licensed by AT&T Corp. *
|
|
* under the terms and conditions of the license in *
|
|
* http://www.research.att.com/orgs/ssr/book/reuse *
|
|
* *
|
|
* This software was created by the *
|
|
* Software Engineering Research Department *
|
|
* AT&T Bell Laboratories *
|
|
* *
|
|
* For further information contact *
|
|
* gsf@research.att.com *
|
|
* *
|
|
***************************************************************/
|
|
#include "sfhdr.h"
|
|
#include "stdio.h"
|
|
|
|
/* Stdio function setvbuf()
|
|
**
|
|
** Written by Kiem-Phong Vo (12/10/90)
|
|
*/
|
|
|
|
#if __STD_C
|
|
int _stdsetvbuf(Sfio_t* f, char *buf, int type, int size)
|
|
#else
|
|
_stdsetvbuf(f,buf,type,size)
|
|
Sfio_t *f;
|
|
char *buf;
|
|
int type;
|
|
int size;
|
|
#endif
|
|
{
|
|
if(type == _IOLBF)
|
|
sfset(f,SF_LINE,1);
|
|
else if((f->flags&SF_STRING))
|
|
return -1;
|
|
else if(type == _IONBF)
|
|
{ sfsync(f);
|
|
sfsetbuf(f,NIL(Void_t*),0);
|
|
}
|
|
else if(type == _IOFBF)
|
|
{ if(size == 0)
|
|
size = SF_BUFSIZE;
|
|
sfsync(f);
|
|
sfsetbuf(f,(Void_t*)buf,size);
|
|
}
|
|
|
|
return 0;
|
|
}
|