Add support for thin archives.
[deliverable/binutils-gdb.git] / binutils / nlmconv.c
index b7798eba28d317bfbc6116481d767a17478fd693..2fb74bfe0e85057b09c8e055cb9b87646a8f2333 100644 (file)
@@ -1,12 +1,12 @@
 /* nlmconv.c -- NLM conversion program
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    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
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -16,7 +16,9 @@
 
    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.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
 
 /* Written by Ian Lance Taylor <ian@cygnus.com>.
 
@@ -32,9 +34,9 @@
 #endif
 #endif
 
+#include "sysdep.h"
 #include "bfd.h"
 #include "libiberty.h"
-#include "bucomm.h"
 #include "safe-ctype.h"
 
 #include "ansidecl.h"
@@ -53,6 +55,8 @@
 #include "coff/ecoff.h"
 #endif
 
+#include "bucomm.h"
+
 /* If strerror is just a macro, we want to use the one from libiberty
    since it will handle undefined values.  */
 #undef strerror
@@ -210,6 +214,8 @@ main (int argc, char **argv)
   program_name = argv[0];
   xmalloc_set_program_name (program_name);
 
+  expandargv (&argc, &argv);
+
   bfd_init ();
   set_default_bfd_target ();
 
@@ -735,7 +741,7 @@ main (int argc, char **argv)
              || ! bfd_set_section_flags (outbfd, help_section,
                                          SEC_HAS_CONTENTS))
            bfd_fatal (_("help section"));
-         strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+         LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
        }
     }
   if (message_file != NULL)
@@ -757,7 +763,7 @@ main (int argc, char **argv)
              || ! bfd_set_section_flags (outbfd, message_section,
                                          SEC_HAS_CONTENTS))
            bfd_fatal (_("message section"));
-         strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+         LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
        }
     }
   if (modules != NULL)
@@ -793,7 +799,7 @@ main (int argc, char **argv)
              || ! bfd_set_section_flags (outbfd, rpc_section,
                                          SEC_HAS_CONTENTS))
            bfd_fatal (_("rpc section"));
-         strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+         LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
        }
     }
   if (sharelib_file != NULL)
@@ -850,20 +856,20 @@ main (int argc, char **argv)
                  || ! bfd_set_section_flags (outbfd, shared_section,
                                              SEC_HAS_CONTENTS))
                bfd_fatal (_("shared section"));
-             strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+             LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
            }
        }
     }
 
   /* Check whether a version was given.  */
-  if (strncmp (version_hdr->stamp, "VeRsIoN#", 8) != 0)
+  if (!CONST_STRNEQ (version_hdr->stamp, "VeRsIoN#"))
     non_fatal (_("warning: No version number given"));
 
   /* At least for now, always create an extended header, because that
      is what NLMLINK does.  */
-  strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+  LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
 
-  strncpy (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx", 8);
+  LITMEMCPY (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx");
 
   /* If the date was not given, force it in.  */
   if (nlm_version_header (outbfd)->month == 0
@@ -878,7 +884,7 @@ main (int argc, char **argv)
       nlm_version_header (outbfd)->month = ptm->tm_mon + 1;
       nlm_version_header (outbfd)->day = ptm->tm_mday;
       nlm_version_header (outbfd)->year = ptm->tm_year + 1900;
-      strncpy (version_hdr->stamp, "VeRsIoN#", 8);
+      LITMEMCPY (version_hdr->stamp, "VeRsIoN#");
     }
 
 #ifdef NLMCONV_POWERPC
@@ -1103,10 +1109,11 @@ show_usage (FILE *file, int status)
   -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\
+  @<file>                       Read options from <file>.\n\
   -h --help                     Display this information\n\
   -v --version                  Display the program's version\n\
 "));
-  if (status == 0)
+  if (REPORT_BUGS_TO[0] && status == 0)
     fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
   exit (status);
 }
@@ -1744,9 +1751,9 @@ powerpc_build_stubs (bfd *inbfd, bfd *outbfd ATTRIBUTE_UNUSED,
 
       /* Make a new undefined symbol with the same name but without
         the leading `.'.  */
-      newsym = (asymbol *) xmalloc (sizeof (asymbol));
+      newsym = xmalloc (sizeof (asymbol));
       *newsym = *sym;
-      newname = (char *) xmalloc (strlen (bfd_asymbol_name (sym)));
+      newname = xmalloc (strlen (bfd_asymbol_name (sym)));
       strcpy (newname, bfd_asymbol_name (sym) + 1);
       newsym->name = newname;
 
This page took 0.026372 seconds and 4 git commands to generate.