Tidy up formatting of --help output.

This commit is contained in:
Nick Clifton 2002-01-23 16:12:56 +00:00
parent c69539487b
commit 8b53311e10
16 changed files with 620 additions and 468 deletions

View File

@ -1,3 +1,39 @@
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> 2002-01-18 Andreas Jaeger <aj@suse.de>
* version.c (print_version): Update year. * version.c (print_version): Update year.

View File

@ -1,5 +1,5 @@
/* addr2line.c -- convert addresses to line number and function name /* 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> Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.siemens.de>
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -70,11 +70,19 @@ usage (stream, status)
FILE *stream; FILE *stream;
int status; int status;
{ {
fprintf (stream, _("\ fprintf (stream, _("Usage: %s [option(s)] [addr(s)]\n"), program_name);
Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\ fprintf (stream, _(" Convert addresses into line number/file name pairs.\n"));
[-e executable] [--exe=executable] [--demangle[=style]]\n\ fprintf (stream, _(" If no addresses are specified on the command line, they will be read from stdin\n"));
[--basenames] [--functions] [addr addr ...]\n"), fprintf (stream, _(" The options are:\n\
program_name); -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); list_supported_targets (program_name, stream);
if (status == 0) if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO); fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
@ -291,13 +299,13 @@ main (argc, argv)
filename = NULL; filename = NULL;
target = 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) != EOF)
{ {
switch (c) switch (c)
{ {
case 0: case 0:
break; /* we've been given a long option */ break; /* We've been given a long option. */
case 'b': case 'b':
target = optarg; target = optarg;
break; break;
@ -324,9 +332,11 @@ main (argc, argv)
case 'f': case 'f':
with_functions = true; with_functions = true;
break; break;
case 'v':
case 'V': case 'V':
print_version ("addr2line"); print_version ("addr2line");
break; break;
case 'h':
case 'H': case 'H':
usage (stdout, 0); usage (stdout, 0);
break; break;

View File

