diff options
| author | cvs2svn <admin@example.com> | 2025-08-02 06:16:35 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2025-08-02 06:16:35 +0000 |
| commit | a397c95f8aea58533e72379d6e0de12683ecd0dc (patch) | |
| tree | 45ccaccd0ce2ea01650f0a9f5e9268a656e17e51 /src/regress/lib/libc/stdio/test___freadahead.c | |
| parent | a79e90e7342954ae2287db505811ca3c1cd336d7 (diff) | |
| download | openbsd-tb_20250802.tar.gz openbsd-tb_20250802.tar.bz2 openbsd-tb_20250802.zip | |
This commit was manufactured by cvs2git to create tag 'tb_20250802'.tb_20250802
Diffstat (limited to 'src/regress/lib/libc/stdio/test___freadahead.c')
| -rw-r--r-- | src/regress/lib/libc/stdio/test___freadahead.c | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/regress/lib/libc/stdio/test___freadahead.c b/src/regress/lib/libc/stdio/test___freadahead.c deleted file mode 100644 index 66d5e3492a..0000000000 --- a/src/regress/lib/libc/stdio/test___freadahead.c +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | /* $OpenBSD: test___freadahead.c,v 1.2 2025/06/03 14:35:27 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <errno.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <stdio_ext.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | |||
| 25 | /* we use assert() */ | ||
| 26 | #undef NDEBUG | ||
| 27 | |||
| 28 | #define TMPFILENAME "test___freadahead.tmp" | ||
| 29 | |||
| 30 | void test___freadahead0(void); | ||
| 31 | |||
| 32 | void | ||
| 33 | test___freadahead0(void) | ||
| 34 | { | ||
| 35 | FILE *fp; | ||
| 36 | int r; | ||
| 37 | size_t s; | ||
| 38 | |||
| 39 | fp = fopen(TMPFILENAME, "w"); | ||
| 40 | assert(fp != NULL); | ||
| 41 | r = fputs("Hello world", fp); | ||
| 42 | assert(r >= 0); | ||
| 43 | r = fclose(fp); | ||
| 44 | |||
| 45 | fp = fopen(TMPFILENAME, "r"); | ||
| 46 | s = __freadahead(fp); | ||
| 47 | assert(s == 0); | ||
| 48 | assert(fgetc(fp) == 'H'); | ||
| 49 | s = __freadahead(fp); | ||
| 50 | assert(s == 10); | ||
| 51 | r = fflush(fp); | ||
| 52 | #if 0 | ||
| 53 | /* fflush() to reading file is not supported (yet) */ | ||
| 54 | assert(errno == EBADF); | ||
| 55 | #else | ||
| 56 | assert(r == 0); | ||
| 57 | s = __freadahead(fp); | ||
| 58 | assert(s == 0); | ||
| 59 | #endif | ||
| 60 | |||
| 61 | r = fclose(fp); | ||
| 62 | assert(r == 0); | ||
| 63 | } | ||
| 64 | |||
| 65 | int | ||
| 66 | main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | test___freadahead0(); | ||
| 69 | |||
| 70 | exit(0); | ||
| 71 | } | ||
