diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-20 08:22:38 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-20 08:22:38 +0000 |
commit | ccf4f3ae98386198926269817844b5bb67d3ebe4 (patch) | |
tree | 15db9a73406c618d2f18f1e9696a3f9549e5ace6 /libgfortran/io | |
parent | 79fb55a1f085a3c03a9168b97773ddd9a4ad054a (diff) | |
download | gcc-ccf4f3ae98386198926269817844b5bb67d3ebe4.tar.gz |
2011-05-20 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 173935 using svnmerge
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@173937 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/unix.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 4e4bc3b1ee5..c257766d653 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1353,61 +1353,6 @@ error_stream (void) } -/* st_vprintf()-- vprintf function for error output. To avoid buffer - overruns, we limit the length of the buffer to ST_VPRINTF_SIZE. 2k - is big enough to completely fill a 80x25 terminal, so it shuld be - OK. We use a direct write() because it is simpler and least likely - to be clobbered by memory corruption. Writing an error message - longer than that is an error. */ - -#define ST_VPRINTF_SIZE 2048 - -int -st_vprintf (const char *format, va_list ap) -{ - static char buffer[ST_VPRINTF_SIZE]; - int written; - int fd; - - fd = options.use_stderr ? STDERR_FILENO : STDOUT_FILENO; -#ifdef HAVE_VSNPRINTF - written = vsnprintf(buffer, ST_VPRINTF_SIZE, format, ap); -#else - written = vsprintf(buffer, format, ap); - - if (written >= ST_VPRINTF_SIZE-1) - { - /* The error message was longer than our buffer. Ouch. Because - we may have messed up things badly, report the error and - quit. */ -#define ERROR_MESSAGE "Internal error: buffer overrun in st_vprintf()\n" - write (fd, buffer, ST_VPRINTF_SIZE-1); - write (fd, ERROR_MESSAGE, strlen(ERROR_MESSAGE)); - sys_exit(2); -#undef ERROR_MESSAGE - - } -#endif - - written = write (fd, buffer, written); - return written; -} - -/* st_printf()-- printf() function for error output. This just calls - st_vprintf() to do the actual work. */ - -int -st_printf (const char *format, ...) -{ - int written; - va_list ap; - va_start (ap, format); - written = st_vprintf(format, ap); - va_end (ap); - return written; -} - - /* compare_file_filename()-- Given an open stream and a fortran string * that is a filename, figure out if the file is the same as the * filename. */ |