Blame dwarfdump/common.c

Packit cdaae3
/*
Packit cdaae3
  Copyright (C) 2008-2010 SN Systems.  All Rights Reserved.
Packit cdaae3
  Portions Copyright (C) 2008-2017 David Anderson.  All Rights Reserved.
Packit cdaae3
  Portions Copyright (C) 2011-2012 SN Systems Ltd.  .  All Rights Reserved.
Packit cdaae3
Packit cdaae3
  This program is free software; you can redistribute it and/or modify it
Packit cdaae3
  under the terms of version 2 of the GNU General Public License as
Packit cdaae3
  published by the Free Software Foundation.
Packit cdaae3
Packit cdaae3
  This program is distributed in the hope that it would be useful, but
Packit cdaae3
  WITHOUT ANY WARRANTY; without even the implied warranty of
Packit cdaae3
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit cdaae3
Packit cdaae3
  Further, this software is distributed without any warranty that it is
Packit cdaae3
  free of the rightful claim of any third person regarding infringement
Packit cdaae3
  or the like.  Any license provided herein, whether implied or
Packit cdaae3
  otherwise, applies only to this software file.  Patent licenses, if
Packit cdaae3
  any, provided herein do not apply to combinations of this program with
Packit cdaae3
  other software, or any other product whatsoever.
Packit cdaae3
Packit cdaae3
  You should have received a copy of the GNU General Public License along
Packit cdaae3
  with this program; if not, write the Free Software Foundation, Inc., 51
Packit cdaae3
  Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
Packit cdaae3
*/
Packit cdaae3
Packit cdaae3
/* These do little except on Windows */
Packit cdaae3
Packit cdaae3
#include "common.h"
Packit cdaae3
#include "config.h"
Packit cdaae3
#include "globals.h"
Packit cdaae3
#include "warningcontrol.h"
Packit cdaae3
#include <stdio.h>
Packit cdaae3
/* Windows specific header files */
Packit cdaae3
#ifdef HAVE_STDAFX_H
Packit cdaae3
#include "stdafx.h"
Packit cdaae3
#endif /* HAVE_STDAFX_H */
Packit cdaae3
Packit cdaae3
#define DW_VERSION_DATE_STR " 2018-01-29 11:08:35-08:00  "
Packit cdaae3
#define RELEASE_DATE      "20160307"
Packit cdaae3
Packit cdaae3
/* The Linux/Unix version does not want a version string to print
Packit cdaae3
   unless -V is on the command line. */
Packit cdaae3
void
Packit cdaae3
print_version_details(UNUSEDARG const char * name,int alwaysprint)
Packit cdaae3
{
Packit cdaae3
#ifdef _WIN32
Packit cdaae3
#ifdef _DEBUG
Packit cdaae3
    char *acType = "Debug";
Packit cdaae3
#else
Packit cdaae3
    char *acType = "Release";
Packit cdaae3
#endif /* _DEBUG */
Packit cdaae3
#ifdef _WIN64
Packit cdaae3
  char *bits = "64";
Packit cdaae3
#else
Packit cdaae3
  char *bits = "32";
Packit cdaae3
#endif /* _WIN64 */
Packit cdaae3
    static char acVersion[64];
Packit cdaae3
    snprintf(acVersion,sizeof(acVersion),
Packit cdaae3
        "[%s %s %s Win%s (%s)]",__DATE__,__TIME__,acType,bits,RELEASE_DATE);
Packit cdaae3
    printf("%s %s\n",sanitized(name),acVersion);
Packit cdaae3
#else  /* !_WIN32 */
Packit cdaae3
    if (alwaysprint) {
Packit cdaae3
        printf("%s\n",DW_VERSION_DATE_STR);
Packit cdaae3
    }
Packit cdaae3
#endif /* _WIN32 */
Packit cdaae3
}
Packit cdaae3
Packit cdaae3
Packit cdaae3
void
Packit cdaae3
print_args(UNUSEDARG int argc, UNUSEDARG char *argv[])
Packit cdaae3
{
Packit cdaae3
#ifdef _WIN32
Packit cdaae3
    int index = 1;
Packit cdaae3
    printf("Arguments: ");
Packit cdaae3
    for (index = 1; index < argc; ++index) {
Packit cdaae3
        printf("%s ",sanitized(argv[index]));
Packit cdaae3
    }
Packit cdaae3
    printf("\n");
Packit cdaae3
#endif /* _WIN32 */
Packit cdaae3
}
Packit cdaae3
Packit cdaae3
void
Packit cdaae3
print_usage_message(const char *program_name_in, const char **text)
Packit cdaae3
{
Packit cdaae3
    unsigned i = 0;
Packit cdaae3
#ifndef _WIN32
Packit cdaae3
    fprintf(stderr,"Usage:  %s  <options> <object file>\n", program_name_in);
Packit cdaae3
#endif /* _WIN32 */
Packit cdaae3
    for (i = 0; *text[i]; ++i) {
Packit cdaae3
        fprintf(stderr,"%s\n", text[i]);
Packit cdaae3
    }
Packit cdaae3
}