1 /* gdb_file.c -o/s specific-
2 Copyright (C) 1987 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #include <sys/types.h>
26 extern long get_len();
39 long int /* Open file, return size. 0: failed. */
40 gdb_file_size (filename
)
46 file
= fopen (filename
, "r");
47 if (file
== (FILE *)NULL
)
49 as_perror ("Can't read GDB symbolic information file", filename
);
52 (void)fstat (fileno(file
), &stat_buf
);
53 file_len
=stat_buf
. st_size
;
55 return ((long int)file_len
);
58 void /* Read the file, don't return if failed. */
59 gdb_file_read (buffer
, filename
)
63 register off_t size_wanted
;
66 size_wanted
= file_len
;
67 if (fread (buffer
, size_wanted
, 1, file
) != 1)
69 as_perror ("Can't read GDB symbolic info file", filename
);
70 as_fatal ("Failed to read %ld. chars of GDB symbolic information",
73 if (fclose(file
)==EOF
)
75 as_perror ("Can't close GDB symbolic info file", filename
);
76 as_fatal ("I quit in disgust");
This page took 0.03552 seconds and 4 git commands to generate.