Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
bucomm.h File Reference
#include "ansidecl.h"
#include <stdio.h>
#include <sys/types.h>
#include "bfdver.h"
#include "config.h"
#include <stdarg.h>
#include "fopen-same.h"
#include <errno.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define O_RDONLY   0
#define O_RDWR   2
#define SEEK_SET   0
#define SEEK_CUR   1
#define SEEK_END   2
#define gettext(Msgid)   (Msgid)
#define dgettext(Domainname, Msgid)   (Msgid)
#define dcgettext(Domainname, Msgid, Category)   (Msgid)
#define textdomain(Domainname)   while (0) /* nothing */
#define bindtextdomain(Domainname, Dirname)   while (0) /* nothing */
#define _(String)   (String)
#define N_(String)   (String)
#define BUFSIZE   8192

Functions

char * strchr ()
char * strrchr ()
char * stpcpy (char *, const char *)
char * strstr ()
char * getenv ()
int fprintf (FILE *, const char *,...)
int snprintf (char *, size_t, const char *,...)
int vsnprintf (char *, size_t, const char *, va_list)
char * alloca ()
const char * bfd_get_archive_filename (bfd *)
void bfd_nonfatal (const char *)
void bfd_fatal (const char *) ATTRIBUTE_NORETURN
void report (const char *, va_list) ATTRIBUTE_PRINTF(1
void void fatal (const char *,...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN
void non_fatal (const char *,...) ATTRIBUTE_PRINTF_1
void set_default_bfd_target (void)
void list_matching_formats (char **)
void list_supported_targets (const char *, FILE *)
void list_supported_architectures (const char *, FILE *)
int display_info (void)
void print_arelt_descr (FILE *, bfd *, bfd_boolean)
char * make_tempname (char *)
char * make_tempdir (char *)
bfd_vma parse_vma (const char *, const char *)
off_t get_file_size (const char *)
void mode_string (unsigned long, char *)
void print_version (const char *)
void set_times (const char *, const struct stat *)
int smart_rename (const char *, const char *, int)
void * xmalloc (size_t)
void * xrealloc (void *, size_t)

Variables

int errno
char ** environ
char * program_name

Define Documentation

#define _ (   String)    (String)

Definition at line 168 of file bucomm.h.

#define bindtextdomain (   Domainname,
  Dirname 
)    while (0) /* nothing */

Definition at line 167 of file bucomm.h.

#define BUFSIZE   8192

Definition at line 173 of file bucomm.h.

#define dcgettext (   Domainname,
  Msgid,
  Category 
)    (Msgid)

Definition at line 165 of file bucomm.h.

#define dgettext (   Domainname,
  Msgid 
)    (Msgid)

Definition at line 164 of file bucomm.h.

#define gettext (   Msgid)    (Msgid)

Definition at line 163 of file bucomm.h.

#define N_ (   String)    (String)

Definition at line 169 of file bucomm.h.

#define O_RDONLY   0

Definition at line 106 of file bucomm.h.

#define O_RDWR   2

Definition at line 110 of file bucomm.h.

#define SEEK_CUR   1

Definition at line 117 of file bucomm.h.

#define SEEK_END   2

Definition at line 120 of file bucomm.h.

#define SEEK_SET   0

Definition at line 114 of file bucomm.h.

#define textdomain (   Domainname)    while (0) /* nothing */

Definition at line 166 of file bucomm.h.


Function Documentation

char* alloca ( )
void bfd_fatal ( const char *  )

Definition at line 63 of file bucomm.c.

{
  bfd_nonfatal (string);
  xexit (1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 531 of file bucomm.c.

{
  static size_t curr = 0;
  static char *buf;
  size_t needed;

  assert (abfd != NULL);
  
  if (!abfd->my_archive)
    return bfd_get_filename (abfd);

  needed = (strlen (bfd_get_filename (abfd->my_archive))
           + strlen (bfd_get_filename (abfd)) + 3);
  if (needed > curr)
    {
      if (curr)
       free (buf);
      curr = needed + (needed >> 1);
      buf = bfd_malloc (curr);
      /* If we can't malloc, fail safe by returning just the file name.
        This function is only used when building error messages.  */
      if (!buf)
       {
         curr = 0;
         return bfd_get_filename (abfd);
       }
    }
  sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive),
          bfd_get_filename (abfd));
  return buf;
}

Here is the call graph for this function:

void bfd_nonfatal ( const char *  )

Definition at line 52 of file bucomm.c.

