smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
Classes | Defines | 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). Supports copy & assignment and is compatible with STL containers. More...

Defines

#define UTILITY_H_CVSID   "$Id: utility.h 3719 2012-12-03 21:19:33Z 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_endianness ()
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)

Define 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 115 of file utility.h.

#define snprintf   safe_snprintf

Definition at line 68 of file utility.h.

#define UTILITY_H_CVSID   "$Id: utility.h 3719 2012-12-03 21:19:33Z 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_endianness ( )

Definition at line 265 of file utility.cpp.

void dateandtimezone ( char *  buffer)

Definition at line 334 of file utility.cpp.

void dateandtimezoneepoch ( char *  buffer,
time_t  tval 
)

Definition at line 286 of file utility.cpp.

void FixGlibcTimeZoneBug ( )

Definition at line 164 of file utility.cpp.

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

Definition at line 753 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 721 of file utility.cpp.

bool isbigendian ( ) [inline]

Definition at line 149 of file utility.h.

bool nonempty ( const void *  data,
int  size 
)

Definition at line 712 of file utility.cpp.

const char* packetdevicetype ( int  type)

Definition at line 254 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 823 of file utility.cpp.

int split_report_arg ( char *  s,
int *  i 
)

Definition at line 517 of file utility.cpp.

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

Definition at line 593 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 542 of file utility.cpp.

void void syserror ( const char *  message)

Definition at line 345 of file utility.cpp.

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

Definition at line 796 of file utility.cpp.