From 5cbe225ddc4ab9adeb1ffa6d7140c7296ba8bac4 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 8 Feb 2019 13:56:25 +0100 Subject: [PATCH] mescc: Mes C Library: Support gcc-4.6.4: Implement rewind. * lib/stdio/rewind.c: Move from ../stub. Implement. * include/stdio.h (rewind): Declare. * lib/libc+gnu.c: Update include. * lib/libg.c: Update include. * lib/stub/rewind.c: Remove. --- build-aux/configure-lib.sh | 1 + include/stdio.h | 1 + lib/{stub => stdio}/rewind.c | 16 +++++----------- 3 files changed, 7 insertions(+), 11 deletions(-) rename lib/{stub => stdio}/rewind.c (75%) diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 81057ab5..e84d8faf 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -249,6 +249,7 @@ lib/stdio/fileno.c lib/stdio/freopen.c lib/stdio/fscanf.c lib/stdio/perror.c +lib/stdio/rewind.c lib/stdio/vfscanf.c lib/stdlib/__exit.c lib/stdlib/abort.c diff --git a/include/stdio.h b/include/stdio.h index c8684e0f..e3417af2 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -79,6 +79,7 @@ int putc (int c, FILE * stream); int putchar (int c); int puts (char const *s); int remove (char const *file_name); +void rewind (FILE * stream); int setvbuf (FILE * stream, char *buf, int mode, size_t size); int snprintf (char *str, size_t size, char const *format, ...); int sprintf (char *str, char const *format, ...); diff --git a/lib/stub/rewind.c b/lib/stdio/rewind.c similarity index 75% rename from lib/stub/rewind.c rename to lib/stdio/rewind.c index db4000fd..4b00e007 100644 --- a/lib/stub/rewind.c +++ b/lib/stdio/rewind.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -18,16 +18,10 @@ * along with GNU Mes. If not, see . */ -#include -#include +#include -int -rewind (int x) +void +rewind (FILE * stream) { - static int stub = 0; - if (__mes_debug () && !stub) - eputs ("rewind stub\n"); - stub = 1; - errno = 0; - return 0; + fseek (stream, 0, SEEK_SET); }