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/ptsname.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'libc/stdlib/ptsname.c') 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