diff options
Diffstat (limited to 'libgfortran/runtime/stop.c')
-rw-r--r-- | libgfortran/runtime/stop.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libgfortran/runtime/stop.c b/libgfortran/runtime/stop.c index 29f5031..b6f61ff 100644 --- a/libgfortran/runtime/stop.c +++ b/libgfortran/runtime/stop.c @@ -1,8 +1,8 @@ /* Implementation of the STOP statement. - Copyright 2002, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright 2002, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> -This file is part of the GNU Fortran 95 runtime library (libgfortran). +This file is part of the GNU Fortran runtime library (libgfortran). Libgfortran is free software; you can redistribute it and/or modify it under the terms of the GNU General Public @@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <string.h> +#include <unistd.h> /* A numeric STOP statement. */ @@ -65,10 +66,10 @@ stop_string (const char *string, GFC_INTEGER_4 len) { if (string) { - st_printf ("STOP "); - while (len--) - st_printf ("%c", *(string++)); - st_printf ("\n"); + estr_write ("STOP "); + ssize_t w = write (STDERR_FILENO, string, len); + (void) sizeof (w); /* Avoid compiler warning about not using w. */ + estr_write ("\n"); } sys_exit (0); } @@ -86,10 +87,10 @@ export_proto(error_stop_string); void error_stop_string (const char *string, GFC_INTEGER_4 len) { - st_printf ("ERROR STOP "); - while (len--) - st_printf ("%c", *(string++)); - st_printf ("\n"); + estr_write ("ERROR STOP "); + ssize_t w = write (STDERR_FILENO, string, len); + (void) sizeof (w); /* Avoid compiler warning about not using w. */ + estr_write ("\n"); sys_exit (1); } |