version 1.1.1.2, 2012/10/09 09:36:45
|
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-12 Bruce Allen <smartmontools-support@lists.sourceforge.net> |
* Copyright (C) 2002-12 Bruce Allen <smartmontools-support@lists.sourceforge.net> |
* Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net> | * Copyright (C) 2008-13 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 91 std::string format_version_info(const char * prog_name
|
Line 90 std::string format_version_info(const char * prog_name
|
"(build date "__DATE__")" // checkout without expansion of Id keywords |
"(build date "__DATE__")" // checkout without expansion of Id keywords |
#endif |
#endif |
" [%s] "BUILD_INFO"\n" |
" [%s] "BUILD_INFO"\n" |
"Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net\n", | "Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org\n", |
prog_name, smi()->get_os_version_str().c_str() |
prog_name, smi()->get_os_version_str().c_str() |
); |
); |
if (!full) |
if (!full) |
Line 503 int split_report_arg(char *s, int *i)
|
Line 502 int split_report_arg(char *s, int *i)
|
return 0; |
return 0; |
} |
} |
|
|
// same as above but sets *i to -1 if missing , argument |
|
int split_report_arg2(char *s, int *i){ |
|
char *tailptr; |
|
s+=6; |
|
|
|
if (*s=='\0' || !isdigit((int)*s)) { |
|
// What's left must be integer |
|
*i=-1; |
|
return 1; |
|
} |
|
|
|
errno = 0; |
|
*i = (int) strtol(s, &tailptr, 10); |
|
if (errno || *tailptr != '\0') { |
|
*i=-1; |
|
return 1; |
|
} |
|
|
|
return 0; |
|
} |
|
|
|
#ifndef HAVE_STRTOULL |
#ifndef HAVE_STRTOULL |
// Replacement for missing strtoull() (Linux with libc < 6, MSVC) |
// Replacement for missing strtoull() (Linux with libc < 6, MSVC) |
// Functionality reduced to requirements of smartd and split_selective_arg(). |
// Functionality reduced to requirements of smartd and split_selective_arg(). |
Line 617 int split_selective_arg(char *s, uint64_t *start,
|
Line 595 int split_selective_arg(char *s, uint64_t *start,
|
return 0; |
return 0; |
} |
} |
} |
} |
|
|
|
errno = 0; |
*stop = strtoull(s+1, &tailptr, 0); |
*stop = strtoull(s+1, &tailptr, 0); |
if (errno || *tailptr != '\0') |
if (errno || *tailptr != '\0') |
return 1; |
return 1; |
Line 702 bool nonempty(const void * data, int size)
|
Line 682 bool nonempty(const void * data, int size)
|
if (((const unsigned char *)data)[i]) |
if (((const unsigned char *)data)[i]) |
return true; |
return true; |
return false; |
return false; |
} |
|
|
|
|
|
// This routine converts an integer number of milliseconds into a test |
|
// string of the form Xd+Yh+Zm+Ts.msec. The resulting text string is |
|
// written to the array. |
|
void MsecToText(unsigned int msec, char *txt){ |
|
unsigned int days, hours, min, sec; |
|
|
|
days = msec/86400000U; |
|
msec -= days*86400000U; |
|
|
|
hours = msec/3600000U; |
|
msec -= hours*3600000U; |
|
|
|
min = msec/60000U; |
|
msec -= min*60000U; |
|
|
|
sec = msec/1000U; |
|
msec -= sec*1000U; |
|
|
|
if (days) { |
|
txt += sprintf(txt, "%2dd+", (int)days); |
|
} |
|
|
|
sprintf(txt, "%02d:%02d:%02d.%03d", (int)hours, (int)min, (int)sec, (int)msec); |
|
return; |
|
} |
} |
|
|
// Format integer with thousands separator |
// Format integer with thousands separator |