Diff for /embedaddon/smartmontools/utility.h between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2012/02/21 16:32:16 version 1.1.1.3, 2013/07/22 01:17:36
Line 4 Line 4
  * Home page of code is: http://smartmontools.sourceforge.net   * Home page of code is: http://smartmontools.sourceforge.net
  *   *
  * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>   * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>   * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *   *
  * This program is free software; you can redistribute it and/or modify   * This program is free software; you can redistribute it and/or modify
Line 13 Line 13
  * any later version.   * any later version.
  *   *
  * You should have received a copy of the GNU General Public License   * You should have received a copy of the GNU General Public License
 * (for example COPYING); if not, write to the Free * (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  *   *
  * This code was originally developed as a Senior Thesis by Michael Cornwell   * This code was originally developed as a Senior Thesis by Michael Cornwell
  * at the Concurrent Systems Laboratory (now part of the Storage Systems   * at the Concurrent Systems Laboratory (now part of the Storage Systems
Line 36 Line 35
 #include <string.h>  #include <string.h>
 #include <string>  #include <string>
   
#if !defined(__GNUC__) && !defined(__attribute__)#ifndef __GNUC__
#define __attribute__(x)  /**/#define __attribute_format_printf(x, y)  /**/
 #elif defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO
 // Check format of __mingw_*printf() instead of MSVCRT.DLL:*printf()
 #define __attribute_format_printf(x, y)  __attribute__((format (gnu_printf, x, y)))
 #define HAVE_WORKING_SNPRINTF 1
 #else
 #define __attribute_format_printf(x, y)  __attribute__((format (printf, x, y)))
 #endif  #endif
   
 // Make version information string  // Make version information string
Line 45  std::string format_version_info(const char * prog_name Line 50  std::string format_version_info(const char * prog_name
   
 // return (v)sprintf() formated std::string  // return (v)sprintf() formated std::string
 std::string strprintf(const char * fmt, ...)  std::string strprintf(const char * fmt, ...)
    __attribute__ ((format (printf, 1, 2)));    __attribute_format_printf(1, 2);
 std::string vstrprintf(const char * fmt, va_list ap);  std::string vstrprintf(const char * fmt, va_list ap);
   
   // Return true if STR starts with PREFIX
   inline bool str_starts_with(const char * str, const char * prefix)
     { return !strncmp(str, prefix, strlen(prefix)); }
   
   inline bool str_starts_with(const std::string & str, const char * prefix)
     { return !strncmp(str.c_str(), prefix, strlen(prefix)); }
   
 #ifndef HAVE_WORKING_SNPRINTF  #ifndef HAVE_WORKING_SNPRINTF
 // Substitute by safe replacement functions  // Substitute by safe replacement functions
 int safe_snprintf(char *buf, int size, const char *fmt, ...)  int safe_snprintf(char *buf, int size, const char *fmt, ...)
    __attribute__ ((format (printf, 3, 4)));    __attribute_format_printf(3, 4);
 int safe_vsnprintf(char *buf, int size, const char *fmt, va_list ap);  int safe_vsnprintf(char *buf, int size, const char *fmt, va_list ap);
 #define snprintf  safe_snprintf  #define snprintf  safe_snprintf
 #define vsnprintf safe_vsnprintf  #define vsnprintf safe_vsnprintf
Line 75  void dateandtimezoneepoch(char *buffer, time_t tval); Line 87  void dateandtimezoneepoch(char *buffer, time_t tval);
 // itself is defined differently in smartctl and smartd.  So the  // itself is defined differently in smartctl and smartd.  So the
 // function definition(s) are in smartd.c and in smartctl.c.  // function definition(s) are in smartd.c and in smartctl.c.
 void pout(const char *fmt, ...)    void pout(const char *fmt, ...)  
     __attribute__ ((format (printf, 1, 2)));    __attribute_format_printf(1, 2);
   
 // replacement for perror() with redirected output.  // replacement for perror() with redirected output.
 void syserror(const char *message);  void syserror(const char *message);
   
 // Function for processing -r option in smartctl and smartd  // Function for processing -r option in smartctl and smartd
 int split_report_arg(char *s, int *i);  int split_report_arg(char *s, int *i);
 // Function for processing -c option in smartctl and smartd  
 int split_report_arg2(char *s, int *i);  
   
 // Function for processing -t selective... option in smartctl  // Function for processing -t selective... option in smartctl
 int split_selective_arg(char *s, uint64_t *start, uint64_t *stop, int *mode);  int split_selective_arg(char *s, uint64_t *start, uint64_t *stop, int *mode);
Line 169  bool nonempty(const void * data, int size); Line 179  bool nonempty(const void * data, int size);
   
 // needed to fix glibc bug  // needed to fix glibc bug
 void FixGlibcTimeZoneBug();  void FixGlibcTimeZoneBug();
   
 // convert time in msec to a text string  
 void MsecToText(unsigned int msec, char *txt);  
   
 // Format integer with thousands separator  // Format integer with thousands separator
 const char * format_with_thousands_sep(char * str, int strsize, uint64_t val,  const char * format_with_thousands_sep(char * str, int strsize, uint64_t val,

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>