aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/tst-cookie.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /stdio-common/tst-cookie.c
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-zack/build-layout-experiment.tar
glibc-zack/build-layout-experiment.tar.gz
glibc-zack/build-layout-experiment.tar.bz2
glibc-zack/build-layout-experiment.zip
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'stdio-common/tst-cookie.c')
-rw-r--r--stdio-common/tst-cookie.c95
1 files changed, 0 insertions, 95 deletions
diff --git a/stdio-common/tst-cookie.c b/stdio-common/tst-cookie.c
deleted file mode 100644
index 030e684562..0000000000
--- a/stdio-common/tst-cookie.c
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-
-#define THE_COOKIE ((void *) 0xdeadbeeful)
-
-static int errors;
-
-
-static int cookieread_called;
-static ssize_t
-cookieread (void *cookie, char *buf, size_t count)
-{
- printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
- (unsigned long int) cookie);
- if (cookie != THE_COOKIE)
- ++errors;
- cookieread_called = 1;
- return 42;
-}
-
-
-static int cookiewrite_called;
-static ssize_t
-cookiewrite (void *cookie, const char *buf, size_t count)
-{
- printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
- (unsigned long int) cookie);
- if (cookie != THE_COOKIE)
- ++errors;
- cookiewrite_called = 1;
- return 43;
-}
-
-
-static int cookieseek_called;
-static int
-cookieseek (void *cookie, off64_t *offset, int whence)
-{
- printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
- (unsigned long int) cookie);
- if (cookie != THE_COOKIE)
- ++errors;
- cookieseek_called = 1;
- return 44;
-}
-
-
-static int cookieclose_called;
-static int
-cookieclose (void *cookie)
-{
- printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
- (unsigned long int) cookie);
- if (cookie != THE_COOKIE)
- ++errors;
- cookieclose_called = 1;
- return 45;
-}
-
-
-static int
-do_test (void)
-{
- cookie_io_functions_t fcts;
- char buf[1];
- FILE *f;
-
- fcts.read = cookieread;
- fcts.seek = cookieseek;
- fcts.close = cookieclose;
- fcts.write = cookiewrite;
-
- f = fopencookie (THE_COOKIE, "r+", fcts);
-
- fread (buf, 1, 1, f);
- fwrite (buf, 1, 1, f);
- fseek (f, 0, SEEK_CUR);
- fclose (f);
-
- if (cookieread_called == 0
- || cookiewrite_called == 0
- || cookieseek_called == 0
- || cookieclose_called == 0)
- ++errors;
-
- return errors != 0;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"