/* ar.c - Archive modify and extract.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005
+ 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Binutils.
(bfd *, char **files_to_replace, bfd_boolean quick);
static void print_descr (bfd * abfd);
static void write_archive (bfd *);
-static void ranlib_only (const char *archname);
-static void ranlib_touch (const char *archname);
+static int ranlib_only (const char *archname);
+static int ranlib_touch (const char *archname);
static void usage (int);
\f
/** Globals and flags */
if (is_ranlib)
{
+ int status = 0;
bfd_boolean touch = FALSE;
if (argc < 2
while (arg_index < argc)
{
if (! touch)
- ranlib_only (argv[arg_index]);
+ status |= ranlib_only (argv[arg_index]);
else
- ranlib_touch (argv[arg_index]);
+ status |= ranlib_touch (argv[arg_index]);
++arg_index;
}
- xexit (0);
+ xexit (status);
}
if (argc == 2 && strcmp (argv[1], "-M") == 0)
if ((operation == none || operation == print_table)
&& write_armap == 1)
- {
- ranlib_only (argv[arg_index]);
- xexit (0);
- }
+ xexit (ranlib_only (argv[arg_index]));
if (operation == none)
fatal (_("no operation specified"));
output_filename = NULL;
}
-static void
+static int
ranlib_only (const char *archname)
{
bfd *arch;
if (get_file_size (archname) < 1)
- return;
+ return 1;
write_armap = 1;
arch = open_inarch (archname, (char *) NULL);
if (arch == NULL)
xexit (1);
write_archive (arch);
+ return 0;
}
/* Update the timestamp of the symbol map of an archive. */
-static void
+static int
ranlib_touch (const char *archname)
{
#ifdef __GO32__
char **matching;
if (get_file_size (archname) < 1)
- return;
+ return 1;
f = open (archname, O_RDWR | O_BINARY, 0);
if (f < 0)
{
if (! bfd_close (arch))
bfd_fatal (archname);
#endif
+ return 0;
}
/* Things which are interesting to map over all or some of the files: */