smartmontools  SVN Rev 4111
Utility to control and monitor storage systems with "S.M.A.R.T."
Classes | Macros | Functions
utility.h File Reference
#include <time.h>
#include <sys/types.h>
#include <regex.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <string>
Include dependency graph for utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  raw_buffer
 
class  stdio_file
 Wrapper class for FILE *. More...
 
class  regular_expression
 Wrapper class for regex(3). More...
 

Macros

#define UTILITY_H_CVSID   "$Id: utility.h 4028 2014-12-13 14:59:48Z chrfranke $"
 
#define __attribute_format_printf(x, y)
 
#define snprintf   safe_snprintf
 
#define vsnprintf   safe_vsnprintf
 
#define DATEANDEPOCHLEN   64
 
#define EXIT(status)   { throw (int)(status); }
 

Functions

std::string format_version_info (const char *prog_name, bool full=false)
 
std::string strprintf (const char *fmt,...) __attribute_format_printf(1
 
std::string std::string vstrprintf (const char *fmt, va_list ap)
 
bool str_starts_with (const char *str, const char *prefix)
 
bool str_starts_with (const std::string &str, const char *prefix)
 
int safe_snprintf (char *buf, int size, const char *fmt,...) __attribute_format_printf(3
 
int int safe_vsnprintf (char *buf, int size, const char *fmt, va_list ap)
 
uint64_t strtoull (const char *p, char **endp, int base)
 
void dateandtimezone (char *buffer)
 
void dateandtimezoneepoch (char *buffer, time_t tval)
 
void pout (const char *fmt,...) __attribute_format_printf(1
 
void void syserror (const char *message)
 
int split_report_arg (char *s, int *i)
 
int split_selective_arg (char *s, uint64_t *start, uint64_t *stop, int *mode)
 
bool isbigendian ()
 
void check_config ()
 
const char * packetdevicetype (int type)
 
bool nonempty (const void *data, int size)
 
void FixGlibcTimeZoneBug ()
 
const char * format_with_thousands_sep (char *str, int strsize, uint64_t val, const char *thousands_sep=0)
 
const char * format_capacity (char *str, int strsize, uint64_t val, const char *decimal_point=0)
 

Macro Definition Documentation

#define __attribute_format_printf (   x,
 
)

Definition at line 39 of file utility.h.

#define DATEANDEPOCHLEN   64

Definition at line 80 of file utility.h.

#define EXIT (   status)    { throw (int)(status); }

Definition at line 103 of file utility.h.

#define snprintf   safe_snprintf

Definition at line 68 of file utility.h.

#define UTILITY_H_CVSID   "$Id: utility.h 4028 2014-12-13 14:59:48Z chrfranke $"

Definition at line 28 of file utility.h.

#define vsnprintf   safe_vsnprintf

Definition at line 69 of file utility.h.

Function Documentation

void check_config ( )

Definition at line 842 of file utility.cpp.

void dateandtimezone ( char *  buffer)

Definition at line 337 of file utility.cpp.

void dateandtimezoneepoch ( char *  buffer,
time_t  tval 
)

Definition at line 289 of file utility.cpp.

void FixGlibcTimeZoneBug ( )

Definition at line 167 of file utility.cpp.

const char* format_capacity ( char *  str,
int  strsize,
uint64_t  val,
const char *  decimal_point = 0 
)

Definition at line 736 of file utility.cpp.

std::string format_version_info ( const char *  prog_name,
bool  full = false 
)

Definition at line 83 of file utility.cpp.

const char* format_with_thousands_sep ( char *  str,
int  strsize,
uint64_t  val,
const char *  thousands_sep = 0 
)

Definition at line 704 of file utility.cpp.

bool isbigendian ( )
inline

Definition at line 120 of file utility.h.

bool nonempty ( const void *  data,
int  size 
)

Definition at line 695 of file utility.cpp.

const char* packetdevicetype ( int  type)

Definition at line 257 of file utility.cpp.

void pout ( const char *  fmt,
  ... 
)
int safe_snprintf ( char *  buf,
int  size,
const char *  fmt,
  ... 
)
int int safe_vsnprintf ( char *  buf,
int  size,
const char *  fmt,
va_list  ap 
)

Definition at line 806 of file utility.cpp.

int split_report_arg ( char *  s,
int *  i 
)

Definition at line 520 of file utility.cpp.

int split_selective_arg ( char *  s,
uint64_t start,
uint64_t stop,
int *  mode 
)

Definition at line 596 of file utility.cpp.

bool str_starts_with ( const char *  str,
const char *  prefix 
)
inline

Definition at line 57 of file utility.h.

bool str_starts_with ( const std::string &  str,
const char *  prefix 
)
inline

Definition at line 60 of file utility.h.

std::string strprintf ( const char *  fmt,
  ... 
)
uint64_t strtoull ( const char *  p,
char **  endp,
int  base 
)

Definition at line 545 of file utility.cpp.

void void syserror ( const char *  message)

Definition at line 348 of file utility.cpp.

std::string std::string vstrprintf ( const char *  fmt,
va_list  ap 
)

Definition at line 779 of file utility.cpp.