{
  const char *errmsg = bfd_errmsg (bfd_get_error ());

  if (string)
    fprintf (stderr, "%s: %s: %s\n", program_name, string, errmsg);
  else
    fprintf (stderr, "%s: %s\n", program_name, errmsg);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int display_info ( void  )

Definition at line 347 of file bucomm.c.

{
  printf (_("BFD header file version %s\n"), BFD_VERSION_STRING);
  if (! display_target_list () || ! display_target_tables ())
    return 1;
  else
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void void fatal ( const char *  ,
  ... 
)
int fprintf ( FILE *  ,
const char *  ,
  ... 
)
off_t get_file_size ( const char *  )

Definition at line 508 of file bucomm.c.

{
  struct stat statbuf;
  
  if (stat (file_name, &statbuf) < 0)
    {
      if (errno == ENOENT)
       non_fatal (_("'%s': No such file"), file_name);
      else
       non_fatal (_("Warning: could not locate '%s'.  reason: %s"),
                 file_name, strerror (errno));
    }  
  else if (! S_ISREG (statbuf.st_mode))
    non_fatal (_("Warning: '%s' is not an ordinary file"), file_name);
  else
    return statbuf.st_size;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* getenv ( )
void list_matching_formats ( char **  )

Definition at line 119 of file bucomm.c.

{
  fprintf (stderr, _("%s: Matching formats:"), program_name);
  while (*p)
    fprintf (stderr, " %s", *p++);
  fputc ('\n', stderr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void list_supported_architectures ( const char *  ,
FILE *   
)

Definition at line 149 of file bucomm.c.

{
  const char **arch;

  if (name == NULL)
    fprintf (f, _("Supported architectures:"));
  else
    fprintf (f, _("%s: supported architectures:"), name);

  for (arch = bfd_arch_list (); *arch; arch++)
    fprintf (f, " %s", *arch);
  fprintf (f, "\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void list_supported_targets ( const char *  ,
FILE *   
)

Definition at line 130 of file bucomm.c.

{
  int t;
  const char **targ_names = bfd_target_list ();

  if (name == NULL)
    fprintf (f, _("Supported targets:"));
  else
    fprintf (f, _("%s: supported targets:"), name);

  for (t = 0; targ_names[t] != NULL; t++)
    fprintf (f, " %s", targ_names[t]);
  fprintf (f, "\n");
  free (targ_names);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* make_tempdir ( char *  )

Definition at line 465 of file bucomm.c.

{
  char *tmpname = template_in_dir (filename);

#ifdef HAVE_MKDTEMP
  return mkdtemp (tmpname);
#else
  tmpname = mktemp (tmpname);
  if (tmpname == NULL)
    return NULL;
#if defined (_WIN32) && !defined (__CYGWIN32__)
  if (mkdir (tmpname) != 0)
    return NULL;
#else
  if (mkdir (tmpname, 0700) != 0)
    return NULL;
#endif
  return tmpname;
#endif
}

Here is the call graph for this function:

char* make_tempname ( char *  )

Definition at line 442 of file bucomm.c.

{
  char *tmpname = template_in_dir (filename);
  int fd;

#ifdef HAVE_MKSTEMP
  fd = mkstemp (tmpname);
#else
  tmpname = mktemp (tmpname);
  if (tmpname == NULL)
    return NULL;
  fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
#endif
  if (fd == -1)
    return NULL;
  close (fd);
  return tmpname;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void mode_string ( unsigned  long,
char *   
)

Definition at line 107 of file filemode.c.

{
  str[0] = ftypelet ((unsigned long) mode);
  str[1] = (mode & S_IRUSR) != 0 ? 'r' : '-';
  str[2] = (mode & S_IWUSR) != 0 ? 'w' : '-';
  str[3] = (mode & S_IXUSR) != 0 ? 'x' : '-';
  str[4] = (mode & S_IRGRP) != 0 ? 'r' : '-';
  str[5] = (mode & S_IWGRP) != 0 ? 'w' : '-';
  str[6] = (mode & S_IXGRP) != 0 ? 'x' : '-';
  str[7] = (mode & S_IROTH) != 0 ? 'r' : '-';
  str[8] = (mode & S_IWOTH) != 0 ? 'w' : '-';
  str[9] = (mode & S_IXOTH) != 0 ? 'x' : '-';
  setst ((unsigned long) mode, str);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void non_fatal ( const char *  ,
  ... 
)

Here is the caller graph for this function:

bfd_vma parse_vma ( const char *  ,
const char *   
)

Definition at line 490 of file bucomm.c.

{
  bfd_vma ret;
  const char *end;

  ret = bfd_scan_vma (s, &end, 0);

  if (*end != '\0')
    fatal (_("%s: bad number: %s"), arg, s);

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void print_arelt_descr ( FILE *  ,
bfd ,
bfd_boolean   
)

Definition at line 361 of file bucomm.c.

{
  struct stat buf;

  if (verbose)
    {
      if (bfd_stat_arch_elt (abfd, &buf) == 0)
       {
         char modebuf[11];
         char timebuf[40];
         time_t when = buf.st_mtime;
         const char *ctime_result = (const char *) ctime (&when);

         /* POSIX format:  skip weekday and seconds from ctime output.  */
         sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);

         mode_string (buf.st_mode, modebuf);
         modebuf[10] = '\0';
         /* POSIX 1003.2/D11 says to skip first character (entry type).  */
         fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1,
                 (long) buf.st_uid, (long) buf.st_gid,
                 (long) buf.st_size, timebuf);
       }
    }

  fprintf (file, "%s\n", bfd_get_filename (abfd));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void print_version ( const char *  )

Definition at line 29 of file version.c.

{
  /* This output is intended to follow the GNU standards document.  */
  /* xgettext:c-format */
  printf ("GNU %s %s\n", name, BFD_VERSION_STRING);
  printf (_("Copyright 2007 Free Software Foundation, Inc.\n"));
  printf (_("\
This program is free software; you may redistribute it under the terms of\n\
the GNU General Public License.  This program has absolutely no warranty.\n"));
  exit (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void report ( const char *  ,
va_list   
)
void set_default_bfd_target ( void  )

Definition at line 104 of file bucomm.c.

{
  /* The macro TARGET is defined by Makefile.  */
  const char *target = TARGET;

  if (! bfd_set_default_target (target))
    fatal (_("can't set BFD default target to `%s': %s"),
          target, bfd_errmsg (bfd_get_error ()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void set_times ( const char *  ,
const struct stat  
)

Definition at line 98 of file rename.c.

{
  int result;

  {
#ifdef HAVE_GOOD_UTIME_H
    struct utimbuf tb;

    tb.actime = statbuf->st_atime;
    tb.modtime = statbuf->st_mtime;
    result = utime (destination, &tb);
#else /* ! HAVE_GOOD_UTIME_H */
#ifndef HAVE_UTIMES
    long tb[2];

    tb[0] = statbuf->st_atime;
    tb[1] = statbuf->st_mtime;
    result = utime (destination, tb);
#else /* HAVE_UTIMES */
    struct timeval tv[2];

    tv[0].tv_sec = statbuf->st_atime;
    tv[0].tv_usec = 0;
    tv[1].tv_sec = statbuf->st_mtime;
    tv[1].tv_usec = 0;
    result = utimes (destination, tv);
#endif /* HAVE_UTIMES */
#endif /* ! HAVE_GOOD_UTIME_H */
  }

  if (result != 0)
    non_fatal (_("%s: cannot set time: %s"), destination, strerror (errno));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int smart_rename ( const char *  ,
const char *  ,
int   
)

Here is the caller graph for this function:

int snprintf ( char *  ,
size_t  ,
const char *  ,
  ... 
)

Definition at line 50 of file snprintf.c.

{
  int result;
  VA_OPEN (ap, format);
  VA_FIXEDARG (ap, char *, s);
  VA_FIXEDARG (ap, size_t, n);
  VA_FIXEDARG (ap, const char *, format);
  result = vsnprintf (s, n, format, ap);
  VA_CLOSE (ap);
  return result;
}

Here is the call graph for this function:

char* stpcpy ( char *  ,
const char *   
)

Definition at line 39 of file stpcpy.c.

{
  const size_t len = strlen (src);
  return (char *) memcpy (dst, src, len + 1) + len;
}
char* strchr ( )
char* strrchr ( )
char* strstr ( )
int vsnprintf ( char *  ,
size_t  ,
const char *  ,
va_list   
)

Definition at line 57 of file vsnprintf.c.

{
  char *buf = 0;
  int result = vasprintf (&buf, format, ap);

  if (!buf)
    return -1;
  if (result < 0)
    {
      free (buf);
      return -1;
    }

  result = strlen (buf);
  if (n > 0)
    {
      if ((long) n > result)
       memcpy (s, buf, result+1);
      else
        {
         memcpy (s, buf, n-1);
         s[n - 1] = 0;
       }
    }
  free (buf);
  return result;
}

Here is the caller graph for this function:

void* xmalloc ( size_t  )

Definition at line 141 of file xmalloc.c.

{
  PTR newmem;

  if (size == 0)
    size = 1;
  newmem = malloc (size);
  if (!newmem)
    xmalloc_failed (size);

  return (newmem);
}
void* xrealloc ( void *  ,
size_t   
)

Variable Documentation

char** environ
char* program_name

Definition at line 49 of file bucomm.c.