2000-08-14 Jason Eckhardt <jle@cygnus.com>
[deliverable/binutils-gdb.git] / binutils / size.c
index 4ed355558798dcdfc412dab9cf0af8977202467e..4cf17b2a59eb1d1aeeb96a066f18205a8b31817f 100644 (file)
@@ -1,5 +1,6 @@
 /* size.c -- report size of various sections of an executable file.
-   Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -76,8 +77,10 @@ usage (stream, status)
      int status;
 {
   fprintf (stream, _("\
-Usage: %s [-ABdoxV] [--format=berkeley|sysv] [--radix=8|10|16]\n\
-       [--target=bfdname] [--version] [--help] [file...]\n"), program_name);
+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);
 #if BSD_DEFAULT
   fputs (_("default is --format=berkeley\n"), stream);
 #else
@@ -85,7 +88,7 @@ Usage: %s [-ABdoxV] [--format=berkeley|sysv] [--radix=8|10|16]\n\
 #endif
   list_supported_targets (program_name, stream);
   if (status == 0)
-    fprintf (stream, _("Report bugs to bug-gnu-utils@gnu.org\n"));
+    fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
   exit (status);
 }
 
@@ -107,13 +110,19 @@ main (argc, argv)
   int temp;
   int c;
 
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+  setlocale (LC_MESSAGES, "");
+#endif
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
+
   program_name = *argv;
   xmalloc_set_program_name (program_name);
 
   bfd_init ();
   set_default_bfd_target ();
 
-  while ((c = getopt_long (argc, argv, "ABVdox", long_options,
+  while ((c = getopt_long (argc, argv, "ABVdfox", long_options,
                           (int *) 0)) != EOF)
     switch (c)
       {
@@ -129,7 +138,7 @@ main (argc, argv)
            berkeley_format = 0;
            break;
          default:
-           fprintf (stderr, _("invalid argument to --format: %s\n"), optarg);
+           non_fatal (_("invalid argument to --format: %s"), optarg);
            usage (stderr, 1);
          }
        break;
@@ -156,7 +165,7 @@ main (argc, argv)
            radix = hex;
            break;
          default:
-           printf (_("Invalid radix: %s\n"), optarg);
+           non_fatal (_("Invalid radix: %s\n"), optarg);
            usage (stderr, 1);
          }
        break;
@@ -179,6 +188,16 @@ main (argc, argv)
       case 'o':
        radix = octal;
        break;
+      case 'f': /* FIXME : For sysv68, `-f' means `full format', i.e.
+                  `[fname:] M(.text) + N(.data) + O(.bss) + P(.comment) = Q'
+                  where `fname: ' appears only if there are >= 2 input files,
+                  and M, N, O, P, Q are expressed in decimal by default,
+                  hexa or octal if requested by `-x' or `-o'.
+                  Just to make things interesting, Solaris also accepts -f,
+                  which prints out the size of each allocatable section, the
+                  name of the section, and the total of the section sizes.  */
+               /* For the moment, accept `-f' silently, and ignore it.  */
+       break;
       case 0:
        break;
       case '?':
@@ -359,9 +378,9 @@ static bfd_size_type textsize;
 
 static void
 berkeley_sum (abfd, sec, ignore)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      sec_ptr sec;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   flagword flags;
   bfd_size_type size;
@@ -426,9 +445,9 @@ int svi_sizelen = 0;
 
 static void
 sysv_internal_sizer (file, sec, ignore)
-     bfd *file;
+     bfd *file ATTRIBUTE_UNUSED;
      sec_ptr sec;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   bfd_size_type size = bfd_section_size (file, sec);
   if (!bfd_is_abs_section (sec)
@@ -447,9 +466,9 @@ sysv_internal_sizer (file, sec, ignore)
 
 static void
 sysv_internal_printer (file, sec, ignore)
-     bfd *file;
+     bfd *file ATTRIBUTE_UNUSED;
      sec_ptr sec;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   bfd_size_type size = bfd_section_size (file, sec);
   if (!bfd_is_abs_section (sec)
This page took 0.027336 seconds and 4 git commands to generate.