+2002-01-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * addr2line.c (usage): Update text to provide verbose
+ description of the command line options.
+ * ar.c (usage): Update text to provide verbose
+ description of the command line options.
+ (main): Accept -h and -H when running as ranlib.
+ * coffdump.c (show_usage): Update text to provide verbose
+ description of the command line options.
+ * dlltool.c (main): Accept -H as an alias for --help.
+ * nlmconv.c (show_usage): Update text to provide verbose
+ description of the command line options.
+ * nm.c (usage): Replace OPTIONS with option(s).
+ (main): Accept -H as an alias for --help.
+ * objcopy.c (strip_main): Accept -H as an alias for --help.
+ * objdump.c (main): Accept -v as an alias for --verbose.
+ * readelf.c (usage): Adjust format to match style used in
+ other binutils.
+ * size.c (usage): Update text to provide verbose description
+ of the command line options.
+ (main): Accept -v, -h and -H as command line options.
+ * srconv.c (show_usage): Update text to provide verbose
+ description of the command line options.
+ * strings.c (main): Accept -H and -v as command line options.
+ (usage): Update text to provide verbose description of the
+ command line options.
+ * sysdump.c (show_usage): Update text to provide verbose
+ description of the command line options.
+ * windres.c (usage): Adjust format to match style used in
+ other binutils.
+
+ * coffdump.c: Fix formatting.
+ * nlmconv.c: Fix formatting.
+ * srconv.c: Fix formatting.
+ * sysdump.c: Fix formatting.
+
2002-01-18 Andreas Jaeger <aj@suse.de>
* version.c (print_version): Update year.
/* addr2line.c -- convert addresses to line number and function name
- Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.siemens.de>
This file is part of GNU Binutils.
FILE *stream;
int status;
{
- fprintf (stream, _("\
-Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\
- [-e executable] [--exe=executable] [--demangle[=style]]\n\
- [--basenames] [--functions] [addr addr ...]\n"),
- program_name);
+ fprintf (stream, _("Usage: %s [option(s)] [addr(s)]\n"), program_name);
+ fprintf (stream, _(" Convert addresses into line number/file name pairs.\n"));
+ fprintf (stream, _(" If no addresses are specified on the command line, they will be read from stdin\n"));
+ fprintf (stream, _(" The options are:\n\
+ -b --target=<bfdname> Set the binary file format\n\
+ -e --exe=<executable> Set the input file name (default is a.out)\n\
+ -s --basenames Strip directory names\n\
+ -f --functions Show function names\n\
+ -C --demangle[=style] Demangle function names\n\
+ -h --help Display this information\n\
+ -v --version Display the program's version\n\
+\n"));
+
list_supported_targets (program_name, stream);
if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
filename = NULL;
target = NULL;
- while ((c = getopt_long (argc, argv, "b:Ce:sfHV", long_options, (int *) 0))
+ while ((c = getopt_long (argc, argv, "b:Ce:sfHhVv", long_options, (int *) 0))
!= EOF)
{
switch (c)
{
case 0:
- break; /* we've been given a long option */
+ break; /* We've been given a long option. */
case 'b':
target = optarg;
break;
case 'f':
with_functions = true;
break;
+ case 'v':
case 'V':
print_version ("addr2line");
break;
+ case 'h':
case 'H':
usage (stdout, 0);
break;
/* ar.c - Archive modify and extract.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001
+ 2001, 2002
Free Software Foundation, Inc.
This file is part of GNU Binutils.
fprintf (s, _(" [-X32_64] - (ignored)\n"));
}
else
+ {
/* xgettext:c-format */
- fprintf (s, _("Usage: %s [-vV] archive\n"), program_name);
+ fprintf (s, _("Usage: %s [options] archive\n"), program_name);
+ fprintf (s, _(" Generate an index to speed access to archives\n"));
+ fprintf (s, _(" The options are:\n\
+ -h --help Print this help message\n\
+ -V --version Print version information\n"));
+ }
list_supported_targets (program_name, stderr);
{
boolean touch = false;
- if (argc < 2 || strcmp (argv[1], "--help") == 0)
+ if (argc < 2
+ || strcmp (argv[1], "--help") == 0
+ || strcmp (argv[1], "-h") == 0
+ || strcmp (argv[1], "-H") == 0)
usage (0);
if (strcmp (argv[1], "-V") == 0
|| strcmp (argv[1], "-v") == 0
/* Coff file dumper.
- Copyright 1994, 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
-This file is part of GNU Binutils.
+ This file is part of GNU Binutils.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at
+ your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Steve Chamberlain <sac@cygnus.com>
This module reads a type tree generated by coffgrok and prints
- it out so we can test the grokker.
-*/
+ it out so we can test the grokker. */
#include <bfd.h>
#include <getopt.h>
static void dump_coff_section PARAMS ((struct coff_section *));
extern void coff_dump PARAMS ((struct coff_ofile *));
static void show_usage PARAMS ((FILE *, int));
-static void show_help PARAMS ((void));
extern int main PARAMS ((int, char **));
static void
tab (x)
-int x;
+ int x;
{
static int indent;
int i;
}
}
-static void nl ()
+static void
+nl ()
{
atnl = 1;
}
{
int i;
int online = 0;
- tab(1);
- printf(_("#lines %d "),p->nlines);
+
+ tab (1);
+ printf (_("#lines %d "),p->nlines);
+
for (i = 0; i < p->nlines; i++)
{
- printf("(%d 0x%x)", p->lines[i], p->addresses[i]);
+ printf ("(%d 0x%x)", p->lines[i], p->addresses[i]);
+
online++;
+
if (online > 6)
{
- nl();
- tab(0);
+ nl ();
+ tab (0);
online = 0;
}
}
- nl();
- tab(-1);
+ nl ();
+ tab (-1);
}
static void
{
tab (1);
printf ("size %d ", p->size);
+
switch (p->type)
{
case coff_secdef_type:
printf ("section definition at %x size %x\n",
p->u.asecdef.address,
p->u.asecdef.size);
- nl();
+ nl ();
break;
case coff_pointer_type:
printf ("pointer to");
tab (-1);
}
-
void
dump_coff_symbol (p)
struct coff_symbol *p;
tab (1);
printf ("List of symbols");
nl ();
+
while (p)
{
tab (1);
dump_coff_scope (p)
struct coff_scope *p;
{
-if (p) {
- tab (1);
- printf ("List of blocks %lx ",(unsigned long) p);
-
- if (p->sec) {
- printf( " %s %x..%x", p->sec->name,p->offset, p->offset + p->size -1);
- }
- nl ();
- tab (0);
- printf ("*****************");
- nl ();
- while (p)
+ if (p)
{
- tab (0);
- printf ("vars %d", p->nvars);
+ tab (1);
+ printf ("List of blocks %lx ",(unsigned long) p);
+
+ if (p->sec)
+ printf( " %s %x..%x", p->sec->name,p->offset, p->offset + p->size -1);
+
nl ();
- dump_coff_symbol (p->vars_head);
- printf ("blocks");
+ tab (0);
+ printf ("*****************");
nl ();
- dump_coff_scope (p->list_head);
+
+ while (p)
+ {
+ tab (0);
+ printf ("vars %d", p->nvars);
+ nl ();
+ dump_coff_symbol (p->vars_head);
+ printf ("blocks");
+ nl ();
+ dump_coff_scope (p->list_head);
+ nl ();
+ p = p->next;
+ }
+
+ tab (0);
+ printf ("*****************");
nl ();
- p = p->next;
+ tab (-1);
}
-
- tab (0);
- printf ("*****************");
- nl ();
- tab (-1);
-}
}
static void
tab (1);
printf ("List of source files");
nl ();
+
while (p)
{
tab (0);
static void
dump_coff_section(ptr)
-struct coff_section *ptr;
+ struct coff_section *ptr;
{
int i;
- tab(1);
- printf("section %s %d %d address %x size %x number %d nrelocs %d",
- ptr->name, ptr->code, ptr->data, ptr->address,ptr->size, ptr->number, ptr->nrelocs);
- nl();
+
+ tab (1);
+ printf ("section %s %d %d address %x size %x number %d nrelocs %d",
+ ptr->name, ptr->code, ptr->data, ptr->address,ptr->size,
+ ptr->number, ptr->nrelocs);
+ nl ();
for (i = 0; i < ptr->nrelocs; i++)
{
- tab(0);
- printf("(%x %s %x)",
- ptr->relocs[i].offset,
- ptr->relocs[i].symbol->name,
- ptr->relocs[i].addend);
- nl();
+ tab (0);
+ printf ("(%x %s %x)",
+ ptr->relocs[i].offset,
+ ptr->relocs[i].symbol->name,
+ ptr->relocs[i].addend);
+ nl ();
}
- tab(-1);
+ tab (-1);
}
void
struct coff_ofile *ptr;
{
int i;
+
printf ("Coff dump");
nl ();
printf ("#souces %d", ptr->nsources);
nl ();
dump_coff_sfile (ptr->source_head);
+
for (i = 0; i < ptr->nsections; i++)
- dump_coff_section(ptr->sections + i);
+ dump_coff_section (ptr->sections + i);
}
-
-
char * program_name;
static void
FILE *file;
int status;
{
- fprintf (file, "Usage: %s [-hV] in-file\n", program_name);
- exit (status);
-}
+ fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name);
+ fprintf (file, _(" Print a human readable interpretation of a SYSROFF object file\n"));
+ fprintf (file, _(" The options are:\n\
+ -h --help Display this information\n\
+ -v --version Display the program's version\n\
+\n"));
-static void
-show_help ()
-{
- printf (_("%s: Print a human readable interpretation of a SYSROFF object file\n"),
- program_name);
- show_usage (stdout, 0);
-}
+ if (status == 0)
+ fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
+ exit (status);
+}
int
main (ac, av)
program_name = av[0];
xmalloc_set_program_name (program_name);
- while ((opt = getopt_long (ac, av, "hV", long_options,
+ while ((opt = getopt_long (ac, av, "HhVv", long_options,
(int *) NULL))
!= EOF)
{
switch (opt)
{
+ case 'H':
case 'h':
- show_help ();
- /*NOTREACHED*/
+ show_usage (stdout, 0);
+ break;
+ case 'v':
case 'V':
print_version ("coffdump");
exit (0);
- /*NOTREACHED*/
case 0:
break;
default:
show_usage (stderr, 1);
- /*NOTREACHED*/
+ break;
}
}
}
if (!input_file)
- {
- fatal (_("no input file specified"));
- }
+ fatal (_("no input file specified"));
+
abfd = bfd_openr (input_file, 0);
if (!abfd)
if (! bfd_check_format_matches (abfd, bfd_object, &matching))
{
bfd_nonfatal (input_file);
+
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
{
list_matching_formats (matching);
tree = coff_grok (abfd);
- coff_dump(tree);
- printf("\n");
+ coff_dump (tree);
+ printf ("\n");
+
return 0;
}
int status;
{
/* xgetext:c-format */
- fprintf (file, _("Usage %s <options> <object-files>\n"), program_name);
+ fprintf (file, _("Usage %s <option(s)> <object-file(s)>\n"), program_name);
/* xgetext:c-format */
fprintf (file, _(" -m --machine <machine> Create as DLL for <machine>. [default: %s]\n"), mname);
fprintf (file, _(" possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n"));
while ((c = getopt_long (ac, av,
#ifdef DLLTOOL_MCORE_ELF
- "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVhM:L:F:",
+ "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHhM:L:F:",
#else
- "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVh",
+ "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHh",
#endif
long_options, 0))
!= EOF)
case 'e':
exp_name = optarg;
break;
+ case 'H':
case 'h':
usage (stdout, 0);
break;
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils.
FILE *file;
int status;
{
- fprintf (file, _("Usage %s <options> <object-files>\n"), program_name);
+ fprintf (file, _("Usage %s <option(s)> <object-file(s)>\n"), program_name);
fprintf (file, _(" Generic options:\n"));
fprintf (file, _(" --quiet, -q Work quietly\n"));
fprintf (file, _(" --verbose, -v Verbose\n"));
/* nlmconv.c -- NLM conversion program
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
-This file is part of GNU Binutils.
+ This file is part of GNU Binutils.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Ian Lance Taylor <ian@cygnus.com>.
/* Local routines. */
-static void show_help PARAMS ((void));
static void show_usage PARAMS ((FILE *, int));
static const char *select_output_format PARAMS ((enum bfd_architecture,
unsigned long, boolean));
bfd_init ();
set_default_bfd_target ();
- while ((opt = getopt_long (argc, argv, "dhI:l:O:T:V", long_options,
+ while ((opt = getopt_long (argc, argv, "dHhI:l:O:T:Vv", long_options,
(int *) NULL))
!= EOF)
{
case 'd':
debug = 1;
break;
+ case 'H':
case 'h':
- show_help ();
- /*NOTREACHED*/
+ show_usage (stdout, 0);
+ break;
case 'I':
input_format = optarg;
break;
case 'T':
header_file = optarg;
break;
+ case 'v':
case 'V':
print_version ("nlmconv");
- /*NOTREACHED*/
+ break;
case 0:
break;
default:
show_usage (stderr, 1);
- /*NOTREACHED*/
+ break;
}
}
return 0;
}
\f
-/* Display a help message and exit. */
-
-static void
-show_help ()
-{
- printf (_("%s: Convert an object file into a NetWare Loadable Module\n"),
- program_name);
- show_usage (stdout, 0);
-}
/* Show a usage message and exit. */
FILE *file;
int status;
{
- fprintf (file, _("\
-Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n\
- [--input-target=bfdname] [--output-target=bfdname]\n\
- [--header-file=file] [--linker=linker] [--debug]\n\
- [--help] [--version]\n\
- [in-file [out-file]]\n"),
- program_name);
+ fprintf (file, _("Usage: %s [option(s)] [in-file [out-file]]\n"), program_name);
+ fprintf (file, _(" Convert an object file into a NetWare Loadable Module\n"));
+ fprintf (file, _(" The options are:\n\
+ -I --input-target=<bfdname> Set the input binary file format\n\
+ -O --output-target=<bfdname> Set the output binary file format\n\
+ -T --header-file=<file> Read <file> for NLM header information\n\
+ -l --linker=<linker> Use <linker> for any linking\n\
+ -d --debug Display on stderr the linker command line\n\
+ -h --help Display this information\n\
+ -v --version Display the program's version\n\
+"));
if (status == 0)
fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status);
FILE *stream;
int status;
{
- fprintf (stream, _("Usage: %s [OPTION]... [FILE]...\n"), program_name);
- fprintf (stream, _("List symbols from FILEs (a.out by default).\n"));
- fprintf (stream, _("\n\
+ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
+ fprintf (stream, _(" List symbols in [file(s)] (a.out by default).\n"));
+ fprintf (stream, _(" The options are:\n\
-a, --debug-syms Display debugger-only symbols\n\
-A, --print-file-name Print name of the input file before every symbol\n\
-B Same as --format=bsd\n\
-f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n\
`sysv' or `posix'. The default is `bsd'\n\
-g, --extern-only Display only external symbols\n\
- -h, --help Display this information\n\
-l, --line-numbers Use debugging information to find a filename and\n\
line number for each symbol\n\
-n, --numeric-sort Sort symbols numerically by address\n\
-t, --radix=RADIX Use RADIX for printing symbol values\n\
--target=BFDNAME Specify the target object format as BFDNAME\n\
-u, --undefined-only Display only undefined symbols\n\
- -V, --version Display this program's version number\n\
-X 32_64 (ignored)\n\
+ -h, --help Display this information\n\
+ -V, --version Display this program's version number\n\
\n"));
list_supported_targets (program_name, stream);
if (status == 0)
bfd_init ();
set_default_bfd_target ();
- while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvVX:",
+ while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrst:uvVvX:",
long_options, (int *) 0)) != EOF)
{
switch (c)
case 'g':
external_only = 1;
break;
+ case 'H':
case 'h':
usage (stdout, 0);
case 'l':
FILE *stream;
int exit_status;
{
- fprintf (stream, _("Usage: %s <options> in-file [out-file]\n"), program_name);
+ fprintf (stream, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name);
+ fprintf (stream, _(" Copies a binary file, possibly transforming it in the process\n"));
fprintf (stream, _(" The options are:\n"));
fprintf (stream, _("\
-I --input-target <bfdname> Assume input file is in format <bfdname>\n\
FILE *stream;
int exit_status;
{
- fprintf (stream, _("Usage: %s <options> in-file(s)\n"), program_name);
+ fprintf (stream, _("Usage: %s <option(s)> in-file(s)\n"), program_name);
+ fprintf (stream, _(" Removes symbols and sections from files\n"));
fprintf (stream, _(" The options are:\n"));
fprintf (stream, _("\
- -I --input-target <bfdname> Assume input file is in format <bfdname>\n\
- -O --output-target <bfdname> Create an output file in format <bfdname>\n\
- -F --target <bfdname> Set both input and output format to <bfdname>\n\
+ -I --input-target=<bfdname> Assume input file is in format <bfdname>\n\
+ -O --output-target=<bfdname> Create an output file in format <bfdname>\n\
+ -F --target=<bfdname> Set both input and output format to <bfdname>\n\
-p --preserve-dates Copy modified/access timestamps to the output\n\
- -R --remove-section <name> Remove section <name> from the output\n\
+ -R --remove-section=<name> Remove section <name> from the output\n\
-s --strip-all Remove all symbol and relocation information\n\
-g -S --strip-debug Remove all debugging symbols\n\
--strip-unneeded Remove all symbols not needed by relocations\n\
- -N --strip-symbol <name> Do not copy symbol <name>\n\
- -K --keep-symbol <name> Only copy symbol <name>\n\
+ -N --strip-symbol=<name> Do not copy symbol <name>\n\
+ -K --keep-symbol=<name> Only copy symbol <name>\n\
-x --discard-all Remove all non-global symbols\n\
-X --discard-locals Remove any compiler-generated symbols\n\
-v --verbose List all object files modified\n\
struct section_list *p;
char *output_file = NULL;
- while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpdgxXVv",
+ while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpdgxXHhVv",
strip_options, (int *) 0)) != EOF)
{
switch (c)
case 0:
/* We've been given a long option. */
break;
+ case 'H':
case 'h':
strip_usage (stdout, 0);
default:
struct section_list *p;
struct stat statbuf;
- while ((c = getopt_long (argc, argv, "b:B:i:I:j:K:N:s:O:d:F:L:G:R:SpgxXVvW:",
+ while ((c = getopt_long (argc, argv, "b:B:i:I:j:K:N:s:O:d:F:L:G:R:SpgxXHhVvW:",
copy_options, (int *) 0)) != EOF)
{
switch (c)
case 0:
break; /* we've been given a long option */
+ case 'H':
case 'h':
copy_usage (stdout, 0);
FILE *stream;
int status;
{
- fprintf (stream, _("Usage: %s OPTION... FILE...\n"), program_name);
- fprintf (stream, _("Display information from object FILE.\n"));
- fprintf (stream, _("\n At least one of the following switches must be given:\n"));
+ fprintf (stream, _("Usage: %s <option(s)> <file(s)>\n"), program_name);
+ fprintf (stream, _(" Display information from object <file(s)>.\n"));
+ fprintf (stream, _(" At least one of the following switches must be given:\n"));
fprintf (stream, _("\
-a, --archive-headers Display archive header information\n\
-f, --file-headers Display the contents of the overall file header\n\
-T, --dynamic-syms Display the contents of the dynamic symbol table\n\
-r, --reloc Display the relocation entries in the file\n\
-R, --dynamic-reloc Display the dynamic relocation entries in the file\n\
- -V, --version Display this program's version number\n\
+ -v, --version Display this program's version number\n\
-i, --info List object formats and architectures supported\n\
-H, --help Display this information\n\
"));
bfd_init ();
set_default_bfd_target ();
- while ((c = getopt_long (argc, argv, "pib:m:M:VCdDlfahHrRtTxsSj:wE:zgG",
+ while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSj:wE:zgG",
long_options, (int *) 0))
!= EOF)
{
switch (c)
{
case 0:
- break; /* we've been given a long option */
+ break; /* We've been given a long option. */
case 'm':
machine = optarg;
break;
if (optarg != NULL)
{
enum demangling_styles style;
-
+
style = cplus_demangle_name_to_style (optarg);
if (style == unknown_demangling)
fatal (_("unknown demangling style `%s'"),
optarg);
-
+
cplus_demangle_set_style (style);
}
break;
usage (stderr, 1);
}
break;
-
+
case 'f':
dump_file_header = true;
seenflag = true;
case 'H':
usage (stdout, 0);
seenflag = true;
+ case 'v':
case 'V':
show_version = true;
seenflag = true;
static void
usage ()
{
- fprintf (stdout, _("Usage: readelf {options} elf-file(s)\n"));
- fprintf (stdout, _(" Options are:\n"));
- fprintf (stdout, _(" -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n"));
- fprintf (stdout, _(" -h or --file-header Display the ELF file header\n"));
- fprintf (stdout, _(" -l or --program-headers or --segments\n"));
- fprintf (stdout, _(" Display the program headers\n"));
- fprintf (stdout, _(" -S or --section-headers or --sections\n"));
- fprintf (stdout, _(" Display the sections' header\n"));
- fprintf (stdout, _(" -e or --headers Equivalent to: -h -l -S\n"));
- fprintf (stdout, _(" -s or --syms or --symbols Display the symbol table\n"));
- fprintf (stdout, _(" -n or --notes Display the core notes (if present)\n"));
- fprintf (stdout, _(" -r or --relocs Display the relocations (if present)\n"));
- fprintf (stdout, _(" -u or --unwind Display the unwind info (if present)\n"));
- fprintf (stdout, _(" -d or --dynamic Display the dynamic segment (if present)\n"));
- fprintf (stdout, _(" -V or --version-info Display the version sections (if present)\n"));
- fprintf (stdout, _(" -A or --arch-specific Display architecture specific information (if any).\n"));
- fprintf (stdout, _(" -D or --use-dynamic Use the dynamic section info when displaying symbols\n"));
- fprintf (stdout, _(" -x <number> or --hex-dump=<number>\n"));
- fprintf (stdout, _(" Dump the contents of section <number>\n"));
- fprintf (stdout, _(" -w[liaprmfs] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n"));
- fprintf (stdout, _(" Display the contents of DWARF2 debug sections\n"));
+ fprintf (stdout, _("Usage: readelf <option(s)> elf-file(s)\n"));
+ fprintf (stdout, _(" Display information about the contents of ELF format files\n"));
+ fprintf (stdout, _(" Options are:\n\
+ -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n\
+ -h --file-header Display the ELF file header\n\
+ -l --program-headers Display the program headers\n\
+ --segments An alias for --program-headers\n\
+ -S --section-headers Display the sections' header\n\
+ --sections An alias for --section-headers\n\
+ -e --headers Equivalent to: -h -l -S\n\
+ -s --syms Display the symbol table\n\
+ --symbols An alias for --syms\n\
+ -n --notes Display the core notes (if present)\n\
+ -r --relocs Display the relocations (if present)\n\
+ -u --unwind Display the unwind info (if present)\n\
+ -d --dynamic Display the dynamic segment (if present)\n\
+ -V --version-info Display the version sections (if present)\n\
+ -A --arch-specific Display architecture specific information (if any).\n\
+ -D --use-dynamic Use the dynamic section info when displaying symbols\n\
+ -x --hex-dump=<number> Dump the contents of section <number>\n\
+ -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n\
+ Display the contents of DWARF2 debug sections\n"));
#ifdef SUPPORT_DISASSEMBLY
- fprintf (stdout, _(" -i <number> or --instruction-dump=<number>\n"));
- fprintf (stdout, _(" Disassemble the contents of section <number>\n"));
+ fprintf (stdout, _("\
+ -i --instruction-dump=<number>\n\
+ Disassemble the contents of section <number>\n"));
#endif
- fprintf (stdout, _(" -I or --histogram Display histogram of bucket list lengths\n"));
- fprintf (stdout, _(" -v or --version Display the version number of readelf\n"));
- fprintf (stdout, _(" -W or --wide Don't split lines or truncate symbols to fit into 80 columns\n"));
- fprintf (stdout, _(" -H or --help Display this information\n"));
+ fprintf (stdout, _("\
+ -I --histogram Display histogram of bucket list lengths\n\
+ -W --wide Allow output width to exceed 80 characters\n\
+ -H --help Display this information\n\
+ -v --version Display the version number of readelf\n"));
fprintf (stdout, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (0);
/* size.c -- report size of various sections of an executable file.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GNU Binutils.
FILE *stream;
int status;
{
- fprintf (stream, _("\
-Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n\
- [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n\
- [-V | --version] [--target=bfdname] [--help] [file...]\n"),
- program_name);
+ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
+ fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
+ fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
+ fprintf (stream, _(" The options are:\n\
+ -A|-B --format={sysv|berkeley} Select output style (default is %s)\n\
+ -o|-d|-h --radix={8|10|16} Display numbers in octal, decimal or hex\n\
+ --target=<bfdname> Set the binary file format\n\
+ -h --help Display this information\n\
+ -v --version Display the program's version\n\
+\n"),
#if BSD_DEFAULT
- fputs (_("default is --format=berkeley\n"), stream);
+ "berkeley"
#else
- fputs (_("default is --format=sysv\n"), stream);
+ "sysv"
#endif
+);
list_supported_targets (program_name, stream);
if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
bfd_init ();
set_default_bfd_target ();
- while ((c = getopt_long (argc, argv, "ABVdfox", long_options,
+ while ((c = getopt_long (argc, argv, "ABHhVvdfox", long_options,
(int *) 0)) != EOF)
switch (c)
{
case 'B':
berkeley_format = 1;
break;
+ case 'v':
case 'V':
show_version = 1;
break;
break;
case 0:
break;
+ case 'h':
+ case 'H':
case '?':
usage (stderr, 1);
}
/* srconv.c -- Sysroff conversion program
- Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001
+ Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GNU Binutils.
static int align PARAMS ((int));
static void prescan PARAMS ((struct coff_ofile *));
static void show_usage PARAMS ((FILE *, int));
-static void show_help PARAMS ((void));
extern int main PARAMS ((int, char **));
static FILE *file;
int x;
{
if (ids2[x])
- {
- return ids2[x];
- }
+ return ids2[x];
+
ids2[x] = base2++;
return ids2[x];
}
int x;
{
if (ids1[x])
- {
- return ids1[x];
- }
+ return ids1[x];
+
ids1[x] = base1++;
return ids1[x];
}
return n;
}
-
-
#define DATE "940201073000"; /* Just a time on my birthday */
-
static
char *
strip_suffix (name)
{
int i;
char *res;
+
for (i = 0; name[i] != 0 && name[i] != '.'; i++)
;
res = (char *) xmalloc (i + 1);
return res;
}
-
/* IT LEN stuff CS */
static void
checksum (file, ptr, size, code)
int last;
int sum = 0;
int bytes = size / 8;
+
last = !(code & 0xff00);
if (size & 0x7)
abort ();
ptr[1] = bytes + 1;
for (j = 0; j < bytes; j++)
- {
- sum += ptr[j];
- }
- /* Glue on a checksum too */
+ sum += ptr[j];
+
+ /* Glue on a checksum too. */
ptr[bytes] = ~sum;
fwrite (ptr, bytes + 1, 1, file);
}
-
-
static void
writeINT (n, ptr, idx, size, file)
int n;
if (byte > 240)
{
- /* Lets write out that record and do another one */
+ /* Lets write out that record and do another one. */
checksum (file, ptr, *idx, code | 0x1000);
*idx = 16;
byte = *idx / 8;
}
+
switch (size)
{
case 0:
*idx += size * 8;
}
-
static void
writeBITS (val, ptr, idx, size)
int val;
int byte = *idx / 8;
int bit = *idx % 8;
int old;
+
*idx += size;
old = ptr[byte];
- /* Turn off all about to change bits */
+ /* Turn off all about to change bits. */
old &= ~((~0 >> (8 - bit - size)) & ((1 << size) - 1));
- /* Turn on the bits we want */
+ /* Turn on the bits we want. */
old |= (val & ((1 << size) - 1)) << (8 - bit - size);
ptr[byte] = old;
}
FILE *file;
{
int i;
+
writeINT (data.len, ptr, idx, 1, file);
for (i = 0; i < data.len; i++)
- {
- writeINT (data.data[i], ptr, idx, 1, file);
- }
+ writeINT (data.data[i], ptr, idx, 1, file);
}
-
static void
writeCHARS (string, ptr, idx, size, file)
char *string;
if (i > 240)
{
- /* Lets write out that record and do another one */
+ /* Lets write out that record and do another one. */
checksum (file, ptr, *idx, code | 0x1000);
*idx = 16;
i = *idx / 8;
if (size == 0)
{
- /* Variable length string */
+ /* Variable length string. */
size = strlen (string);
ptr[i++] = size;
}
- /* BUG WAITING TO HAPPEN */
+ /* BUG WAITING TO HAPPEN. */
memcpy (ptr + i, string, size);
i += size;
*idx = i * 8;
#define SYSROFF_SWAP_OUT
#include "sysroff.c"
-
static char *rname_sh[] =
{
"R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15"
static void
wr_tr ()
{
- /* The TR block is not normal - it doesn't have any contents. */
+ /* The TR block is not normal - it doesn't have any contents. */
- static char b[] = {
- 0xff, /* IT */
- 0x03, /* RL */
- 0xfd, /* CS */
- };
+ static char b[] =
+ {
+ 0xff, /* IT */
+ 0x03, /* RL */
+ 0xfd, /* CS */
+ };
fwrite (b, 1, sizeof (b), file);
}
int nsecs ATTRIBUTE_UNUSED;
{
struct IT_un un;
-
struct coff_symbol *s;
un.spare1 = 0;
un.format = FORMAT_OM;
un.spare1 = 0;
-
#if 1
- un.nsections = ptr->nsections - 1; /* Don't count the abs section */
+ un.nsections = ptr->nsections - 1; /* Don't count the abs section. */
#else
- /*NEW - only count sections with size */
+ /*NEW - only count sections with size. */
un.nsections = nsecs;
#endif
un.nextdefs = 0;
un.nextrefs = 0;
- /* Count all the undefined and defined variables with global scope */
+ /* Count all the undefined and defined variables with global scope. */
if (first)
{
sysroff_swap_un_out (file, &un);
}
-
static void
wr_hd (p)
struct coff_ofile *p;
hd.spare1 = 0;
if (bfd_get_file_flags (abfd) & EXEC_P)
- {
- hd.mt = MTYPE_ABS_LM;
- }
+ hd.mt = MTYPE_ABS_LM;
else
- {
- hd.mt = MTYPE_OMS_OR_LMS;
- }
+ hd.mt = MTYPE_OMS_OR_LMS;
+
hd.cd = DATE;
hd.nu = p->nsources; /* Always one unit */
hd.code = 0; /* Always ASCII */
hd.ver = "0200"; /* Version 2.00 */
+
switch (bfd_get_arch (abfd))
{
case bfd_arch_h8300:
while (i < section->bfd_section->_raw_size)
{
struct IT_ob ob;
- int todo = 200; /* Copy in 200 byte lumps */
+ int todo = 200; /* Copy in 200 byte lumps. */
+
ob.spare = 0;
if (i + todo > section->bfd_section->_raw_size)
todo = section->bfd_section->_raw_size - i;
ob.saf = 0;
}
- ob.cpf = 0; /* Never compress */
+ ob.cpf = 0; /* Never compress. */
ob.data.len = todo;
bfd_get_section_contents (abfd, section->bfd_section, stuff, i, todo);
ob.data.data = stuff;
sysroff_swap_ob_out (file, &ob /*, i + todo < section->size */ );
i += todo;
}
- /* Now fill the rest with blanks */
+
+ /* Now fill the rest with blanks. */
while (i < (bfd_size_type) section->size)
{
struct IT_ob ob;
- int todo = 200; /* Copy in 200 byte lumps */
+ int todo = 200; /* Copy in 200 byte lumps. */
+
ob.spare = 0;
if (i + todo > (bfd_size_type) section->size)
todo = section->size - i;
ob.saf = 0;
- ob.cpf = 0; /* Never compress */
+ ob.cpf = 0; /* Never compress. */
ob.data.len = todo;
memset (stuff, 0, todo);
ob.data.data = stuff;
sysroff_swap_ob_out (file, &ob);
i += todo;
}
- /* Now fill the rest with blanks */
-
+ /* Now fill the rest with blanks. */
}
static void
{
int nr = sec->nrelocs;
int i;
+
for (i = 0; i < nr; i++)
{
struct coff_reloc *r = sec->relocs + i;
struct coff_symbol *ref;
struct IT_rl rl;
+
rl.apol = 0;
rl.boundary = 0;
rl.segment = 1;
rl.check = 0;
rl.addr = r->offset;
rl.bitloc = 0;
- rl.flen = 32; /* SH Specific */
- /* What sort of reloc ? Look in the section to find out */
+ rl.flen = 32; /* SH Specific. */
+
+ /* What sort of reloc ? Look in the section to find out. */
ref = r->symbol;
if (ref->visible->type == coff_vis_ext_ref)
{
- rl.bcount = 4; /* Always 4 for us */
+ rl.bcount = 4; /* Always 4 for us. */
rl.op = OP_EXT_REF;
rl.symn = ref->er_number;
}
else if (ref->visible->type == coff_vis_common)
{
- rl.bcount = 11; /* Always 11 for us */
+ rl.bcount = 11; /* Always 11 for us. */
rl.op = OP_SEC_REF;
rl.secn = ref->where->section->number;
rl.copcode_is_3 = 3;
rl.addend = ref->where->offset - ref->where->section->address;
rl.aopcode_is_0x20 = 0x20;
}
-
else
{
- rl.bcount = 11; /* Always 11 for us */
+ rl.bcount = 11; /* Always 11 for us. */
rl.op = OP_SEC_REF;
rl.secn = ref->where->section->number;
rl.copcode_is_3 = 3;
rl.addend = -ref->where->section->address;
rl.aopcode_is_0x20 = 0x20;
}
+
rl.end = 0xff;
- if (rl.op == OP_SEC_REF
+
+ if ( rl.op == OP_SEC_REF
|| rl.op == OP_EXT_REF)
- {
- sysroff_swap_rl_out (file, &rl);
- }
+ sysroff_swap_rl_out (file, &rl);
}
}
struct coff_ofile *p;
{
int i;
+
for (i = 1; i < p->nsections; i++)
{
wr_sh (p, p->sections + i);
int nest;
{
struct IT_dps dps;
+
dps.end = 0;
dps.opt = 0;
dps.type = type;
+
if (scope->sec)
{
dps.san = scope->sec->number;
dps.address = scope->offset - find_base (sfile, scope->sec);
dps.block_size = scope->size;
+
if (debug)
{
printf ("DPS %s %d %x\n",
sfile->name,
nest,
dps.address);
-
}
}
else
int type;
{
struct IT_dps dps;
+
dps.end = 1;
dps.type = type;
sysroff_swap_dps_out (file, &dps);
dbt.sign = BTYPE_UNSPEC;
dbt.fptype = FPTYPE_NOTSPEC;
break;
+
case T_CHAR:
dbt.btype = BTYPE_CHAR;
dbt.sign = BTYPE_UNSPEC;
dbt.fptype = FPTYPE_NOTSPEC;
break;
+
case T_SHORT:
case T_INT:
case T_LONG:
dbt.sign = SIGN_SIGNED;
dbt.fptype = FPTYPE_NOTSPEC;
break;
+
case T_FLOAT:
dbt.btype = BTYPE_FLOAT;
dbt.fptype = FPTYPE_SINGLE;
break;
+
case T_DOUBLE:
dbt.btype = BTYPE_FLOAT;
dbt.fptype = FPTYPE_DOUBLE;
break;
+
case T_LNGDBL:
dbt.btype = BTYPE_FLOAT;
dbt.fptype = FPTYPE_EXTENDED;
break;
+
case T_UCHAR:
dbt.btype = BTYPE_CHAR;
dbt.sign = SIGN_UNSIGNED;
dbt.fptype = FPTYPE_NOTSPEC;
break;
+
case T_USHORT:
case T_UINT:
case T_ULONG:
dbt.fptype = FPTYPE_NOTSPEC;
break;
}
+
dbt.bitsize = type->size;
dbt.neg = 0x1001;
sysroff_swap_dbt_out (file, &dbt);
break;
}
+
case coff_pointer_type:
{
struct IT_dpt dpt;
+
walk_tree_type_1 (sfile, symbol, type->u.pointer.points_to, nest + 1);
dpt.neg = 0x1001;
sysroff_swap_dpt_out (file, &dpt);
{
struct IT_dfp dfp;
struct coff_symbol *param;
+
dfp.end = 0;
dfp.spare = 0;
dfp.nparams = type->u.function.parameters->nvars;
for (param = type->u.function.parameters->vars_head;
param;
param = param->next)
- {
- walk_tree_symbol (sfile, 0, param, nest);
- }
+ walk_tree_symbol (sfile, 0, param, nest);
+
dfp.end = 1;
sysroff_swap_dfp_out (file, &dfp);
break;
struct IT_dbt dbt;
struct IT_dds dds;
struct coff_symbol *member;
+
dds.spare = 0;
dbt.btype = BTYPE_STRUCT;
dbt.bitsize = type->size;
dds.end = 0;
dds.neg = 0x1001;
sysroff_swap_dds_out (file, &dds);
+
for (member = type->u.astructdef.elements->vars_head;
member;
member = member->next)
- {
- walk_tree_symbol (sfile, 0, member, nest + 1);
- }
+ walk_tree_symbol (sfile, 0, member, nest + 1);
dds.end = 1;
sysroff_swap_dds_out (file, &dds);
}
break;
+
case coff_structref_type:
{
struct IT_dbt dbt;
+
dbt.btype = BTYPE_TAG;
dbt.bitsize = type->size;
dbt.sign = SIGN_UNSPEC;
dbt.fptype = FPTYPE_NOTSPEC;
+
if (type->u.astructref.ref)
- {
- dbt.sid = get_member_id (type->u.astructref.ref->number);
- }
+ dbt.sid = get_member_id (type->u.astructref.ref->number);
else
- {
- dbt.sid = 0;
- }
+ dbt.sid = 0;
dbt.neg = 0x1001;
sysroff_swap_dbt_out (file, &dbt);
}
break;
+
case coff_array_type:
{
struct IT_dar dar;
int j;
- int dims = 1; /* Only output one dimension at a time */
+ int dims = 1; /* Only output one dimension at a time. */
+
dar.dims = dims;
dar.variable = nints (dims);
dar.subtype = nints (dims);
dar.minspare = nints (dims);
dar.neg = 0x1001;
dar.length = type->size / type->u.array.dim;
+
for (j = 0; j < dims; j++)
{
dar.variable[j] = VARIABLE_FIXED;
sysroff_swap_dar_out (file, &dar);
}
break;
+
case coff_enumdef_type:
{
struct IT_dbt dbt;
struct IT_den den;
struct coff_symbol *member;
+
dbt.btype = BTYPE_ENUM;
dbt.bitsize = type->size;
dbt.sign = SIGN_UNSPEC;
den.neg = 0x1001;
den.spare = 0;
sysroff_swap_den_out (file, &den);
+
for (member = type->u.aenumdef.elements->vars_head;
member;
member = member->next)
- {
- walk_tree_symbol (sfile, 0, member, nest + 1);
- }
+ walk_tree_symbol (sfile, 0, member, nest + 1);
den.end = 1;
sysroff_swap_den_out (file, &den);
}
break;
- break;
case coff_enumref_type:
{
struct IT_dbt dbt;
+
dbt.btype = BTYPE_TAG;
dbt.bitsize = type->size;
dbt.sign = SIGN_UNSPEC;
sysroff_swap_dbt_out (file, &dbt);
}
break;
+
default:
abort ();
}
static void
walk_tree_type (sfile, symbol, type, nest)
-
- struct
- coff_sfile *sfile;
+ struct coff_sfile *sfile;
struct coff_symbol *symbol;
struct coff_type *type;
int nest;
{
if (symbol->type->type == coff_function_type)
{
-
struct IT_dty dty;
+
dty.end = 0;
dty.neg = 0x1001;
BLOCK_TYPE_BLOCK);
wr_dps_end (symbol->where->section,
symbol->type->u.function.code, BLOCK_TYPE_FUNCTION);
-
}
else
{
struct IT_dty dty;
+
dty.end = 0;
dty.neg = 0x1001;
sysroff_swap_dty_out (file, &dty);
dty.end = 1;
sysroff_swap_dty_out (file, &dty);
}
-
}
-
-
static void
walk_tree_symbol (sfile, section, symbol, nest)
struct coff_sfile *sfile;
{
struct IT_dsy dsy;
- memset(&dsy, 0, sizeof(dsy));
+ memset (&dsy, 0, sizeof(dsy));
dsy.nesting = nest;
switch (symbol->type->type)
dsy.type = STYPE_FUNC;
dsy.assign = 1;
break;
+
case coff_structref_type:
case coff_pointer_type:
case coff_array_type:
dsy.type = STYPE_VAR;
dsy.assign = 1;
break;
+
case coff_enumdef_type:
dsy.type = STYPE_TAG;
dsy.assign = 0;
dsy.magic = 2;
break;
+
case coff_structdef_type:
dsy.type = STYPE_TAG;
dsy.assign = 0;
dsy.magic = symbol->type->u.astructdef.isstruct ? 0 : 1;
break;
+
case coff_secdef_type:
return;
+
default:
abort ();
}
dsy.assign = 0;
dsy.type = STYPE_MEMBER;
}
+
if (symbol->where->where == coff_where_member_of_enum)
{
dsy.type = STYPE_ENUM;
dsy.snumber = get_ordinary_id (symbol->number);
}
-
dsy.sname = symbol->name[0] == '_' ? symbol->name + 1 : symbol->name;
switch (symbol->visible->type)
case coff_vis_ext_def:
dsy.ainfo = AINFO_STATIC_EXT_DEF;
break;
+
case coff_vis_ext_ref:
dsy.ainfo = AINFO_STATIC_EXT_REF;
break;
+
case coff_vis_int_def:
dsy.ainfo = AINFO_STATIC_INT;
break;
+
case coff_vis_auto:
case coff_vis_autoparam:
dsy.ainfo = AINFO_AUTO;
break;
+
case coff_vis_register:
case coff_vis_regparam:
dsy.ainfo = AINFO_REG;
break;
break;
+
case coff_vis_tag:
case coff_vis_member_of_struct:
case coff_vis_member_of_enum:
break;
+
default:
abort ();
}
dsy.dlength = symbol->type->size;
+
switch (symbol->where->where)
{
case coff_where_memory:
dsy.section = 0;
#endif
break;
+
case coff_where_member_of_struct:
case coff_where_member_of_enum:
case coff_where_stack:
case coff_where_register:
case coff_where_unknown:
case coff_where_strtag:
-
case coff_where_entag:
case coff_where_typedef:
break;
+
default:
abort ();
}
case coff_where_memory:
dsy.address = symbol->where->offset - find_base (sfile, symbol->where->section);
break;
+
case coff_where_stack:
dsy.address = symbol->where->offset;
break;
- case coff_where_member_of_struct:
-
+ case coff_where_member_of_struct:
if (symbol->where->bitsize)
{
int bits = (symbol->where->offset * 8 + symbol->where->bitoffset);
dsy.field_off = symbol->where->offset;
}
break;
+
case coff_where_member_of_enum:
/* dsy.bitunit = 0;
dsy.field_len = symbol->type->size;
dsy.field_off = symbol->where->offset; */
break;
+
case coff_where_register:
case coff_where_unknown:
case coff_where_strtag:
-
case coff_where_entag:
case coff_where_typedef:
break;
+
default:
abort ();
}
switch (symbol->visible->type)
{
case coff_vis_common:
- /* We do this 'cause common C symbols are treated as extdefs */
+ /* We do this 'cause common C symbols are treated as extdefs. */
case coff_vis_ext_def:
case coff_vis_ext_ref:
-
dsy.ename = symbol->name;
break;
break;
case coff_vis_int_def:
-
case coff_vis_auto:
case coff_vis_register:
case coff_vis_tag:
case coff_vis_member_of_struct:
case coff_vis_member_of_enum:
break;
+
default:
abort ();
}
dsy.sfn = 0;
dsy.sln = 2;
-
dsy.neg = 0x1001;
-
sysroff_swap_dsy_out (file, &dsy);
walk_tree_type (sfile, symbol, symbol->type, nest);
}
-
static void
walk_tree_scope (section, sfile, scope, nest, type)
struct coff_section *section;
wr_globals (tree, sfile, nest + 1);
for (vars = scope->vars_head; vars; vars = vars->next)
- {
- walk_tree_symbol (sfile, section, vars, nest);
- }
+ walk_tree_symbol (sfile, section, vars, nest);
for (child = scope->list_head; child; child = child->next)
- {
- walk_tree_scope (section, sfile, child, nest + 1, BLOCK_TYPE_BLOCK);
- }
+ walk_tree_scope (section, sfile, child, nest + 1, BLOCK_TYPE_BLOCK);
wr_dps_end (section, scope, type);
}
}
+
static void
walk_tree_sfile (section, sfile)
struct coff_section *section;
struct coff_sfile *sfile;
{
walk_tree_scope (section, sfile, sfile->scope, 0, BLOCK_TYPE_COMPUNIT);
-
}
static void
struct coff_ofile *p;
struct coff_sfile *sfile;
{
-
walk_tree_sfile (p->sections + 4, sfile);
-
}
static void
int j;
unsigned int *lowest = (unsigned *) nints (p->nsections);
unsigned int *highest = (unsigned *) nints (p->nsections);
+
du.format = bfd_get_file_flags (abfd) & EXEC_P ? 0 : 1;
du.optimized = 0;
du.stackfrmt = 0;
}
/* Look through all the symbols and try and work out the extents in this
- source file */
+ source file. */
#if 0
for (symbol = sfile->scope->vars_head;
symbol;
}
}
-
for (i = 0; i < du.sections; i++)
{
if (highest[i] == 0)
- {
- lowest[i] = highest[i] = incit;
- }
+ lowest[i] = highest[i] = incit;
+
du.san[used] = i;
du.length[used] = highest[i] - lowest[i];
du.address[used] = bfd_get_file_flags (abfd) & EXEC_P ? lowest[i] : 0;
+
if (debug)
{
printf (" section %6s 0x%08x..0x%08x\n",
}
used++;
}
-
#endif
+
lim = du.sections;
for (j = 0; j < lim; j++)
{
int src = j;
int dst = j;
+
du.san[dst] = dst;
+
if (sfile->section[src].init)
{
du.length[dst]
du.length[dst] = 0;
du.address[dst] = 0;
}
+
if (debug)
{
if (sfile->section[src].parent)
du.address[dst] + du.length[dst] - 1);
}
}
+
du.sections = dst + 1;
}
struct coff_ofile *p ATTRIBUTE_UNUSED;
struct coff_sfile *sfile;
{
-
struct IT_dus dus;
dus.efn = 0x1001;
dus.fname = (char **) xcalloc (sizeof (char *), dus.ns);
dus.spare = nints (dus.ns);
dus.ndir = 0;
- /* Find the filenames */
+ /* Find the filenames. */
#if 0
i = 0;
}
/* Find the offset of the .text section for this sfile in the
- .text section for the output file */
+ .text section for the output file. */
static int
find_base (sfile, section)
#endif
}
-/* Write the global symbols out to the debug info */
+/* Write the global symbols out to the debug info. */
+
static void
wr_globals (p, sfile, n)
struct coff_ofile *p;
int n ATTRIBUTE_UNUSED;
{
struct coff_symbol *sy;
+
for (sy = p->symbol_list_head;
sy;
sy = sy->next_in_ofile_list)
|| sy->visible->type == coff_vis_ext_ref)
{
/* Only write out symbols if they belong to
- the current source file */
+ the current source file. */
if (sy->sfile == sfile)
walk_tree_symbol (sfile, 0, sy, 0);
-
}
}
}
{
struct coff_sfile *sfile;
int n = 0;
+
for (sfile = p->source_head;
sfile;
sfile = sfile->next)
-
{
if (debug)
- {
- printf ("%s\n", sfile->name);
- }
+ printf ("%s\n", sfile->name);
+
wr_du (p, sfile, n);
wr_dus (p, sfile);
wr_program_structure (p, sfile);
wr_cs ()
{
/* It seems that the CS struct is not normal - the size is wrong
- heres one I prepared earlier.. */
- static char b[] = {
+ heres one I prepared earlier. */
+ static char b[] =
+ {
0x80, /* IT */
0x21, /* RL */
0x00, /* number of chars in variable length part */
/* Write out the SC records for a unit. Create an SC
for all the sections which appear in the output file, even
- if there isn't an equivalent one on the input */
+ if there isn't an equivalent one on the input. */
static int
wr_sc (ptr, sfile)
struct coff_sfile *sfile;
{
int i;
-int scount = 0;
- /* First work out the total number of sections */
-
+ int scount = 0;
+ /* First work out the total number of sections. */
int total_sec = ptr->nsections;
-
struct myinfo
{
struct coff_section *sec;
struct coff_symbol *symbol;
};
struct coff_symbol *symbol;
-
struct myinfo *info
= (struct myinfo *) calloc (total_sec, sizeof (struct myinfo));
-
for (i = 0; i < total_sec; i++)
{
info[i].sec = ptr->sections + i;
}
/* Now output all the section info, and fake up some stuff for sections
- we don't have */
-
+ we don't have. */
for (i = 1; i < total_sec; i++)
{
struct IT_sc sc;
char *name;
+
symbol = info[i].symbol;
sc.spare = 0;
sc.spare1 = 0;
+
if (!symbol)
{
- /* Don't have a symbol set aside for this section, which means that nothing
- in this file does anything for the section. */
+ /* Don't have a symbol set aside for this section, which means
+ that nothing in this file does anything for the section. */
sc.format = !(bfd_get_file_flags (abfd) & EXEC_P);
sc.addr = 0;
sc.length = 0;
}
sc.align = 4;
-
sc.concat = CONCAT_SIMPLE;
sc.read = 3;
sc.write = 3;
sc.mode = 3;
sc.spare = 0;
sc.segadd = 0;
- sc.spare1 = 0; /* If not zero, then it doesn't work */
+ sc.spare1 = 0; /* If not zero, then it doesn't work. */
sc.name = section_translate (name);
+
if (strlen (sc.name) == 1)
{
switch (sc.name[0])
case 'B':
sc.contents = CONTENTS_DATA;
break;
+
default:
sc.contents = CONTENTS_CODE;
}
}
#if 0
/* NEW */
- if (sc.length) {
+ if (sc.length)
+ {
#endif
- sysroff_swap_sc_out (file, &sc);
- scount++;
+ sysroff_swap_sc_out (file, &sc);
+ scount++;
#if 0
- }
+ }
#endif
}
-return scount;
+ return scount;
}
+/* Write out the ER records for a unit. */
-/* Write out the ER records for a unit. */
static void
wr_er (ptr, sfile, first)
struct coff_ofile *ptr;
{
int idx = 0;
struct coff_symbol *sym;
+
if (first)
{
for (sym = ptr->symbol_list_head; sym; sym = sym->next_in_ofile_list)
if (sym->visible->type == coff_vis_ext_ref)
{
struct IT_er er;
+
er.spare = 0;
er.type = ER_NOTSPEC;
er.name = sym->name;
}
}
-/* Write out the ED records for a unit. */
+/* Write out the ED records for a unit. */
+
static void
wr_ed (ptr, sfile, first)
struct coff_ofile *ptr;
int first;
{
struct coff_symbol *s;
+
if (first)
{
for (s = ptr->symbol_list_head; s; s = s->next_in_ofile_list)
ed.section = s->where->section->number;
ed.spare = 0;
+
if (s->where->section->data)
{
ed.type = ED_TYPE_DATA;
ed.type = ED_TYPE_NOTSPEC;
ed.type = ED_TYPE_DATA;
}
+
ed.address = s->where->offset - s->where->section->address;
ed.name = s->name;
sysroff_swap_ed_out (file, &ed);
{
struct coff_sfile *sfile;
int first = 1;
+
for (sfile = ptr->source_head;
sfile;
sfile = sfile->next)
long p1;
long p2;
int nsecs;
+
p1 = ftell (file);
wr_un (ptr, sfile, first, 0);
nsecs = wr_sc (ptr, sfile);
}
/* Find all the common variables and turn them into
- ordinary defs - dunno why, but thats what hitachi does with 'em */
+ ordinary defs - dunno why, but thats what hitachi does with 'em. */
static void
prescan (tree)
{
struct coff_symbol *s;
struct coff_section *common_section;
- /* Find the common section - always section 3 */
+
+ /* Find the common section - always section 3. */
common_section = tree->sections + 3;
+
for (s = tree->symbol_list_head;
s;
s = s->next_in_ofile_list)
FILE *file;
int status;
{
- fprintf (file, _("Usage: %s [-dhVq] in-file [out-file]\n"), program_name);
+ fprintf (file, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name);
+ fprintf (file, _("Convert a COFF object file into a SYSROFF object file\n"));
+ fprintf (file, _(" The options are:\n\
+ -q --quick (Obsolete - ignoerd)\n\
+ -n --noprescan Do not perform a scan to convert commons into defs\n\
+ -d --debug Display information about what is being done\n\
+ -h --help Display this information\n\
+ -v --version Print the program's version number\n"));
+
+ if (status == 0)
+ fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status);
}
-static void
-show_help ()
-{
- printf (_("%s: Convert a COFF object file into a SYSROFF object file\n"),
- program_name);
- show_usage (stdout, 0);
-}
-
-
-
int
main (ac, av)
int ac;
program_name = av[0];
xmalloc_set_program_name (program_name);
- while ((opt = getopt_long (ac, av, "dhVqn", long_options,
+ while ((opt = getopt_long (ac, av, "dHhVvqn", long_options,
(int *) NULL))
!= EOF)
{
case 'd':
debug = 1;
break;
+ case 'H':
case 'h':
- show_help ();
+ show_usage (stdout, 0);
/*NOTREACHED */
+ case 'v':
case 'V':
print_version ("srconv");
exit (0);
it doesn't end in .o, then stick a .obj on anyway */
int len = strlen (input_file);
+
output_file = xmalloc (len + 5);
strcpy (output_file, input_file);
+
if (len > 3
&& output_file[len - 2] == '.'
&& output_file[len - 1] == 'o')
if (!bfd_check_format_matches (abfd, bfd_object, &matching))
{
bfd_nonfatal (input_file);
+
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
{
list_matching_formats (matching);
file = fopen (output_file, FOPEN_WB);
if (!file)
- {
- fatal (_("unable to open output file %s"), output_file);
- }
+ fatal (_("unable to open output file %s"), output_file);
if (debug)
printf ("ids %d %d\n", base1, base2);
+
tree = coff_grok (abfd);
+
if (!noprescan)
prescan (tree);
+
wr_module (tree);
return 0;
}
/* strings -- print the strings of printable characters in files
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
target = NULL;
encoding = 's';
- while ((optc = getopt_long (argc, argv, "afn:ot:e:v0123456789",
+ while ((optc = getopt_long (argc, argv, "afhHn:ot:e:Vv0123456789",
long_options, (int *) 0)) != EOF)
{
switch (optc)
print_filenames = true;
break;
+ case 'H':
case 'h':
usage (stdout, 0);
encoding = optarg[0];
break;
+ case 'V':
case 'v':
print_version ("strings");
break;
FILE *stream;
int status;
{
- fprintf (stream, _("\
-Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-e {s,b,l,B,L}]\n\
- [-] [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n\
- [--target=bfdname] [--encoding {s,b,l,B,L}] [--help] [--version] file...\n"),
- program_name);
+ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
+ fprintf (stream, _(" Display printable strings in [file(s)] (stdin by default)\n"));
+ fprintf (stream, _(" The options are:\n\
+ -a - --all Scan the entire file, not just the data section\n\
+ -f --print-file-name Print the name of the file before each string\n\
+ -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\
+ -<number> least [number] characters (default 4).\n\
+ -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n\
+ -o An alias for --radix=o\n\
+ -T --target=<BFDNAME> Specify the binary file format\n\
+ -e --encoding={s,b,l,B,L} Select character size and endianness:\n\
+ s = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\
+ -h --help Display this information\n\
+ -v --version Print the program's version number\n"));
list_supported_targets (program_name, stream);
if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
/* Sysroff object format dumper.
- Copyright 1994, 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of GNU Binutils.
/* Written by Steve Chamberlain <sac@cygnus.com>.
This program reads a SYSROFF object file and prints it in an
- almost human readable form to stdout. */
+ almost human readable form to stdout. */
#include "bfd.h"
#include "bucomm.h"
static void derived_type PARAMS ((void));
static void module PARAMS ((void));
static void show_usage PARAMS ((FILE *, int));
-static void show_help PARAMS ((void));
extern char *getCHARS PARAMS ((unsigned char *, int *, int, int));
extern int fillup PARAMS ((char *));
int oc = *idx / 8;
char *r;
int b = size;
+
if (b >= max)
- {
- return "*undefined*";
- }
+ return "*undefined*";
if (b == 0)
{
- /* Got to work out the length of the string from self */
+ /* Got to work out the length of the string from self. */
b = ptr[oc++];
(*idx) += 8;
}
r = xcalloc (b + 1, 1);
memcpy (r, ptr + oc, b);
r[b] = 0;
+
return r;
}
for (j = 0; j < span && j + i < size; j++)
{
int c = ptr[i + j];
+
if (c < 32 || c > 127)
c = '.';
printf ("%c", c);
}
+
printf ("\n");
}
}
int size;
int sum;
int i;
+
size = getc (file) - 2;
fread (ptr, 1, size, file);
sum = code + size + 2;
+
for (i = 0; i < size; i++)
- {
- sum += ptr[i];
- }
+ sum += ptr[i];
if ((sum & 0xff) != 0xff)
- {
- printf ("SUM IS %x\n", sum);
- }
+ printf ("SUM IS %x\n", sum);
+
if (dump)
dh (ptr, size);
int i;
int byte = *idx / 8;
int size = ptr[byte++];
+
res.len = size;
res.data = (unsigned char *) xmalloc (size);
+
for (i = 0; i < size; i++)
- {
- res.data[i] = ptr[byte++];
- }
+ res.data[i] = ptr[byte++];
+
return res;
}
int byte = *idx / 8;
if (byte >= max)
- {
- return 0;
- }
+ return 0;
+
if (size == -2)
size = addrsize;
+
if (size == -1)
size = 0;
+
switch (size)
{
case 0:
default:
abort ();
}
+
*idx += size * 8;
return n;
}
}
static int indent;
+
static void
p ()
{
int i;
+
for (i = 0; i < indent; i++)
- {
- printf ("| ");
- }
+ printf ("| ");
+
printf ("> ");
}
barray *y;
{
int x;
+
printf ("%d (", y->len);
+
for (x = 0; x < y->len; x++)
- {
- printf ("(%02x %c)", y->data[x],
- ISPRINT (y->data[x]) ? y->data[x] : '.');
- }
+ printf ("(%02x %c)", y->data[x],
+ ISPRINT (y->data[x]) ? y->data[x] : '.');
+
printf (")\n");
}
#include "sysroff.c"
-/*
- * FIXME: sysinfo, which generates sysroff.[ch] from sysroff.info, can't
- * hack the special case of the tr block, which has no contents. So we
- * implement our own functions for reading in and printing out the tr
- * block.
- */
+/* FIXME: sysinfo, which generates sysroff.[ch] from sysroff.info, can't
+ hack the special case of the tr block, which has no contents. So we
+ implement our own functions for reading in and printing out the tr
+ block. */
#define IT_tr_CODE 0x7f
+
void
sysroff_swap_tr_in()
{
- char raw[255];
+ char raw[255];
- memset(raw, 0, 255);
- fillup(raw);
+ memset (raw, 0, 255);
+ fillup (raw);
}
void
sysroff_print_tr_out()
{
- itheader("tr", IT_tr_CODE);
+ itheader ("tr", IT_tr_CODE);
}
static int
int type;
{
int c = getc (file);
+
code = c;
if ((c & 0x7f) != type)
sysroff_print_cs_out (&dummy);
}
break;
+
case IT_dln_CODE:
{
struct IT_dln dummy;
sysroff_print_dln_out (&dummy);
}
break;
+
case IT_hd_CODE:
{
struct IT_hd dummy;
sysroff_print_hd_out (&dummy);
}
break;
+
case IT_dar_CODE:
{
struct IT_dar dummy;
sysroff_print_dar_out (&dummy);
}
break;
+
case IT_dsy_CODE:
{
struct IT_dsy dummy;
sysroff_print_dsy_out (&dummy);
}
break;
+
case IT_dfp_CODE:
{
struct IT_dfp dummy;
sysroff_print_dfp_out (&dummy);
}
break;
+
case IT_dso_CODE:
{
struct IT_dso dummy;
sysroff_print_dso_out (&dummy);
}
break;
+
case IT_dpt_CODE:
{
struct IT_dpt dummy;
sysroff_print_dpt_out (&dummy);
}
break;
+
case IT_den_CODE:
{
struct IT_den dummy;
sysroff_print_den_out (&dummy);
}
break;
+
case IT_dbt_CODE:
{
struct IT_dbt dummy;
sysroff_print_dbt_out (&dummy);
}
break;
+
case IT_dty_CODE:
{
struct IT_dty dummy;
sysroff_print_dty_out (&dummy);
}
break;
+
case IT_un_CODE:
{
struct IT_un dummy;
sysroff_print_un_out (&dummy);
}
break;
+
case IT_sc_CODE:
{
struct IT_sc dummy;
sysroff_print_sc_out (&dummy);
}
break;
+
case IT_er_CODE:
{
struct IT_er dummy;
sysroff_print_er_out (&dummy);
}
break;
+
case IT_ed_CODE:
{
struct IT_ed dummy;
sysroff_print_ed_out (&dummy);
}
break;
+
case IT_sh_CODE:
{
struct IT_sh dummy;
sysroff_print_sh_out (&dummy);
}
break;
+
case IT_ob_CODE:
{
struct IT_ob dummy;
sysroff_print_ob_out (&dummy);
}
break;
+
case IT_rl_CODE:
{
struct IT_rl dummy;
sysroff_print_rl_out (&dummy);
}
break;
+
case IT_du_CODE:
{
struct IT_du dummy;
sysroff_print_du_out (&dummy);
}
break;
+
case IT_dus_CODE:
{
struct IT_dus dummy;
sysroff_print_dus_out (&dummy);
}
break;
+
case IT_dul_CODE:
{
struct IT_dul dummy;
sysroff_print_dul_out (&dummy);
}
break;
+
case IT_dss_CODE:
{
struct IT_dss dummy;
sysroff_print_dss_out (&dummy);
}
break;
+
case IT_hs_CODE:
{
struct IT_hs dummy;
sysroff_print_hs_out (&dummy);
}
break;
+
case IT_dps_CODE:
{
struct IT_dps dummy;
sysroff_print_dps_out (&dummy);
}
break;
+
case IT_tr_CODE:
- {
- sysroff_swap_tr_in ();
- sysroff_print_tr_out ();
- }
+ sysroff_swap_tr_in ();
+ sysroff_print_tr_out ();
break;
+
case IT_dds_CODE:
{
struct IT_dds dummy;
+
sysroff_swap_dds_in (&dummy);
sysroff_print_dds_out (&dummy);
}
break;
+
default:
printf ("GOT A %x\n", c);
return 0;
break;
}
+
return 1;
}
int x;
{
if (!getone (x))
- {
- printf ("WANTED %x!!\n", x);
- }
+ printf ("WANTED %x!!\n", x);
}
static void
char *s;
{
indent += i;
+
if (s)
{
p ();
dump_symbol_info ()
{
tab (1, "SYMBOL INFO");
+
while (opt (IT_dsy_CODE))
{
if (opt (IT_dty_CODE))
must (IT_dty_CODE);
}
}
+
tab (-1, "");
}
derived_type ()
{
tab (1, "DERIVED TYPE");
+
while (1)
{
if (opt (IT_dpp_CODE))
FILE *file;
int status;
{
- fprintf (file, _("Usage: %s [-hV] in-file\n"), program_name);
+ fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name);
+ fprintf (file, _("Print a human readable interpretation of a SYSROFF object file\n"));
+ fprintf (file, _(" The options are:\n\
+ -h --help Display this information\n\
+ -v --version Print the program's version number\n"));
+
+ if (status == 0)
+ fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status);
}
-static void
-show_help ()
-{
- printf (_("%s: Print a human readable interpretation of a SYSROFF object file\n"),
- program_name);
- show_usage (stdout, 0);
-}
-
int
main (ac, av)
int ac;
program_name = av[0];
xmalloc_set_program_name (program_name);
- while ((opt = getopt_long (ac, av, "hV", long_options, (int *) NULL)) != EOF)
+ while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF)
{
switch (opt)
{
+ case 'H':
case 'h':
- show_help ();
+ show_usage (stdout, 0);
/*NOTREACHED*/
+ case 'v':
case 'V':
print_version ("sysdump");
exit (0);
/* The input and output files may be named on the command line. */
if (optind < ac)
- {
- input_file = av[optind];
- }
+ input_file = av[optind];
if (!input_file)
- {
- fatal (_("no input file specified"));
- }
+ fatal (_("no input file specified"));
file = fopen (input_file, FOPEN_RB);
+
if (!file)
- {
- fatal (_("cannot open input file %s"), input_file);
- }
+ fatal (_("cannot open input file %s"), input_file);
module ();
return 0;
/* windres.c -- a program to manipulate Windows resources
- Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
/* If we don't recognize the name of an output file, assume it's a
COFF file. */
-
if (! input)
return RES_FORMAT_COFF;
/* Read the first few bytes of the file to see if we can guess what
it is. */
-
e = fopen (filename, FOPEN_RB);
if (e == NULL)
fatal ("%s: %s", filename, strerror (errno));
FILE *stream;
int status;
{
- fprintf (stream, _("Usage: %s [options] [input-file] [output-file]\n"),
+ fprintf (stream, _("Usage: %s [option(s)] [input-file] [output-file]\n"),
program_name);
- fprintf (stream, _("\
-Options:\n\
- -i FILE, --input FILE Name input file\n\
- -o FILE, --output FILE Name output file\n\
- -I FORMAT, --input-format FORMAT\n\
- Specify input format\n\
- -O FORMAT, --output-format FORMAT\n\
- Specify output format\n\
- -F TARGET, --target TARGET Specify COFF target\n\
- --preprocessor PROGRAM Program to use to preprocess rc file\n\
- --include-dir DIR Include directory when preprocessing rc file\n\
- -DSYM[=VAL], --define SYM[=VAL]\n\
- Define SYM when preprocessing rc file\n\
- -v Verbose - tells you what it's doing\n\
- --language VAL Set language when reading rc file\n\
- --use-temp-file Use a temporary file instead of popen to read\n\
- the preprocessor output\n\
- --no-use-temp-file Use popen (default)\n"));
+ fprintf (stream, _(" The options are:\n\
+ -i --input=<file> Name input file\n\
+ -o --output=<file> Name output file\n\
+ -I --input-format=<format> Specify input format\n\
+ -O --output-format=<format> Specify output format\n\
+ -F --target=<target> Specify COFF target\n\
+ --preprocessor=<program> Program to use to preprocess rc file\n\
+ --include-dir=<dir> Include directory when preprocessing rc file\n\
+ -D --define <sym>[=<val>] Define SYM when preprocessing rc file\n\
+ -v --verbose Verbose - tells you what it's doing\n\
+ --language=<val> Set language when reading rc file\n\
+ --use-temp-file Use a temporary file instead of popen to read\n\
+ the preprocessor output\n\
+ --no-use-temp-file Use popen (default)\n"));
#ifdef YYDEBUG
fprintf (stream, _("\
- --yydebug Turn on parser debugging\n"));
+ --yydebug Turn on parser debugging\n"));
#endif
fprintf (stream, _("\
- --help Print this help message\n\
- --version Print version information\n"));
+ -h --help Print this help message\n\
+ -V --version Print version information\n"));
fprintf (stream, _("\
FORMAT is one of rc, res, or coff, and is deduced from the file name\n\
extension if not specified. A single file name is an input file.\n\
No input-file is stdin, default rc. No output-file is stdout, default rc.\n"));
+
list_supported_targets (program_name, stream);
+
if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
+
exit (status);
}
-/* Quote characters that will confuse the shell when we run the preprocessor */
-static const char *quot (string)
+/* Quote characters that will confuse the shell when we run the preprocessor. */
+
+static const char *
+quot (string)
const char *string;
{
static char *buf = 0;
language = -1;
use_temp_file = 0;
- while ((c = getopt_long (argc, argv, "i:o:I:O:F:D:v", long_options,
+ while ((c = getopt_long (argc, argv, "i:o:I:O:F:D:hHvV", long_options,
(int *) 0)) != EOF)
{
switch (c)
break;
#endif
+ case 'h':
+ case 'H':
case OPTION_HELP:
usage (stdout, 0);
break;
+ case 'V':
case OPTION_VERSION:
print_version ("windres");
break;