summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-31 05:20:53 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-31 05:20:53 +0000
commitde153e7f50baa4ea7fac013f3b77b3a4fe314664 (patch)
tree50fb80d978c873cb63952226707a8683ba31e929
parent02fb3d179ddd3c88f4d4f31d4b27948b48bced2b (diff)
Update.
* stdio-common/Makefile (tests): Add tst-fmemopen. * stdio-common/tst-fmemopen.c: New file. Test case by Ben Collins <bcollins@debian.org>. * libio/iofopncook.c (_IO_cookie_seek): Correct test for error. * libio/fmemopen.c (fmemopen_read): Return 0 at end of buffer. (fmemopen_write): Set errno at end of buffer.
-rw-r--r--ChangeLog9
-rw-r--r--libio/fmemopen.c10
-rw-r--r--libio/iofopncook.c3
-rw-r--r--localedata/ChangeLog65
-rw-r--r--stdio-common/tst-fmemopen.c111
5 files changed, 194 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a9c9b69eca..78e5d31bb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2000-10-30 Ulrich Drepper <drepper@redhat.com>
+ * stdio-common/Makefile (tests): Add tst-fmemopen.
+ * stdio-common/tst-fmemopen.c: New file.
+ Test case by Ben Collins <bcollins@debian.org>.
+
+ * libio/iofopncook.c (_IO_cookie_seek): Correct test for error.
+
+ * libio/fmemopen.c (fmemopen_read): Return 0 at end of buffer.
+ (fmemopen_write): Set errno at end of buffer.
+
* posix/runtests.c (main): Don't use exit() to avoid warning with
broken compilers.
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index 92df2e4424..99670b5c58 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -69,6 +69,7 @@
* so I don't need the stream to add null characters on its own.)
*/
+#include <errno.h>
#include <libio.h>
#include <stdio.h>
#include <stdlib.h>
@@ -96,7 +97,7 @@ fmemopen_read (void *cookie, char *b, size_t s)
if (c->pos + s > c->size)
{
if (c->pos == c->size)
- return -1;
+ return 0;
s = c->size - c->pos;
}
@@ -123,7 +124,10 @@ fmemopen_write (void *cookie, const char *b, size_t s)
if (c->pos + s + addnullc > c->size)
{
if (c->pos + addnullc == c->size)
- return -1;
+ {
+ __set_errno (ENOSPC);
+ return -1;
+ }
s = c->size - c->pos - addnullc;
}
@@ -142,7 +146,7 @@ fmemopen_write (void *cookie, const char *b, size_t s)
int
-fmemopen_seek (void *cookie, _IO_off64_t * p, int w)
+fmemopen_seek (void *cookie, _IO_off64_t *p, int w)
{
_IO_off64_t np;
fmemopen_cookie_t *c;
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index c016cfb1d5..52e025b4c9 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -76,7 +76,8 @@ _IO_cookie_seek (fp, offset, dir)
return ((cfile->__io_functions.seek == NULL
|| (cfile->__io_functions.seek (cfile->__cookie, &offset, dir)
- == (_IO_off64_t) -1))
+ == -1)
+ || offset == (_IO_off64_t) -1)
? _IO_pos_BAD : offset);
}
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index ed2fe80e99..e420ad0bde 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,68 @@
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * locales/translit_hangul: New file.
+ * locales/ko_KR (LC_CTYPE): Include it.
+
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * locales/translit_cjk_variants: New file.
+ * locales/ja_JP (LC_CTYPE): Include it.
+
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * locales/da_DK (LC_CTYPE): Include translit_combining, add A-ring
+ transliteration rules.
+
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * locales/de_DE (LC_CTYPE): Include translit_combining, add umlaut
+ transliteration rules.
+ * locales/de_AT (LC_CTYPE): Include de_DE instead of i18n.
+ * locales/de_BE (LC_CTYPE): Likewise.
+ * locales/de_CH (LC_CTYPE): Likewise.
+ * locales/de_LU (LC_CTYPE): Likewise.
+ * locales/de_DE@euro (LC_CTYPE): Include de_DE instead of i18n.
+ * locales/de_AT@euro (LC_CTYPE): Include de_AT instead of i18n.
+ * locales/de_BE@euro (LC_CTYPE): Include de_BE instead of i18n.
+ * locales/de_LU@euro (LC_CTYPE): Include de_LU instead of i18n.
+
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * locales/translit_combining: New file.
+ * locales/fr_FR (LC_CTYPE): Include it.
+ * locales/fr_BE (LC_CTYPE): Include fr_FR instead of i18n.
+ * locales/fr_CA (LC_CTYPE): Likewise.
+ * locales/fr_CH (LC_CTYPE): Likewise.
+ * locales/fr_LU (LC_CTYPE): Likewise.
+ * locales/fr_FR@euro (LC_CTYPE): Include fr_FR instead of i18n.
+ * locales/fr_BE@euro (LC_CTYPE): Include fr_BE instead of i18n.
+ * locales/fr_LU@euro (LC_CTYPE): Include fr_LU instead of i18n.
+
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * locales/translit_wide: New file.
+ * locales/translit_narrow: New file.
+ * locales/translit_font: New file.
+ * locales/translit_circle: New file.
+ * locales/translit_small: New file.
+ * locales/translit_fraction: New file.
+ * locales/translit_compat: New file.
+ * locales/translit_cjk_compat: New file.
+ * locales/translit_neutral: New file. Include all of the above.
+ * locales/i18n (LC_CTYPE): Include translit_neutral. Remove a few
+ German and Danish specific rules.
+
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * locales/ja_JP (LC_CTYPE): Refer to "i18n" instead of duplicating it.
+ * locales/zh_CN (LC_CTYPE): Likewise.
+ * locales/ko_KR (LC_CTYPE): Likewise.
+
+2000-10-29 Bruno Haible <haible@clisp.cons.org>
+
+ * charmaps/UTF-8: Set width of U200B to 0.
+ * charmaps/GB18030: Likewise.
+
2000-10-29 Ulrich Drepper <drepper@redhat.com>
* charmaps/BIG5: Update.
diff --git a/stdio-common/tst-fmemopen.c b/stdio-common/tst-fmemopen.c
new file mode 100644
index 0000000000..f22ebd52fe
--- /dev/null
+++ b/stdio-common/tst-fmemopen.c
@@ -0,0 +1,111 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#define TEST_FILE "test-1"
+
+int
+main (void)
+{
+ const char blah[] = "BLAH";
+ FILE *fp;
+ char *mmap_data;
+ int ch, fd;
+ struct stat fs;
+ const char *cp;
+
+ /* setup the physical file, and use it */
+ if ((fp = fopen (TEST_FILE, "w+")) == NULL)
+ exit (1);
+ if (fwrite (blah, 1, strlen (blah), fp) != strlen (blah))
+ exit (2);
+
+ rewind (fp);
+ printf ("file: ");
+ cp = blah;
+ while ((ch = getc (fp)) != EOF)
+ {
+ fputc (ch, stdout);
+ if (ch != *cp)
+ {
+ printf ("\ncharacter %d: '%c' instead of '%c'\n",
+ cp - blah, ch, *cp);
+ exit (1);
+ }
+ ++cp;
+ }
+ fputc ('\n', stdout);
+ if (ferror (fp))
+ {
+ puts ("fp: error");
+ exit (1);
+ }
+ if (feof (fp))
+ printf ("fp: EOF\n");
+ else
+ {
+ puts ("not EOF");
+ exit (1);
+ }
+ fclose (fp);
+
+ /* Now, mmap the file into a buffer, and do that too */
+ if ((fd = open (TEST_FILE, O_RDONLY)) == -1)
+ exit (3);
+ if (fstat (fd, &fs) == -1)
+ exit (4);
+
+ if ((mmap_data = (char *) mmap (NULL, fs.st_size, PROT_READ,
+ MAP_SHARED, fd, 0)) == NULL)
+ {
+ if (errno == ENOSYS)
+ exit (0);
+ exit (5);
+ }
+
+ if ((fp = fmemopen (mmap_data, fs.st_size, "r")) == NULL)
+ exit (1);
+
+ printf ("mem: ");
+ cp = blah;
+ while ((ch = getc (fp)) != EOF)
+ {
+ fputc (ch, stdout);
+ if (ch != *cp)
+ {
+ printf ("%d character: '%c' instead of '%c'\n",
+ cp - blah, ch, *cp);
+ exit (1);
+ }
+ ++cp;
+ }
+
+ fputc ('\n', stdout);
+
+ if (ferror (fp))
+ {
+ puts ("fp: error");
+ exit (1);
+ }
+ if (feof (fp))
+ printf ("fp: EOF\n");
+ else
+ {
+ puts ("not EOF");
+ exit (1);
+ }
+
+ fclose (fp);
+
+ munmap (mmap_data, fs.st_size);
+
+ unlink (TEST_FILE);
+
+ return 0;
+}