z8kgen: temp file to generate z8k-opc.h from
[external/binutils.git] / bfd / misc.c
1 /* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
2
3 This file is part of BFD, the Binary File Diddler.
4
5 BFD is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 1, or (at your option)
8 any later version.
9
10 BFD is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with BFD; see the file COPYING.  If not, write to
17 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
18
19 /* $Id$ */
20
21 #if 0
22  /* xoxorich.  coelesced from other binutils. */
23 /* This crap should all be bundled with the binutils, or else be in its
24    own library, but for expediency we are doing it this way right now. */
25
26 /*
27  * Last Mod Mon Feb 18 14:49:39 PST 1991, by rich@cygint.cygnus.com
28  */
29
30 #include <stdio.h>
31 #include "misc.h"
32 #if __STDC__
33 extern char *realloc (char * ptr, int size);
34 extern char *malloc (int size);
35 #else
36 extern char *realloc ();
37 extern char *malloc ();
38 #endif
39
40 /* Print the filename of the current file on 'outfile' (a stdio stream).  */
41
42 /* Current file's name */
43
44 char *input_name;
45
46 /* Current member's name, or 0 if processing a non-library file.  */
47
48 char *input_member;
49
50 void print_file_name (outfile)
51      FILE *outfile;
52 {
53   fprintf (outfile, "%s", input_name);
54   if (input_member)
55     fprintf (outfile, "(%s)", input_member);
56 }
57 \f
58 /* process one input file */
59 void scan_library ();
60
61 char *program_name;
62
63 /* Report a nonfatal error.
64    STRING is a format for printf, and ARG1 ... ARG3 are args for it.  */
65 /*VARARGS*/
66 void
67 error (string, arg1, arg2, arg3)
68      char *string, *arg1, *arg2, *arg3;
69 {
70   fprintf (stderr, "%s: ", program_name);
71   fprintf (stderr, string, arg1, arg2, arg3);
72   fprintf (stderr, "\n");
73 }
74
75
76
77 /* Report a nonfatal error.
78    STRING is printed, followed by the current file name.  */
79
80 void
81 error_with_file (string)
82      char *string;
83 {
84   fprintf (stderr, "%s: ", program_name);
85   print_file_name (stderr);
86   fprintf (stderr, ": ");
87   fprintf (stderr, string);
88   fprintf (stderr, "\n");
89 }
90
91 /* Like malloc but get fatal error if memory is exhausted.  */
92
93
94 /* Like realloc but get fatal error if memory is exhausted.  */
95
96
97 /* end of misc.c */
98 #endif