From 03e039820dc5092e27e81f3671652f25da7f25f1 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Tue, 12 Mar 2002 01:18:50 +0000 Subject: Swap in the new stdio code. --- libc/stdlib/atexit.c | 13 ++++++++----- libc/stdlib/ptsname.c | 13 ++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'libc/stdlib') diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index d22d6a5e7..95047e78f 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -17,7 +17,7 @@ * Changed name of __cleanup to __uClibc_cleanup. * Moved declaration of __uClibc_cleanup to __uClibc_main * where it is initialized with (possibly weak alias) - * __stdio_flush_buffers. + * _stdio_term. * * Jul 2001 Steve Thayer * @@ -141,7 +141,7 @@ void __exit_handler(int status) #endif #ifdef L_exit -extern void weak_function __stdio_flush_buffers(void); +extern void weak_function _stdio_term(void); void (*__exit_cleanup) (int) = 0; /* @@ -154,9 +154,12 @@ void exit(int rv) __exit_cleanup(rv); } - /* Clean up everything else */ - if (__stdio_flush_buffers) - __stdio_flush_buffers(); + /* If we are using stdio, try to shut it down. At the very least, + * this will attempt to commit all buffered writes. It may also + * unbuffer all writable files, or close them outright. + * Check the stdio routines for details. */ + if (_stdio_term) + _stdio_term(); _exit(rv); } diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 659049a4c..636e9c121 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -17,6 +17,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define _STDIO_UTILITY /* For _int10tostr. */ +#include #include #include #include @@ -27,6 +29,7 @@ #include #include + #if !defined UNIX98PTY_ONLY /* Check if DEV corresponds to a master pseudo terminal device. */ @@ -55,8 +58,6 @@ extern const char _ptyname2[]; /* Directory where we can find the slave pty nodes. */ #define _PATH_DEVPTS "/dev/pts/" -extern char *__ultostr(char *buf, unsigned long uval, int base, int uppercase); - /* Store at most BUFLEN characters of the pathname of the slave pseudo terminal associated with the master FD is open on in BUF. Return 0 on success, otherwise an error number. */ @@ -86,14 +87,12 @@ int ptsname_r (int fd, char *buf, size_t buflen) #ifdef TIOCGPTN if (ioctl (fd, TIOCGPTN, &ptyno) == 0) { - /* Buffer we use to print the number in. For a maximum size for - `int' of 8 bytes we never need more than 20 digits. */ - char numbuf[21]; + /* Buffer we use to print the number in. */ + char numbuf[__BUFLEN_INT10TOSTR]; static const char devpts[] = _PATH_DEVPTS; char *p; - numbuf[20] = '\0'; - p = __ultostr (&numbuf[sizeof numbuf - 1], ptyno, 10, 0); + p = _int10tostr(&numbuf[sizeof numbuf - 1], ptyno); if (buflen < sizeof devpts + &numbuf[sizeof numbuf - 1] - p) { -- cgit v1.2.3