@ -1,6 +1,6 @@
/* ar.c - Archive modify and extract. /* ar.c - Archive modify and extract.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001 2001, 2002
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -280,8 +280,14 @@ usage (help)
fprintf (s, _(" [-X32_64] - (ignored)\n")); fprintf (s, _(" [-X32_64] - (ignored)\n"));
} }
else else
{
/* xgettext:c-format */ /* 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); list_supported_targets (program_name, stderr);
@ -453,7 +459,10 @@ main (argc, argv)
{ {
boolean touch = false; 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); usage (0);
if (strcmp (argv[1], "-V") == 0 if (strcmp (argv[1], "-V") == 0
|| strcmp (argv[1], "-v") == 0 || strcmp (argv[1], "-v") == 0

View File

@ -1,27 +1,27 @@
/* Coff file dumper. /* 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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or (at
(at your option) any later version. your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Steve Chamberlain <sac@cygnus.com> /* Written by Steve Chamberlain <sac@cygnus.com>
This module reads a type tree generated by coffgrok and prints 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 <bfd.h>
#include <getopt.h> #include <getopt.h>
@ -44,12 +44,11 @@ static void dump_coff_sfile PARAMS ((struct coff_sfile *));
static void dump_coff_section PARAMS ((struct coff_section *)); static void dump_coff_section PARAMS ((struct coff_section *));
extern void coff_dump PARAMS ((struct coff_ofile *)); extern void coff_dump PARAMS ((struct coff_ofile *));
static void show_usage PARAMS ((FILE *, int)); static void show_usage PARAMS ((FILE *, int));
static void show_help PARAMS ((void));
extern int main PARAMS ((int, char **)); extern int main PARAMS ((int, char **));
static void static void
tab (x) tab (x)
int x; int x;
{ {
static int indent; static int indent;
int i; int i;
@ -91,7 +90,8 @@ int x;
} }
} }
static void nl () static void
nl ()
{ {
atnl = 1; atnl = 1;
} }
@ -102,21 +102,25 @@ dump_coff_lines (p)
{ {
int i; int i;
int online = 0; int online = 0;
tab(1);
printf(_("#lines %d "),p->nlines); tab (1);
printf (_("#lines %d "),p->nlines);
for (i = 0; i < p->nlines; i++) 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++; online++;
if (online > 6) if (online > 6)
{ {
nl(); nl ();
tab(0); tab (0);
online = 0; online = 0;
} }
} }
nl(); nl ();
tab(-1); tab (-1);
} }
static void static void
@ -125,13 +129,14 @@ dump_coff_type (p)
{ {
tab (1); tab (1);
printf ("size %d ", p->size); printf ("size %d ", p->size);
switch (p->type) switch (p->type)
{ {
case coff_secdef_type: case coff_secdef_type:
printf ("section definition at %x size %x\n", printf ("section definition at %x size %x\n",
p->u.asecdef.address, p->u.asecdef.address,
p->u.asecdef.size); p->u.asecdef.size);
nl(); nl ();
break; break;
case coff_pointer_type: case coff_pointer_type:
printf ("pointer to"); printf ("pointer to");
@ -325,7 +330,6 @@ dump_coff_visible (p)
tab (-1); tab (-1);
} }
void void
dump_coff_symbol (p) dump_coff_symbol (p)
struct coff_symbol *p; struct coff_symbol *p;
@ -333,6 +337,7 @@ dump_coff_symbol (p)
tab (1); tab (1);
printf ("List of symbols"); printf ("List of symbols");
nl (); nl ();
while (p) while (p)
{ {
tab (1); tab (1);
@ -363,35 +368,37 @@ static void
dump_coff_scope (p) dump_coff_scope (p)
struct coff_scope *p; struct coff_scope *p;
{ {
if (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)
{ {
tab (0); tab (1);
printf ("vars %d", p->nvars); printf ("List of blocks %lx ",(unsigned long) p);
nl ();
dump_coff_symbol (p->vars_head);
printf ("blocks");
nl ();
dump_coff_scope (p->list_head);
nl ();
p = p->next;
}
tab (0); if (p->sec)
printf ("*****************"); printf( " %s %x..%x", p->sec->name,p->offset, p->offset + p->size -1);
nl ();
tab (-1); nl ();
} tab (0);
printf ("*****************");
nl ();
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 ();
tab (-1);
}
} }
static void static void
@ -401,6 +408,7 @@ dump_coff_sfile (p)
tab (1); tab (1);
printf ("List of source files"); printf ("List of source files");
nl (); nl ();
while (p) while (p)
{ {
tab (0); tab (0);
@ -414,25 +422,27 @@ dump_coff_sfile (p)
static void static void
dump_coff_section(ptr) dump_coff_section(ptr)
struct coff_section *ptr; struct coff_section *ptr;
{ {
int i; int i;
tab(1);
printf("section %s %d %d address %x size %x number %d nrelocs %d", tab (1);
ptr->name, ptr->code, ptr->data, ptr->address,ptr->size, ptr->number, ptr->nrelocs); printf ("section %s %d %d address %x size %x number %d nrelocs %d",
nl(); ptr->name, ptr->code, ptr->data, ptr->address,ptr->size,
ptr->number, ptr->nrelocs);
nl ();
for (i = 0; i < ptr->nrelocs; i++) for (i = 0; i < ptr->nrelocs; i++)
{ {
tab(0); tab (0);
printf("(%x %s %x)", printf ("(%x %s %x)",
ptr->relocs[i].offset, ptr->relocs[i].offset,
ptr->relocs[i].symbol->name, ptr->relocs[i].symbol->name,
ptr->relocs[i].addend); ptr->relocs[i].addend);
nl(); nl ();
} }
tab(-1);
tab (-1);
} }
void void
@ -440,17 +450,17 @@ coff_dump (ptr)
struct coff_ofile *ptr; struct coff_ofile *ptr;
{ {
int i; int i;
printf ("Coff dump"); printf ("Coff dump");
nl (); nl ();
printf ("#souces %d", ptr->nsources); printf ("#souces %d", ptr->nsources);
nl (); nl ();
dump_coff_sfile (ptr->source_head); dump_coff_sfile (ptr->source_head);
for (i = 0; i < ptr->nsections; i++) for (i = 0; i < ptr->nsections; i++)
dump_coff_section(ptr->sections + i); dump_coff_section (ptr->sections + i);
} }
char * program_name; char * program_name;
static void static void
@ -458,19 +468,19 @@ show_usage (file, status)
FILE *file; FILE *file;
int status; 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 Display the program's version\n\
\n"));
if (status == 0)
fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status); 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 int
main (ac, av) main (ac, av)
int ac; int ac;
@ -500,24 +510,25 @@ main (ac, av)
program_name = av[0]; program_name = av[0];
xmalloc_set_program_name (program_name); 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)) (int *) NULL))
!= EOF) != EOF)
{ {
switch (opt) switch (opt)
{ {
case 'H':
case 'h': case 'h':
show_help (); show_usage (stdout, 0);
/*NOTREACHED*/ break;
case 'v':
case 'V': case 'V':
print_version ("coffdump"); print_version ("coffdump");
exit (0); exit (0);
/*NOTREACHED*/
case 0: case 0:
break; break;
default: default:
show_usage (stderr, 1); show_usage (stderr, 1);
/*NOTREACHED*/ break;
} }
} }
@ -527,9 +538,8 @@ main (ac, av)
} }
if (!input_file) if (!input_file)
{ fatal (_("no input file specified"));
fatal (_("no input file specified"));
}
abfd = bfd_openr (input_file, 0); abfd = bfd_openr (input_file, 0);
if (!abfd) if (!abfd)
@ -538,6 +548,7 @@ main (ac, av)
if (! bfd_check_format_matches (abfd, bfd_object, &matching)) if (! bfd_check_format_matches (abfd, bfd_object, &matching))
{ {
bfd_nonfatal (input_file); bfd_nonfatal (input_file);
if (bfd_get_error () == bfd_error_file_ambiguously_recognized) if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
{ {
list_matching_formats (matching); list_matching_formats (matching);
@ -548,7 +559,8 @@ main (ac, av)
tree = coff_grok (abfd); tree = coff_grok (abfd);
coff_dump(tree); coff_dump (tree);
printf("\n"); printf ("\n");
return 0; return 0;
} }

View File

@ -3135,7 +3135,7 @@ usage (file, status)
int status; int status;
{ {
/* xgetext:c-format */ /* 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 */ /* xgetext:c-format */
fprintf (file, _(" -m --machine <machine> Create as DLL for <machine>. [default: %s]\n"), mname); 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")); fprintf (file, _(" possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n"));
@ -3228,9 +3228,9 @@ main (ac, av)
while ((c = getopt_long (ac, av, while ((c = getopt_long (ac, av,
#ifdef DLLTOOL_MCORE_ELF #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 #else
"m:e:l:aD:d:z:b:xcCuUkAS:f:nvVh", "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHh",
#endif #endif
long_options, 0)) long_options, 0))
!= EOF) != EOF)
@ -3280,6 +3280,7 @@ main (ac, av)
case 'e': case 'e':
exp_name = optarg; exp_name = optarg;
break; break;
case 'H':
case 'h': case 'h':
usage (stdout, 0); usage (stdout, 0);
break; break;

View File

@ -1,5 +1,5 @@
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs /* 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). Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -516,7 +516,7 @@ usage (file, status)
FILE *file; FILE *file;
int status; 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, _(" Generic options:\n"));
fprintf (file, _(" --quiet, -q Work quietly\n")); fprintf (file, _(" --quiet, -q Work quietly\n"));
fprintf (file, _(" --verbose, -v Verbose\n")); fprintf (file, _(" --verbose, -v Verbose\n"));

View File

@ -1,22 +1,22 @@
/* nlmconv.c -- NLM conversion program /* 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. 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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Ian Lance Taylor <ian@cygnus.com>. /* Written by Ian Lance Taylor <ian@cygnus.com>.
@ -122,7 +122,6 @@ static struct option long_options[] =
/* Local routines. */ /* Local routines. */
static void show_help PARAMS ((void));
static void show_usage PARAMS ((FILE *, int)); static void show_usage PARAMS ((FILE *, int));
static const char *select_output_format PARAMS ((enum bfd_architecture, static const char *select_output_format PARAMS ((enum bfd_architecture,
unsigned long, boolean)); unsigned long, boolean));
@ -226,7 +225,7 @@ main (argc, argv)
bfd_init (); bfd_init ();
set_default_bfd_target (); 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)) (int *) NULL))
!= EOF) != EOF)
{ {
@ -235,9 +234,10 @@ main (argc, argv)
case 'd': case 'd':
debug = 1; debug = 1;
break; break;
case 'H':
case 'h': case 'h':
show_help (); show_usage (stdout, 0);
/*NOTREACHED*/ break;
case 'I': case 'I':
input_format = optarg; input_format = optarg;
break; break;
@ -250,14 +250,15 @@ main (argc, argv)
case 'T': case 'T':
header_file = optarg; header_file = optarg;
break; break;
case 'v':
case 'V': case 'V':
print_version ("nlmconv"); print_version ("nlmconv");
/*NOTREACHED*/ break;
case 0: case 0:
break; break;
default: default:
show_usage (stderr, 1); show_usage (stderr, 1);
/*NOTREACHED*/ break;
} }
} }
@ -1093,15 +1094,6 @@ main (argc, argv)
return 0; return 0;
} }
/* 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. */ /* Show a usage message and exit. */
@ -1110,13 +1102,17 @@ show_usage (file, status)
FILE *file; FILE *file;
int status; int status;
{ {
fprintf (file, _("\ fprintf (file, _("Usage: %s [option(s)] [in-file [out-file]]\n"), program_name);
Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n\ fprintf (file, _(" Convert an object file into a NetWare Loadable Module\n"));
[--input-target=bfdname] [--output-target=bfdname]\n\ fprintf (file, _(" The options are:\n\
[--header-file=file] [--linker=linker] [--debug]\n\ -I --input-target=<bfdname> Set the input binary file format\n\
[--help] [--version]\n\ -O --output-target=<bfdname> Set the output binary file format\n\
[in-file [out-file]]\n"), -T --header-file=<file> Read <file> for NLM header information\n\
program_name); -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) if (status == 0)
fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status); exit (status);

View File

@ -297,9 +297,9 @@ usage (stream, status)
FILE *stream; FILE *stream;
int status; int status;
{ {
fprintf (stream, _("Usage: %s [OPTION]... [FILE]...\n"), program_name); fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
fprintf (stream, _("List symbols from FILEs (a.out by default).\n")); fprintf (stream, _(" List symbols in [file(s)] (a.out by default).\n"));
fprintf (stream, _("\n\ fprintf (stream, _(" The options are:\n\
-a, --debug-syms Display debugger-only symbols\n\ -a, --debug-syms Display debugger-only symbols\n\
-A, --print-file-name Print name of the input file before every symbol\n\ -A, --print-file-name Print name of the input file before every symbol\n\
-B Same as --format=bsd\n\ -B Same as --format=bsd\n\
@ -313,7 +313,6 @@ usage (stream, status)
-f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n\ -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n\
`sysv' or `posix'. The default is `bsd'\n\ `sysv' or `posix'. The default is `bsd'\n\
-g, --extern-only Display only external symbols\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\ -l, --line-numbers Use debugging information to find a filename and\n\
line number for each symbol\n\ line number for each symbol\n\
-n, --numeric-sort Sort symbols numerically by address\n\ -n, --numeric-sort Sort symbols numerically by address\n\
@ -326,8 +325,9 @@ usage (stream, status)
-t, --radix=RADIX Use RADIX for printing symbol values\n\ -t, --radix=RADIX Use RADIX for printing symbol values\n\
--target=BFDNAME Specify the target object format as BFDNAME\n\ --target=BFDNAME Specify the target object format as BFDNAME\n\
-u, --undefined-only Display only undefined symbols\n\ -u, --undefined-only Display only undefined symbols\n\
-V, --version Display this program's version number\n\
-X 32_64 (ignored)\n\ -X 32_64 (ignored)\n\
-h, --help Display this information\n\
-V, --version Display this program's version number\n\
\n")); \n"));
list_supported_targets (program_name, stream); list_supported_targets (program_name, stream);
if (status == 0) if (status == 0)
@ -421,7 +421,7 @@ main (argc, argv)
bfd_init (); bfd_init ();
set_default_bfd_target (); 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) long_options, (int *) 0)) != EOF)
{ {
switch (c) switch (c)
@ -462,6 +462,7 @@ main (argc, argv)
case 'g': case 'g':
external_only = 1; external_only = 1;
break; break;
case 'H':
case 'h': case 'h':
usage (stdout, 0); usage (stdout, 0);
case 'l': case 'l':

View File

@ -360,7 +360,8 @@ copy_usage (stream, exit_status)
FILE *stream; FILE *stream;
int exit_status; 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, _(" The options are:\n"));
fprintf (stream, _("\ fprintf (stream, _("\
-I --input-target <bfdname> Assume input file is in format <bfdname>\n\ -I --input-target <bfdname> Assume input file is in format <bfdname>\n\
@ -429,19 +430,20 @@ strip_usage (stream, exit_status)
FILE *stream; FILE *stream;
int exit_status; 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, _(" The options are:\n"));
fprintf (stream, _("\ fprintf (stream, _("\
-I --input-target <bfdname> Assume input file is in format <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\ -O --output-target=<bfdname> Create an output file in format <bfdname>\n\
-F --target <bfdname> Set both input and output format to <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\ -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\ -s --strip-all Remove all symbol and relocation information\n\
-g -S --strip-debug Remove all debugging symbols\n\ -g -S --strip-debug Remove all debugging symbols\n\
--strip-unneeded Remove all symbols not needed by relocations\n\ --strip-unneeded Remove all symbols not needed by relocations\n\
-N --strip-symbol <name> Do not copy symbol <name>\n\ -N --strip-symbol=<name> Do not copy symbol <name>\n\
-K --keep-symbol <name> Only copy symbol <name>\n\ -K --keep-symbol=<name> Only copy symbol <name>\n\
-x --discard-all Remove all non-global symbols\n\ -x --discard-all Remove all non-global symbols\n\
-X --discard-locals Remove any compiler-generated symbols\n\ -X --discard-locals Remove any compiler-generated symbols\n\
-v --verbose List all object files modified\n\ -v --verbose List all object files modified\n\
@ -1947,7 +1949,7 @@ strip_main (argc, argv)
struct section_list *p; struct section_list *p;
char *output_file = NULL; 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) strip_options, (int *) 0)) != EOF)
{ {
switch (c) switch (c)
@ -2004,6 +2006,7 @@ strip_main (argc, argv)
case 0: case 0:
/* We've been given a long option. */ /* We've been given a long option. */
break; break;
case 'H':
case 'h': case 'h':
strip_usage (stdout, 0); strip_usage (stdout, 0);
default: default:
@ -2081,7 +2084,7 @@ copy_main (argc, argv)
struct section_list *p; struct section_list *p;
struct stat statbuf; 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) copy_options, (int *) 0)) != EOF)
{ {
switch (c) switch (c)
@ -2497,6 +2500,7 @@ copy_main (argc, argv)
case 0: case 0:
break; /* we've been given a long option */ break; /* we've been given a long option */
case 'H':
case 'h': case 'h':
copy_usage (stdout, 0); copy_usage (stdout, 0);

View File

@ -161,9 +161,9 @@ usage (stream, status)
FILE *stream; FILE *stream;
int status; int status;
{ {
fprintf (stream, _("Usage: %s OPTION... FILE...\n"), program_name); fprintf (stream, _("Usage: %s <option(s)> <file(s)>\n"), program_name);
fprintf (stream, _("Display information from object FILE.\n")); fprintf (stream, _(" Display information from object <file(s)>.\n"));
fprintf (stream, _("\n At least one of the following switches must be given:\n")); fprintf (stream, _(" At least one of the following switches must be given:\n"));
fprintf (stream, _("\ fprintf (stream, _("\
-a, --archive-headers Display archive header information\n\ -a, --archive-headers Display archive header information\n\
-f, --file-headers Display the contents of the overall file header\n\ -f, --file-headers Display the contents of the overall file header\n\
@ -180,7 +180,7 @@ usage (stream, status)
-T, --dynamic-syms Display the contents of the dynamic symbol table\n\ -T, --dynamic-syms Display the contents of the dynamic symbol table\n\
-r, --reloc Display the relocation entries in the file\n\ -r, --reloc Display the relocation entries in the file\n\
-R, --dynamic-reloc Display the dynamic 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\ -i, --info List object formats and architectures supported\n\
-H, --help Display this information\n\ -H, --help Display this information\n\
")); "));
@ -2766,14 +2766,14 @@ main (argc, argv)
bfd_init (); bfd_init ();
set_default_bfd_target (); 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)) long_options, (int *) 0))
!= EOF) != EOF)
{ {
switch (c) switch (c)
{ {
case 0: case 0:
break; /* we've been given a long option */ break; /* We've been given a long option. */
case 'm': case 'm':
machine = optarg; machine = optarg;
break; break;
@ -2794,12 +2794,12 @@ main (argc, argv)
if (optarg != NULL) if (optarg != NULL)
{ {
enum demangling_styles style; enum demangling_styles style;
style = cplus_demangle_name_to_style (optarg); style = cplus_demangle_name_to_style (optarg);
if (style == unknown_demangling) if (style == unknown_demangling)
fatal (_("unknown demangling style `%s'"), fatal (_("unknown demangling style `%s'"),
optarg); optarg);
cplus_demangle_set_style (style); cplus_demangle_set_style (style);
} }
break; break;
@ -2837,7 +2837,7 @@ main (argc, argv)
usage (stderr, 1); usage (stderr, 1);
} }
break; break;
case 'f': case 'f':
dump_file_header = true; dump_file_header = true;
seenflag = true; seenflag = true;
@ -2915,6 +2915,7 @@ main (argc, argv)
case 'H': case 'H':
usage (stdout, 0); usage (stdout, 0);
seenflag = true; seenflag = true;
case 'v':
case 'V': case 'V':
show_version = true; show_version = true;
seenflag = true; seenflag = true;

View File

@ -2151,35 +2151,38 @@ struct option options [] =
static void static void
usage () usage ()
{ {
fprintf (stdout, _("Usage: readelf {options} elf-file(s)\n")); fprintf (stdout, _("Usage: readelf <option(s)> elf-file(s)\n"));
fprintf (stdout, _(" Options are:\n")); fprintf (stdout, _(" Display information about the contents of ELF format files\n"));
fprintf (stdout, _(" -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n")); fprintf (stdout, _(" Options are:\n\
fprintf (stdout, _(" -h or --file-header Display the ELF file header\n")); -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n\
fprintf (stdout, _(" -l or --program-headers or --segments\n")); -h --file-header Display the ELF file header\n\
fprintf (stdout, _(" Display the program headers\n")); -l --program-headers Display the program headers\n\
fprintf (stdout, _(" -S or --section-headers or --sections\n")); --segments An alias for --program-headers\n\
fprintf (stdout, _(" Display the sections' header\n")); -S --section-headers Display the sections' header\n\
fprintf (stdout, _(" -e or --headers Equivalent to: -h -l -S\n")); --sections An alias for --section-headers\n\
fprintf (stdout, _(" -s or --syms or --symbols Display the symbol table\n")); -e --headers Equivalent to: -h -l -S\n\
fprintf (stdout, _(" -n or --notes Display the core notes (if present)\n")); -s --syms Display the symbol table\n\
fprintf (stdout, _(" -r or --relocs Display the relocations (if present)\n")); --symbols An alias for --syms\n\
fprintf (stdout, _(" -u or --unwind Display the unwind info (if present)\n")); -n --notes Display the core notes (if present)\n\
fprintf (stdout, _(" -d or --dynamic Display the dynamic segment (if present)\n")); -r --relocs Display the relocations (if present)\n\
fprintf (stdout, _(" -V or --version-info Display the version sections (if present)\n")); -u --unwind Display the unwind info (if present)\n\
fprintf (stdout, _(" -A or --arch-specific Display architecture specific information (if any).\n")); -d --dynamic Display the dynamic segment (if present)\n\
fprintf (stdout, _(" -D or --use-dynamic Use the dynamic section info when displaying symbols\n")); -V --version-info Display the version sections (if present)\n\
fprintf (stdout, _(" -x <number> or --hex-dump=<number>\n")); -A --arch-specific Display architecture specific information (if any).\n\
fprintf (stdout, _(" Dump the contents of section <number>\n")); -D --use-dynamic Use the dynamic section info when displaying symbols\n\
fprintf (stdout, _(" -w[liaprmfs] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n")); -x --hex-dump=<number> Dump the contents of section <number>\n\
fprintf (stdout, _(" Display the contents of DWARF2 debug sections\n")); -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n\
Display the contents of DWARF2 debug sections\n"));
#ifdef SUPPORT_DISASSEMBLY #ifdef SUPPORT_DISASSEMBLY
fprintf (stdout, _(" -i <number> or --instruction-dump=<number>\n")); fprintf (stdout, _("\
fprintf (stdout, _(" Disassemble the contents of section <number>\n")); -i --instruction-dump=<number>\n\
Disassemble the contents of section <number>\n"));
#endif #endif
fprintf (stdout, _(" -I or --histogram Display histogram of bucket list lengths\n")); fprintf (stdout, _("\
fprintf (stdout, _(" -v or --version Display the version number of readelf\n")); -I --histogram Display histogram of bucket list lengths\n\
fprintf (stdout, _(" -W or --wide Don't split lines or truncate symbols to fit into 80 columns\n")); -W --wide Allow output width to exceed 80 characters\n\
fprintf (stdout, _(" -H or --help Display this information\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); fprintf (stdout, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (0); exit (0);

View File

@ -1,5 +1,5 @@
/* size.c -- report size of various sections of an executable file. /* 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. Free Software Foundation, Inc.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -76,16 +76,22 @@ usage (stream, status)
FILE *stream; FILE *stream;
int status; int status;
{ {
fprintf (stream, _("\ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n\ fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
[-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n\ fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
[-V | --version] [--target=bfdname] [--help] [file...]\n"), fprintf (stream, _(" The options are:\n\
program_name); -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 #if BSD_DEFAULT
fputs (_("default is --format=berkeley\n"), stream); "berkeley"
#else #else
fputs (_("default is --format=sysv\n"), stream); "sysv"
#endif #endif
);
list_supported_targets (program_name, stream); list_supported_targets (program_name, stream);
if (status == 0) if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO); fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
@ -127,7 +133,7 @@ main (argc, argv)
bfd_init (); bfd_init ();
set_default_bfd_target (); 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) (int *) 0)) != EOF)
switch (c) switch (c)
{ {
@ -181,6 +187,7 @@ main (argc, argv)
case 'B': case 'B':
berkeley_format = 1; berkeley_format = 1;
break; break;
case 'v':
case 'V': case 'V':
show_version = 1; show_version = 1;
break; break;
@ -205,6 +212,8 @@ main (argc, argv)
break; break;
case 0: case 0:
break; break;
case 'h':
case 'H':
case '?': case '?':
usage (stderr, 1); usage (stderr, 1);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* strings -- print the strings of printable characters in files /* strings -- print the strings of printable characters in files
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
Free Software Foundation, Inc. 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -176,7 +176,7 @@ main (argc, argv)
target = NULL; target = NULL;
encoding = 's'; 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) long_options, (int *) 0)) != EOF)
{ {
switch (optc) switch (optc)
@ -189,6 +189,7 @@ main (argc, argv)
print_filenames = true; print_filenames = true;
break; break;
case 'H':
case 'h': case 'h':
usage (stdout, 0); usage (stdout, 0);
@ -238,6 +239,7 @@ main (argc, argv)
encoding = optarg[0]; encoding = optarg[0];
break; break;
case 'V':
case 'v': case 'v':
print_version ("strings"); print_version ("strings");
break; break;
@ -645,11 +647,20 @@ usage (stream, status)
FILE *stream; FILE *stream;
int status; int status;
{ {
fprintf (stream, _("\ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-e {s,b,l,B,L}]\n\ fprintf (stream, _(" Display printable strings in [file(s)] (stdin by default)\n"));
[-] [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n\ fprintf (stream, _(" The options are:\n\
[--target=bfdname] [--encoding {s,b,l,B,L}] [--help] [--version] file...\n"), -a - --all Scan the entire file, not just the data section\n\
program_name); -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); list_supported_targets (program_name, stream);
if (status == 0) if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO); fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);

View File

@ -1,5 +1,6 @@
/* Sysroff object format dumper. /* 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. This file is part of GNU Binutils.
@ -22,7 +23,7 @@
/* Written by Steve Chamberlain <sac@cygnus.com>. /* Written by Steve Chamberlain <sac@cygnus.com>.
This program reads a SYSROFF object file and prints it in an 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 "bfd.h"
#include "bucomm.h" #include "bucomm.h"
@ -52,7 +53,6 @@ static void dump_symbol_info PARAMS ((void));
static void derived_type PARAMS ((void)); static void derived_type PARAMS ((void));
static void module PARAMS ((void)); static void module PARAMS ((void));
static void show_usage PARAMS ((FILE *, int)); static void show_usage PARAMS ((FILE *, int));
static void show_help PARAMS ((void));
extern char *getCHARS PARAMS ((unsigned char *, int *, int, int)); extern char *getCHARS PARAMS ((unsigned char *, int *, int, int));
extern int fillup PARAMS ((char *)); extern int fillup PARAMS ((char *));
@ -73,14 +73,13 @@ getCHARS (ptr, idx, size, max)
int oc = *idx / 8; int oc = *idx / 8;
char *r; char *r;
int b = size; int b = size;
if (b >= max) if (b >= max)
{ return "*undefined*";
return "*undefined*";
}
if (b == 0) 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++]; b = ptr[oc++];
(*idx) += 8; (*idx) += 8;
} }
@ -89,6 +88,7 @@ getCHARS (ptr, idx, size, max)
r = xcalloc (b + 1, 1); r = xcalloc (b + 1, 1);
memcpy (r, ptr + oc, b); memcpy (r, ptr + oc, b);
r[b] = 0; r[b] = 0;
return r; return r;
} }
@ -116,10 +116,12 @@ dh (ptr, size)
for (j = 0; j < span && j + i < size; j++) for (j = 0; j < span && j + i < size; j++)
{ {
int c = ptr[i + j]; int c = ptr[i + j];
if (c < 32 || c > 127) if (c < 32 || c > 127)
c = '.'; c = '.';
printf ("%c", c); printf ("%c", c);
} }
printf ("\n"); printf ("\n");
} }
} }
@ -131,18 +133,17 @@ fillup (ptr)
int size; int size;
int sum; int sum;
int i; int i;
size = getc (file) - 2; size = getc (file) - 2;
fread (ptr, 1, size, file); fread (ptr, 1, size, file);
sum = code + size + 2; sum = code + size + 2;
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
{ sum += ptr[i];
sum += ptr[i];
}
if ((sum & 0xff) != 0xff) if ((sum & 0xff) != 0xff)
{ printf ("SUM IS %x\n", sum);
printf ("SUM IS %x\n", sum);
}
if (dump) if (dump)
dh (ptr, size); dh (ptr, size);
@ -160,12 +161,13 @@ getBARRAY (ptr, idx, dsize, max)
int i; int i;
int byte = *idx / 8; int byte = *idx / 8;
int size = ptr[byte++]; int size = ptr[byte++];
res.len = size; res.len = size;
res.data = (unsigned char *) xmalloc (size); res.data = (unsigned char *) xmalloc (size);
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
{ res.data[i] = ptr[byte++];
res.data[i] = ptr[byte++];
}
return res; return res;
} }
@ -180,13 +182,14 @@ getINT (ptr, idx, size, max)
int byte = *idx / 8; int byte = *idx / 8;
if (byte >= max) if (byte >= max)
{ return 0;
return 0;
}
if (size == -2) if (size == -2)
size = addrsize; size = addrsize;
if (size == -1) if (size == -1)
size = 0; size = 0;
switch (size) switch (size)
{ {
case 0: case 0:
@ -203,6 +206,7 @@ getINT (ptr, idx, size, max)
default: default:
abort (); abort ();
} }
*idx += size * 8; *idx += size * 8;
return n; return n;
} }
@ -233,14 +237,15 @@ itheader (name, code)
} }
static int indent; static int indent;
static void static void
p () p ()
{ {
int i; int i;
for (i = 0; i < indent; i++) for (i = 0; i < indent; i++)
{ printf ("| ");
printf ("| ");
}
printf ("> "); printf ("> ");
} }
@ -255,12 +260,13 @@ pbarray (y)
barray *y; barray *y;
{ {
int x; int x;
printf ("%d (", y->len); printf ("%d (", y->len);
for (x = 0; x < y->len; x++) for (x = 0; x < y->len; x++)
{ printf ("(%02x %c)", y->data[x],
printf ("(%02x %c)", y->data[x], ISPRINT (y->data[x]) ? y->data[x] : '.');
ISPRINT (y->data[x]) ? y->data[x] : '.');
}
printf (")\n"); printf (")\n");
} }
@ -269,27 +275,26 @@ pbarray (y)
#include "sysroff.c" #include "sysroff.c"
/* /* FIXME: sysinfo, which generates sysroff.[ch] from sysroff.info, can't
* 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
* 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
* implement our own functions for reading in and printing out the tr block. */
* block.
*/
#define IT_tr_CODE 0x7f #define IT_tr_CODE 0x7f
void void
sysroff_swap_tr_in() sysroff_swap_tr_in()
{ {
char raw[255]; char raw[255];
memset(raw, 0, 255); memset (raw, 0, 255);
fillup(raw); fillup (raw);
} }
void void
sysroff_print_tr_out() sysroff_print_tr_out()
{ {
itheader("tr", IT_tr_CODE); itheader ("tr", IT_tr_CODE);
} }
static int static int
@ -297,6 +302,7 @@ getone (type)
int type; int type;
{ {
int c = getc (file); int c = getc (file);
code = c; code = c;
if ((c & 0x7f) != type) if ((c & 0x7f) != type)
@ -314,6 +320,7 @@ getone (type)
sysroff_print_cs_out (&dummy); sysroff_print_cs_out (&dummy);
} }
break; break;
case IT_dln_CODE: case IT_dln_CODE:
{ {
struct IT_dln dummy; struct IT_dln dummy;
@ -321,6 +328,7 @@ getone (type)
sysroff_print_dln_out (&dummy); sysroff_print_dln_out (&dummy);
} }
break; break;
case IT_hd_CODE: case IT_hd_CODE:
{ {
struct IT_hd dummy; struct IT_hd dummy;
@ -329,6 +337,7 @@ getone (type)
sysroff_print_hd_out (&dummy); sysroff_print_hd_out (&dummy);
} }
break; break;
case IT_dar_CODE: case IT_dar_CODE:
{ {
struct IT_dar dummy; struct IT_dar dummy;
@ -336,6 +345,7 @@ getone (type)
sysroff_print_dar_out (&dummy); sysroff_print_dar_out (&dummy);
} }
break; break;
case IT_dsy_CODE: case IT_dsy_CODE:
{ {
struct IT_dsy dummy; struct IT_dsy dummy;
@ -343,6 +353,7 @@ getone (type)
sysroff_print_dsy_out (&dummy); sysroff_print_dsy_out (&dummy);
} }
break; break;
case IT_dfp_CODE: case IT_dfp_CODE:
{ {
struct IT_dfp dummy; struct IT_dfp dummy;
@ -350,6 +361,7 @@ getone (type)
sysroff_print_dfp_out (&dummy); sysroff_print_dfp_out (&dummy);
} }
break; break;
case IT_dso_CODE: case IT_dso_CODE:
{ {
struct IT_dso dummy; struct IT_dso dummy;
@ -357,6 +369,7 @@ getone (type)
sysroff_print_dso_out (&dummy); sysroff_print_dso_out (&dummy);
} }
break; break;
case IT_dpt_CODE: case IT_dpt_CODE:
{ {
struct IT_dpt dummy; struct IT_dpt dummy;
@ -364,6 +377,7 @@ getone (type)
sysroff_print_dpt_out (&dummy); sysroff_print_dpt_out (&dummy);
} }
break; break;
case IT_den_CODE: case IT_den_CODE:
{ {
struct IT_den dummy; struct IT_den dummy;
@ -371,6 +385,7 @@ getone (type)
sysroff_print_den_out (&dummy); sysroff_print_den_out (&dummy);
} }
break; break;
case IT_dbt_CODE: case IT_dbt_CODE:
{ {
struct IT_dbt dummy; struct IT_dbt dummy;
@ -378,6 +393,7 @@ getone (type)
sysroff_print_dbt_out (&dummy); sysroff_print_dbt_out (&dummy);
} }
break; break;
case IT_dty_CODE: case IT_dty_CODE:
{ {
struct IT_dty dummy; struct IT_dty dummy;
@ -385,6 +401,7 @@ getone (type)
sysroff_print_dty_out (&dummy); sysroff_print_dty_out (&dummy);
} }
break; break;
case IT_un_CODE: case IT_un_CODE:
{ {
struct IT_un dummy; struct IT_un dummy;
@ -392,6 +409,7 @@ getone (type)
sysroff_print_un_out (&dummy); sysroff_print_un_out (&dummy);
} }
break; break;
case IT_sc_CODE: case IT_sc_CODE:
{ {
struct IT_sc dummy; struct IT_sc dummy;
@ -399,6 +417,7 @@ getone (type)
sysroff_print_sc_out (&dummy); sysroff_print_sc_out (&dummy);
} }
break; break;
case IT_er_CODE: case IT_er_CODE:
{ {
struct IT_er dummy; struct IT_er dummy;
@ -406,6 +425,7 @@ getone (type)
sysroff_print_er_out (&dummy); sysroff_print_er_out (&dummy);
} }
break; break;
case IT_ed_CODE: case IT_ed_CODE:
{ {
struct IT_ed dummy; struct IT_ed dummy;
@ -413,6 +433,7 @@ getone (type)
sysroff_print_ed_out (&dummy); sysroff_print_ed_out (&dummy);
} }
break; break;
case IT_sh_CODE: case IT_sh_CODE:
{ {
struct IT_sh dummy; struct IT_sh dummy;
@ -420,6 +441,7 @@ getone (type)
sysroff_print_sh_out (&dummy); sysroff_print_sh_out (&dummy);
} }
break; break;
case IT_ob_CODE: case IT_ob_CODE:
{ {
struct IT_ob dummy; struct IT_ob dummy;
@ -427,6 +449,7 @@ getone (type)
sysroff_print_ob_out (&dummy); sysroff_print_ob_out (&dummy);
} }
break; break;
case IT_rl_CODE: case IT_rl_CODE:
{ {
struct IT_rl dummy; struct IT_rl dummy;
@ -434,6 +457,7 @@ getone (type)
sysroff_print_rl_out (&dummy); sysroff_print_rl_out (&dummy);
} }
break; break;
case IT_du_CODE: case IT_du_CODE:
{ {
struct IT_du dummy; struct IT_du dummy;
@ -442,6 +466,7 @@ getone (type)
sysroff_print_du_out (&dummy); sysroff_print_du_out (&dummy);
} }
break; break;
case IT_dus_CODE: case IT_dus_CODE:
{ {
struct IT_dus dummy; struct IT_dus dummy;
@ -449,6 +474,7 @@ getone (type)
sysroff_print_dus_out (&dummy); sysroff_print_dus_out (&dummy);
} }
break; break;
case IT_dul_CODE: case IT_dul_CODE:
{ {
struct IT_dul dummy; struct IT_dul dummy;
@ -456,6 +482,7 @@ getone (type)
sysroff_print_dul_out (&dummy); sysroff_print_dul_out (&dummy);
} }
break; break;
case IT_dss_CODE: case IT_dss_CODE:
{ {
struct IT_dss dummy; struct IT_dss dummy;
@ -463,6 +490,7 @@ getone (type)
sysroff_print_dss_out (&dummy); sysroff_print_dss_out (&dummy);
} }
break; break;
case IT_hs_CODE: case IT_hs_CODE:
{ {
struct IT_hs dummy; struct IT_hs dummy;
@ -470,6 +498,7 @@ getone (type)
sysroff_print_hs_out (&dummy); sysroff_print_hs_out (&dummy);
} }
break; break;
case IT_dps_CODE: case IT_dps_CODE:
{ {
struct IT_dps dummy; struct IT_dps dummy;
@ -477,24 +506,27 @@ getone (type)
sysroff_print_dps_out (&dummy); sysroff_print_dps_out (&dummy);
} }
break; break;
case IT_tr_CODE: case IT_tr_CODE:
{ sysroff_swap_tr_in ();
sysroff_swap_tr_in (); sysroff_print_tr_out ();
sysroff_print_tr_out ();
}
break; break;
case IT_dds_CODE: case IT_dds_CODE:
{ {
struct IT_dds dummy; struct IT_dds dummy;
sysroff_swap_dds_in (&dummy); sysroff_swap_dds_in (&dummy);
sysroff_print_dds_out (&dummy); sysroff_print_dds_out (&dummy);
} }
break; break;
default: default:
printf ("GOT A %x\n", c); printf ("GOT A %x\n", c);
return 0; return 0;
break; break;
} }
return 1; return 1;
} }
@ -552,9 +584,7 @@ must (x)
int x; int x;
{ {
if (!getone (x)) if (!getone (x))
{ printf ("WANTED %x!!\n", x);
printf ("WANTED %x!!\n", x);
}
} }
static void static void
@ -563,6 +593,7 @@ tab (i, s)
char *s; char *s;
{ {
indent += i; indent += i;
if (s) if (s)
{ {
p (); p ();
@ -575,6 +606,7 @@ static void
dump_symbol_info () dump_symbol_info ()
{ {
tab (1, "SYMBOL INFO"); tab (1, "SYMBOL INFO");
while (opt (IT_dsy_CODE)) while (opt (IT_dsy_CODE))
{ {
if (opt (IT_dty_CODE)) if (opt (IT_dty_CODE))
@ -584,6 +616,7 @@ dump_symbol_info ()
must (IT_dty_CODE); must (IT_dty_CODE);
} }
} }
tab (-1, ""); tab (-1, "");
} }
@ -591,6 +624,7 @@ static void
derived_type () derived_type ()
{ {
tab (1, "DERIVED TYPE"); tab (1, "DERIVED TYPE");
while (1) while (1)
{ {
if (opt (IT_dpp_CODE)) if (opt (IT_dpp_CODE))
@ -730,16 +764,15 @@ show_usage (file, status)
FILE *file; FILE *file;
int status; int status;
{ {
fprintf (file, _("Usage: %s [-hV] in-file\n"), program_name); fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name);
exit (status); 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"));
static void if (status == 0)
show_help () fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
{ exit (status);
printf (_("%s: Print a human readable interpretation of a SYSROFF object file\n"),
program_name);
show_usage (stdout, 0);
} }
int int
@ -768,13 +801,15 @@ main (ac, av)
program_name = av[0]; program_name = av[0];
xmalloc_set_program_name (program_name); 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) switch (opt)
{ {
case 'H':
case 'h': case 'h':
show_help (); show_usage (stdout, 0);
/*NOTREACHED*/ /*NOTREACHED*/
case 'v':
case 'V': case 'V':
print_version ("sysdump"); print_version ("sysdump");
exit (0); exit (0);
@ -790,20 +825,15 @@ main (ac, av)
/* The input and output files may be named on the command line. */ /* The input and output files may be named on the command line. */
if (optind < ac) if (optind < ac)
{ input_file = av[optind];
input_file = av[optind];
}
if (!input_file) if (!input_file)
{ fatal (_("no input file specified"));
fatal (_("no input file specified"));
}
file = fopen (input_file, FOPEN_RB); file = fopen (input_file, FOPEN_RB);
if (!file) if (!file)
{ fatal (_("cannot open input file %s"), input_file);
fatal (_("cannot open input file %s"), input_file);
}
module (); module ();
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* windres.c -- a program to manipulate Windows resources /* 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. Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -638,13 +638,11 @@ format_from_filename (filename, input)
/* If we don't recognize the name of an output file, assume it's a /* If we don't recognize the name of an output file, assume it's a
COFF file. */ COFF file. */
if (! input) if (! input)
return RES_FORMAT_COFF; return RES_FORMAT_COFF;
/* Read the first few bytes of the file to see if we can guess what /* Read the first few bytes of the file to see if we can guess what
it is. */ it is. */
e = fopen (filename, FOPEN_RB); e = fopen (filename, FOPEN_RB);
if (e == NULL) if (e == NULL)
fatal ("%s: %s", filename, strerror (errno)); fatal ("%s: %s", filename, strerror (errno));
@ -701,45 +699,46 @@ usage (stream, status)
FILE *stream; FILE *stream;
int status; 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); program_name);
fprintf (stream, _("\ fprintf (stream, _(" The options are:\n\
Options:\n\ -i --input=<file> Name input file\n\
-i FILE, --input FILE Name input file\n\ -o --output=<file> Name output file\n\
-o FILE, --output FILE Name output file\n\ -I --input-format=<format> Specify input format\n\
-I FORMAT, --input-format FORMAT\n\ -O --output-format=<format> Specify output format\n\
Specify input format\n\ -F --target=<target> Specify COFF target\n\
-O FORMAT, --output-format FORMAT\n\ --preprocessor=<program> Program to use to preprocess rc file\n\
Specify output format\n\ --include-dir=<dir> Include directory when preprocessing rc file\n\
-F TARGET, --target TARGET Specify COFF target\n\ -D --define <sym>[=<val>] Define SYM when preprocessing rc file\n\
--preprocessor PROGRAM Program to use to preprocess rc file\n\ -v --verbose Verbose - tells you what it's doing\n\
--include-dir DIR Include directory when preprocessing rc file\n\ --language=<val> Set language when reading rc file\n\
-DSYM[=VAL], --define SYM[=VAL]\n\ --use-temp-file Use a temporary file instead of popen to read\n\
Define SYM when preprocessing rc file\n\ the preprocessor output\n\
-v Verbose - tells you what it's doing\n\ --no-use-temp-file Use popen (default)\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 #ifdef YYDEBUG
fprintf (stream, _("\ fprintf (stream, _("\
--yydebug Turn on parser debugging\n")); --yydebug Turn on parser debugging\n"));
#endif #endif
fprintf (stream, _("\ fprintf (stream, _("\
--help Print this help message\n\ -h --help Print this help message\n\
--version Print version information\n")); -V --version Print version information\n"));
fprintf (stream, _("\ fprintf (stream, _("\
FORMAT is one of rc, res, or coff, and is deduced from the file name\n\ 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\ 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")); No input-file is stdin, default rc. No output-file is stdout, default rc.\n"));
list_supported_targets (program_name, stream); list_supported_targets (program_name, stream);
if (status == 0) if (status == 0)
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO); fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status); exit (status);
} }
/* Quote characters that will confuse the shell when we run the preprocessor */ /* Quote characters that will confuse the shell when we run the preprocessor. */
static const char *quot (string)
static const char *
quot (string)
const char *string; const char *string;
{ {
static char *buf = 0; static char *buf = 0;
@ -813,7 +812,7 @@ main (argc, argv)
language = -1; language = -1;
use_temp_file = 0; 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) (int *) 0)) != EOF)
{ {
switch (c) switch (c)
@ -916,10 +915,13 @@ main (argc, argv)
break; break;
#endif #endif
case 'h':
case 'H':
case OPTION_HELP: case OPTION_HELP:
usage (stdout, 0); usage (stdout, 0);
break; break;
case 'V':
case OPTION_VERSION: case OPTION_VERSION:
print_version ("windres"); print_version ("windres");
break; break;