/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-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* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped2223#include "stdhdr.h"2425wchar_t*26fgetws(wchar_t* s, int n, Sfio_t* f)27{28register wchar_t* p = s;29register wchar_t* e = s + n - 1;30register wint_t c;3132STDIO_PTR(f, "fgets", wchar_t*, (wchar_t*, int, Sfio_t*), (s, n, f))3334FWIDE(f, 0);35while (p < e && (c = fgetwc(f)) != WEOF && (*p++ = c) != '\n');36*p = 0;37return s;38}3940wchar_t*41getws(wchar_t* s)42{43register wchar_t* p = s;44register wchar_t* e = s + BUFSIZ - 1;45register wint_t c;4647FWIDE(sfstdin, 0);48while (p < e && (c = fgetwc(sfstdin)) != WEOF && (*p++ = c) != '\n');49*p = 0;50return s;51}525354