X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Finput-file.c;h=339c4dafa9b5442424723f1f6446957dc90cc732;hb=f0e652b4aa5420d23e7e7eef1146cb16daef13f3;hp=c63f7c9b63b2d35ec061a641645109e75fc4a318;hpb=252b5132c753830d5fd56823373aed85f2a0db63;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/input-file.c b/gas/input-file.c index c63f7c9b63..339c4dafa9 100644 --- a/gas/input-file.c +++ b/gas/input-file.c @@ -1,5 +1,6 @@ /* input_file.c - Deal with Input Files - - Copyright (C) 1987, 1990, 1991, 1992, 1998 Free Software Foundation, Inc. + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 98, 1999 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* * Confines all details of reading source bytes to this module. @@ -30,7 +32,7 @@ #include "as.h" #include "input-file.h" -static int input_file_get PARAMS ((char **)); +static int input_file_get PARAMS ((char *, int)); /* This variable is non-zero if the file currently being read should be preprocessed by app. It is zero if the file can be read straight in. @@ -63,27 +65,27 @@ struct saved_file char *app_save; }; -/* These hooks accomodate most operating systems. */ +/* These hooks accomodate most operating systems. */ -void +void input_file_begin () { f_in = (FILE *) 0; } -void +void input_file_end () { } -/* Return BUFFER_SIZE. */ -unsigned int +/* Return BUFFER_SIZE. */ +unsigned int input_file_buffer_size () { return (BUFFER_SIZE); } -int +int input_file_is_open () { return f_in != (FILE *) 0; @@ -128,7 +130,7 @@ input_file_pop (arg) void input_file_open (filename, pre) - char *filename; /* "" means use stdin. Must not be 0. */ + char *filename; /* "" means use stdin. Must not be 0. */ int pre; { int c; @@ -136,16 +138,16 @@ input_file_open (filename, pre) preprocess = pre; - assert (filename != 0); /* Filename may not be NULL. */ + assert (filename != 0); /* Filename may not be NULL. */ if (filename[0]) - { /* We have a file name. Suck it and see. */ + { /* We have a file name. Suck it and see. */ f_in = fopen (filename, "r"); file_name = filename; } else - { /* use stdin for the input file. */ + { /* use stdin for the input file. */ f_in = stdin; - file_name = _("{standard input}"); /* For error messages. */ + file_name = _("{standard input}"); /* For error messages. */ } if (f_in == (FILE *) 0) { @@ -178,7 +180,7 @@ input_file_open (filename, pre) } /* Close input file. */ -void +void input_file_close () { if (f_in != NULL) @@ -191,19 +193,18 @@ input_file_close () /* This function is passed to do_scrub_chars. */ static int -input_file_get (from) - char **from; +input_file_get (buf, buflen) + char *buf; + int buflen; { - static char buf[BUFFER_SIZE]; int size; - size = fread (buf, sizeof (char), sizeof buf, f_in); + size = fread (buf, sizeof (char), buflen, f_in); if (size < 0) { as_perror (_("Can't read from %s"), file_name); size = 0; } - *from = buf; return size; } @@ -211,9 +212,9 @@ input_file_get (from) char * input_file_give_next_buffer (where) - char *where; /* Where to place 1st character of new buffer. */ + char *where; /* Where to place 1st character of new buffer. */ { - char *return_value; /* -> Last char of what we read, + 1. */ + char *return_value; /* -> Last char of what we read, + 1. */ register int size; if (f_in == (FILE *) 0)