aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
Diffstat (limited to 'libio')
-rw-r--r--libio/Makefile9
-rw-r--r--libio/Versions27
-rw-r--r--libio/fileops.c60
-rw-r--r--libio/fputwc.c45
-rw-r--r--libio/fputwc_u.c40
-rw-r--r--libio/ftello.c14
-rw-r--r--libio/ftello64.c13
-rw-r--r--libio/fwprintf.c36
-rw-r--r--libio/fwscanf.c35
-rw-r--r--libio/genops.c53
-rw-r--r--libio/getwc.c50
-rw-r--r--libio/getwc_u.c39
-rw-r--r--libio/getwchar.c42
-rw-r--r--libio/getwchar_u.c35
-rw-r--r--libio/iofdopen.c5
-rw-r--r--libio/iofgetpos.c16
-rw-r--r--libio/iofgetpos64.c20
-rw-r--r--libio/iofgetws.c63
-rw-r--r--libio/iofgetws_u.c59
-rw-r--r--libio/iofopen.c3
-rw-r--r--libio/iofopen64.c3
-rw-r--r--libio/iofopncook.c6
-rw-r--r--libio/iofputs.c9
-rw-r--r--libio/iofputs_u.c8
-rw-r--r--libio/iofputws.c45
-rw-r--r--libio/iofputws_u.c42
-rw-r--r--libio/iofsetpos.c18
-rw-r--r--libio/iofsetpos64.c18
-rw-r--r--libio/ioftell.c14
-rw-r--r--libio/iofwide.c365
-rw-r--r--libio/iofwrite.c7
-rw-r--r--libio/iofwrite_u.c17
-rw-r--r--libio/iogetwline.c120
-rw-r--r--libio/iolibio.h4
-rw-r--r--libio/iopopen.c28
-rw-r--r--libio/ioputs.c11
-rw-r--r--libio/ioseekoff.c28
-rw-r--r--libio/ioseekpos.c8
-rw-r--r--libio/iosetbuffer.c5
-rw-r--r--libio/iosetvbuf.c6
-rw-r--r--libio/ioungetwc.c44
-rw-r--r--libio/iovdprintf.c5
-rw-r--r--libio/iovsprintf.c4
-rw-r--r--libio/iovsscanf.c4
-rw-r--r--libio/iovswscanf.c48
-rw-r--r--libio/iowpadn.c76
-rw-r--r--libio/libio.h114
-rw-r--r--libio/libioP.h157
-rw-r--r--libio/memstream.c85
-rw-r--r--libio/obprintf.c8
-rw-r--r--libio/oldfileops.c10
-rw-r--r--libio/oldiofgetpos.c61
-rw-r--r--libio/oldiofgetpos64.c66
-rw-r--r--libio/oldiofsetpos.c59
-rw-r--r--libio/oldiofsetpos64.c64
-rw-r--r--libio/oldstdfiles.c7
-rw-r--r--libio/putwc.c35
-rw-r--r--libio/putwc_u.c29
-rw-r--r--libio/putwchar.c34
-rw-r--r--libio/putwchar_u.c28
-rw-r--r--libio/stdfiles.c12
-rw-r--r--libio/strops.c10
-rw-r--r--libio/swprintf.c38
-rw-r--r--libio/swscanf.c37
-rw-r--r--libio/tst_swprintf.c42
-rw-r--r--libio/tst_swscanf.c38
-rw-r--r--libio/tst_wprintf.c10
-rw-r--r--libio/tst_wscanf.c28
-rw-r--r--libio/tst_wscanf.input1
-rw-r--r--libio/vasprintf.c4
-rw-r--r--libio/vsnprintf.c4
-rw-r--r--libio/vswprintf.c144
-rw-r--r--libio/vwprintf.c31
-rw-r--r--libio/vwscanf.c35
-rw-r--r--libio/wfiledoalloc.c105
-rw-r--r--libio/wfileops.c716
-rw-r--r--libio/wgenops.c747
-rw-r--r--libio/wprintf.c35
-rw-r--r--libio/wscanf.c36
-rw-r--r--libio/wstrops.c330
80 files changed, 4568 insertions, 199 deletions
diff --git a/libio/Makefile b/libio/Makefile
index 948556e15c..6fcde40814 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -25,11 +25,16 @@ headers := stdio.h libio.h _G_config.h bits/stdio.h
routines := \
filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
- iofopncook iofputs iofread iofsetpos ioftell \
+ iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
ioseekoff ioseekpos iosetbuffer iosetvbuf iosprintf ioungetc \
iovsprintf iovsscanf \
iofgetpos64 iofopen64 iofsetpos64 \
+ oldiofgetpos oldiofgetpos64 oldiofsetpos oldiofsetpos64 \
+ fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
+ iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
+ putchar putchar_u swprintf vwprintf wprintf wscanf fwscanf vwscanf \
+ vswprintf iovswscanf swscanf wgenops wstrops wfileops iofwide \
\
clearerr feof ferror fileno fputc freopen fseek getc getchar \
memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
@@ -38,6 +43,8 @@ routines := \
\
libc_fatal
+tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf
+
all: # Make this the default target; it will be defined in Rules.
include ../Makeconfig
diff --git a/libio/Versions b/libio/Versions
index 61b767a2d3..c7a5f668a1 100644
--- a/libio/Versions
+++ b/libio/Versions
@@ -100,4 +100,31 @@ libc {
# p*
pclose; popen;
}
+ GLIBC_2.2 {
+ # functions used in libstdc++
+ _IO_fgetpos; _IO_fgetpos64; _IO_fsetpos; _IO_fsetpos64;
+
+ # f*
+ fgetpos; fgetpos64; fgetwc; fgetwc_unlocked; fgetws; fgetws_unlocked;
+ fputwc; fputwc_unlocked; fputws; fputws_unlocked; fsetpos; fsetpos64;
+ fwide; fwprintf; fwscanf;
+
+ # g*
+ getwc; getwc_unlocked; getwchar; getwchar_unlocked;
+
+ # p*
+ putwc; putwc_unlocked; putwchar; putwchar_unlocked;
+
+ # s*
+ swprintf; swscanf;
+
+ # u*
+ ungetwc;
+
+ # v*
+ vfwprintf; vswprintf; vwprintf; vfwscanf; vswscanf; vwscanf;
+
+ # w*
+ wprintf; wscanf;
+ }
}
diff --git a/libio/fileops.c b/libio/fileops.c
index f5ec0e2b9e..8d480ad08b 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -136,9 +136,18 @@ _IO_new_file_close_it (fp)
close_status = _IO_SYSCLOSE (fp);
/* Free buffer. */
- _IO_setb (fp, NULL, NULL, 0);
- _IO_setg (fp, NULL, NULL, NULL);
- _IO_setp (fp, NULL, NULL);
+ if (fp->_mode <= 0)
+ {
+ _IO_setb (fp, NULL, NULL, 0);
+ _IO_setg (fp, NULL, NULL, NULL);
+ _IO_setp (fp, NULL, NULL);
+ }
+ else
+ {
+ _IO_wsetb (fp, NULL, NULL, 0);
+ _IO_wsetg (fp, NULL, NULL, NULL);
+ _IO_wsetp (fp, NULL, NULL);
+ }
_IO_un_link (fp);
fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
@@ -277,14 +286,14 @@ _IO_new_file_setbuf (fp, p, len)
char *p;
_IO_ssize_t len;
{
- if (_IO_default_setbuf (fp, p, len) == NULL)
- return NULL;
+ if (_IO_default_setbuf (fp, p, len) == NULL)
+ return NULL;
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
- = fp->_IO_buf_base;
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
+ = fp->_IO_buf_base;
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
- return fp;
+ return fp;
}
static int new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
@@ -319,7 +328,7 @@ new_do_write (fp, data, to_do)
fp->_offset = _IO_pos_BAD;
else if (fp->_IO_read_end != fp->_IO_write_base)
{
- _IO_fpos64_t new_pos
+ _IO_off64_t new_pos
= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
if (new_pos == _IO_pos_BAD)
return 0;
@@ -330,7 +339,8 @@ new_do_write (fp, data, to_do)
fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, count) + 1;
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
- fp->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ fp->_IO_write_end = (fp->_mode < 0
+ && (fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
? fp->_IO_buf_base : fp->_IO_buf_end);
return count;
}
@@ -410,7 +420,7 @@ _IO_new_file_overflow (f, ch)
return EOF;
}
/* If currently reading or no buffer allocated. */
- if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
+ if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0 || f->_IO_write_base == 0)
{
/* Allocate a buffer if needed. */
if (f->_IO_write_base == 0)
@@ -433,18 +443,20 @@ _IO_new_file_overflow (f, ch)
f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
f->_flags |= _IO_CURRENTLY_PUTTING;
- if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ if (f->_mode < 0 && f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
f->_IO_write_end = f->_IO_write_ptr;
}
if (ch == EOF)
- return _IO_do_flush (f);
+ return _IO_new_do_write(f, f->_IO_write_base,
+ f->_IO_write_ptr - f->_IO_write_base);</