diff options
-rw-r--r-- | a.out.h | 1 | ||||
-rw-r--r-- | assert.h | 1 | ||||
-rw-r--r-- | ctype.h | 1 | ||||
-rw-r--r-- | dirent.h | 1 | ||||
-rw-r--r-- | fnmatch.h | 1 | ||||
-rw-r--r-- | glob.h | 1 | ||||
-rw-r--r-- | gnu/signal.h | 1 | ||||
-rw-r--r-- | gnu/time.h | 1 | ||||
-rw-r--r-- | gnu/types.h | 1 | ||||
-rw-r--r-- | gnu/wait.h | 1 | ||||
-rw-r--r-- | grp.h | 1 | ||||
-rw-r--r-- | locale.h | 1 | ||||
-rw-r--r-- | localeinfo.h | 1 | ||||
-rw-r--r-- | malloc.h | 1 | ||||
-rw-r--r-- | math.h | 1 | ||||
-rw-r--r-- | memory.h | 1 | ||||
-rw-r--r-- | nlist.h | 1 | ||||
-rw-r--r-- | printf.h | 1 | ||||
-rw-r--r-- | pwd.h | 1 | ||||
-rw-r--r-- | setjmp.h | 1 | ||||
-rw-r--r-- | sgtty.h | 1 | ||||
-rw-r--r-- | signal.h | 1 | ||||
-rw-r--r-- | stdio.h | 1 | ||||
-rw-r--r-- | stdio/fseek.c | 162 | ||||
-rw-r--r-- | stdlib.h | 1 | ||||
-rw-r--r-- | string.h | 1 | ||||
-rw-r--r-- | strings.h | 1 | ||||
-rw-r--r-- | sys/dir.h | 1 | ||||
-rw-r--r-- | sys/file.h | 1 | ||||
-rw-r--r-- | sys/ioctl.h | 1 | ||||
-rw-r--r-- | sys/ptrace.h | 1 | ||||
-rw-r--r-- | sys/resource.h | 1 | ||||
-rw-r--r-- | sys/signal.h | 1 | ||||
-rw-r--r-- | sys/socket.h | 1 | ||||
-rw-r--r-- | sys/time.h | 1 | ||||
-rw-r--r-- | sys/times.h | 1 | ||||
-rw-r--r-- | sys/types.h | 1 | ||||
-rw-r--r-- | sys/uio.h | 1 | ||||
-rw-r--r-- | sys/utsname.h | 1 | ||||
-rw-r--r-- | sys/vlimit.h | 1 | ||||
-rw-r--r-- | sys/vtimes.h | 1 | ||||
-rw-r--r-- | sys/wait.h | 1 | ||||
-rw-r--r-- | termios.h | 1 | ||||
-rw-r--r-- | time.h | 1 | ||||
-rw-r--r-- | unistd.h | 1 | ||||
-rw-r--r-- | utime.h | 1 | ||||
-rw-r--r-- | wordexp.h | 1 |
47 files changed, 208 insertions, 0 deletions
diff --git a/a.out.h b/a.out.h new file mode 100644 index 0000000000..9582d72ba0 --- /dev/null +++ b/a.out.h @@ -0,0 +1 @@ +#include <misc/a.out.h> diff --git a/assert.h b/assert.h new file mode 100644 index 0000000000..e2fa7020c1 --- /dev/null +++ b/assert.h @@ -0,0 +1 @@ +#include <assert/assert.h> diff --git a/ctype.h b/ctype.h new file mode 100644 index 0000000000..7b51e1f5eb --- /dev/null +++ b/ctype.h @@ -0,0 +1 @@ +#include <ctype/ctype.h> diff --git a/dirent.h b/dirent.h new file mode 100644 index 0000000000..f59a6b778b --- /dev/null +++ b/dirent.h @@ -0,0 +1 @@ +#include <dirent/dirent.h> diff --git a/fnmatch.h b/fnmatch.h new file mode 100644 index 0000000000..b12b786df0 --- /dev/null +++ b/fnmatch.h @@ -0,0 +1 @@ +#include <posix/fnmatch.h> diff --git a/glob.h b/glob.h new file mode 100644 index 0000000000..ce047bb177 --- /dev/null +++ b/glob.h @@ -0,0 +1 @@ +#include <posix/glob.h> diff --git a/gnu/signal.h b/gnu/signal.h new file mode 100644 index 0000000000..3c1dfa2baf --- /dev/null +++ b/gnu/signal.h @@ -0,0 +1 @@ +#include <signal/gnu/signal.h> diff --git a/gnu/time.h b/gnu/time.h new file mode 100644 index 0000000000..9f90588546 --- /dev/null +++ b/gnu/time.h @@ -0,0 +1 @@ +#include <time/gnu/time.h> diff --git a/gnu/types.h b/gnu/types.h new file mode 100644 index 0000000000..0d1fb31d06 --- /dev/null +++ b/gnu/types.h @@ -0,0 +1 @@ +#include <posix/gnu/types.h> diff --git a/gnu/wait.h b/gnu/wait.h new file mode 100644 index 0000000000..a47b5e8754 --- /dev/null +++ b/gnu/wait.h @@ -0,0 +1 @@ +#include <posix/gnu/wait.h> @@ -0,0 +1 @@ +#include <grp/grp.h> diff --git a/locale.h b/locale.h new file mode 100644 index 0000000000..6e0bd916dc --- /dev/null +++ b/locale.h @@ -0,0 +1 @@ +#include <locale/locale.h> diff --git a/localeinfo.h b/localeinfo.h new file mode 100644 index 0000000000..7b0f3e0639 --- /dev/null +++ b/localeinfo.h @@ -0,0 +1 @@ +#include <locale/localeinfo.h> diff --git a/malloc.h b/malloc.h new file mode 100644 index 0000000000..448e0a8c6b --- /dev/null +++ b/malloc.h @@ -0,0 +1 @@ +#include <malloc/malloc.h> diff --git a/math.h b/math.h new file mode 100644 index 0000000000..f837293f81 --- /dev/null +++ b/math.h @@ -0,0 +1 @@ +#include <math/math.h> diff --git a/memory.h b/memory.h new file mode 100644 index 0000000000..1ec3e63fc9 --- /dev/null +++ b/memory.h @@ -0,0 +1 @@ +#include <string/memory.h> diff --git a/nlist.h b/nlist.h new file mode 100644 index 0000000000..897a93c7fe --- /dev/null +++ b/nlist.h @@ -0,0 +1 @@ +#include <misc/nlist.h> diff --git a/printf.h b/printf.h new file mode 100644 index 0000000000..8996ff4b17 --- /dev/null +++ b/printf.h @@ -0,0 +1 @@ +#include <stdio/printf.h> @@ -0,0 +1 @@ +#include <pwd/pwd.h> diff --git a/setjmp.h b/setjmp.h new file mode 100644 index 0000000000..c78a964566 --- /dev/null +++ b/setjmp.h @@ -0,0 +1 @@ +#include <setjmp/setjmp.h> diff --git a/sgtty.h b/sgtty.h new file mode 100644 index 0000000000..ffb62401cb --- /dev/null +++ b/sgtty.h @@ -0,0 +1 @@ +#include <misc/sgtty.h> diff --git a/signal.h b/signal.h new file mode 100644 index 0000000000..d9939c4e83 --- /dev/null +++ b/signal.h @@ -0,0 +1 @@ +#include <signal/signal.h> diff --git a/stdio.h b/stdio.h new file mode 100644 index 0000000000..a82be070c3 --- /dev/null +++ b/stdio.h @@ -0,0 +1 @@ +#include <stdio/stdio.h> diff --git a/stdio/fseek.c b/stdio/fseek.c new file mode 100644 index 0000000000..ba956e47ed --- /dev/null +++ b/stdio/fseek.c @@ -0,0 +1,162 @@ +/* Copyright (C) 1991 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <stdio.h> + + +/* Move the file position of STREAM to OFFSET + bytes from the beginning of the file if WHENCE + is SEEK_SET, the end of the file is it is SEEK_END, + or the current position if it is SEEK_CUR. */ +int +DEFUN(fseek, (stream, offset, whence), + register FILE *stream AND long int offset AND int whence) +{ + extern int EXFUN(__stdio_check_offset, (FILE *)); + long int o; + + if (!__validfp(stream)) + { + errno = EINVAL; + return EOF; + } + + stream->__eof = 0; + + if (stream->__put_limit > stream->__buffer) + { + /* Write out the pending data. */ + if (__flshfp(stream, EOF) == EOF) + return EOF; + } + + /* Make sure we know the current offset info. */ + if (__stdio_check_offset(stream) == EOF) + return EOF; + + /* Check the WHENCE argument for validity, and process OFFSET + into an absolute position in O. By the end of this switch, + either we have returned, or O contains an absolute position. */ + o = offset; + switch (whence) + { + default: + errno = EINVAL; + return EOF; + + case SEEK_END: + /* We don't know where the end of the file is, + so seek to the position in the file the user asked + for, and then look where that is. */ + if (stream->__io_funcs.__seek == NULL) + { + errno = ESPIPE; + return EOF; + } + else + { + fpos_t pos = (fpos_t) o; + if ((*stream->__io_funcs.__seek)(stream->__cookie, &pos, + SEEK_END) < 0) + { + if (errno == ESPIPE) + stream->__io_funcs.__seek = NULL; + return EOF; + } + stream->__offset = pos; + /* Make O be absolute, rather than + relative to the end of the file. */ + o += pos; + } + + /* Fall through to try an absolute seek. */ + + case SEEK_SET: + /* Make O be relative to the buffer. */ + o -= stream->__target; + /* Make O be relative to the current position in the buffer. */ + o -= stream->__bufp - stream->__buffer; + + /* Fall through to see if we can do it by + moving the pointer around in the buffer. */ + + case SEEK_CUR: + /* If the offset is small enough, we can just + move the pointer around in the buffer. */ + +#if 0 /* Why did I think this would ever work??? */ + if (stream->__put_limit > stream->__buffer) + { + /* We are writing. */ + if (stream->__bufp + o >= stream->__buffer && + stream->__put_limit > stream->__bufp + o && + stream->__get_limit > stream->__bufp + o) + { + /* We have read all the data we will change soon. + We can just move the pointer around. */ + stream->__bufp += o; + return 0; + } + else + { + /* Flush the buffer. */ + if (__flshfp(stream, EOF) == EOF) + return EOF; + } + } else +#endif + if (o < 0 ? + (-o <= stream->__bufp - stream->__buffer) : + o < stream->__get_limit - stream->__bufp) + { + stream->__bufp += o; + return 0; + } + + /* Turn it into an absolute seek. */ + o += stream->__bufp - stream->__buffer; + o += stream->__target; + break; + } + + /* O is now an absolute position, the new target. */ + stream->__target = o; + + /* Set bufp and both end pointers to the beginning of the buffer. + The next i/o will force a call to the input/output room function. */ + stream->__bufp + = stream->__get_limit = stream->__put_limit = stream->__buffer; + + /* If there is no seek function, seeks always fail. */ + if (stream->__io_funcs.__seek == NULL) + { + /* This is preemptive, since we don't actually do the seeking. + But it makes more sense for fseek to to fail with ESPIPE + than for the next reading or writing operation to fail + that way. */ + errno = ESPIPE; + return EOF; + } + + /* Don't actually seek. The next reading or writing operation + will force a call to the input or output room function, + which will move to the target file position before reading or writing. */ + return 0; +} diff --git a/stdlib.h b/stdlib.h new file mode 100644 index 0000000000..c0887a99e9 --- /dev/null +++ b/stdlib.h @@ -0,0 +1 @@ +#include <stdlib/stdlib.h> diff --git a/string.h b/string.h new file mode 100644 index 0000000000..b557c65f39 --- /dev/null +++ b/string.h @@ -0,0 +1 @@ +#include <string/string.h> diff --git a/strings.h b/strings.h new file mode 100644 index 0000000000..b1bb339d3d --- /dev/null +++ b/strings.h @@ -0,0 +1 @@ +#include <string/strings.h> diff --git a/sys/dir.h b/sys/dir.h new file mode 100644 index 0000000000..5453e743fc --- /dev/null +++ b/sys/dir.h @@ -0,0 +1 @@ +#include <misc/sys/dir.h> diff --git a/sys/file.h b/sys/file.h new file mode 100644 index 0000000000..fb3cd7544e --- /dev/null +++ b/sys/file.h @@ -0,0 +1 @@ +#include <misc/sys/file.h> diff --git a/sys/ioctl.h b/sys/ioctl.h new file mode 100644 index 0000000000..8cc77757f6 --- /dev/null +++ b/sys/ioctl.h @@ -0,0 +1 @@ +#include <misc/sys/ioctl.h> diff --git a/sys/ptrace.h b/sys/ptrace.h new file mode 100644 index 0000000000..f099a4e912 --- /dev/null +++ b/sys/ptrace.h @@ -0,0 +1 @@ +#include <misc/sys/ptrace.h> diff --git a/sys/resource.h b/sys/resource.h new file mode 100644 index 0000000000..33e6f4de9e --- /dev/null +++ b/sys/resource.h @@ -0,0 +1 @@ +#include <resource/sys/resource.h> diff --git a/sys/signal.h b/sys/signal.h new file mode 100644 index 0000000000..b2110df1ae --- /dev/null +++ b/sys/signal.h @@ -0,0 +1 @@ +#include <signal/sys/signal.h> diff --git a/sys/socket.h b/sys/socket.h new file mode 100644 index 0000000000..999a683016 --- /dev/null +++ b/sys/socket.h @@ -0,0 +1 @@ +#include <socket/sys/socket.h> diff --git a/sys/time.h b/sys/time.h new file mode 100644 index 0000000000..5595a957a0 --- /dev/null +++ b/sys/time.h @@ -0,0 +1 @@ +#include <time/sys/time.h> diff --git a/sys/times.h b/sys/times.h new file mode 100644 index 0000000000..16ca91138a --- /dev/null +++ b/sys/times.h @@ -0,0 +1 @@ +#include <posix/sys/times.h> diff --git a/sys/types.h b/sys/types.h new file mode 100644 index 0000000000..716732f4d4 --- /dev/null +++ b/sys/types.h @@ -0,0 +1 @@ +#include <posix/sys/types.h> diff --git a/sys/uio.h b/sys/uio.h new file mode 100644 index 0000000000..03afd84b87 --- /dev/null +++ b/sys/uio.h @@ -0,0 +1 @@ +#include <misc/sys/uio.h> diff --git a/sys/utsname.h b/sys/utsname.h new file mode 100644 index 0000000000..ff81bdf48e --- /dev/null +++ b/sys/utsname.h @@ -0,0 +1 @@ +#include <posix/sys/utsname.h> diff --git a/sys/vlimit.h b/sys/vlimit.h new file mode 100644 index 0000000000..8a76d2fd00 --- /dev/null +++ b/sys/vlimit.h @@ -0,0 +1 @@ +#include <resource/sys/vlimit.h> diff --git a/sys/vtimes.h b/sys/vtimes.h new file mode 100644 index 0000000000..dd666ca443 --- /dev/null +++ b/sys/vtimes.h @@ -0,0 +1 @@ +#include <resource/sys/vtimes.h> diff --git a/sys/wait.h b/sys/wait.h new file mode 100644 index 0000000000..379d5cc7a5 --- /dev/null +++ b/sys/wait.h @@ -0,0 +1 @@ +#include <posix/sys/wait.h> diff --git a/termios.h b/termios.h new file mode 100644 index 0000000000..3f754ac900 --- /dev/null +++ b/termios.h @@ -0,0 +1 @@ +#include <termios/termios.h> diff --git a/time.h b/time.h new file mode 100644 index 0000000000..b2a33bf5c3 --- /dev/null +++ b/time.h @@ -0,0 +1 @@ +#include <time/time.h> diff --git a/unistd.h b/unistd.h new file mode 100644 index 0000000000..77901d9846 --- /dev/null +++ b/unistd.h @@ -0,0 +1 @@ +#include <posix/unistd.h> diff --git a/utime.h b/utime.h new file mode 100644 index 0000000000..e9dfbeaaa2 --- /dev/null +++ b/utime.h @@ -0,0 +1 @@ +#include <posix/utime.h> diff --git a/wordexp.h b/wordexp.h new file mode 100644 index 0000000000..64e036e062 --- /dev/null +++ b/wordexp.h @@ -0,0 +1 @@ +#include <posix/wordexp.h> |