*
* Home page of code is: http://smartmontools.sourceforge.net
*
- * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-11 Bruce Allen
+ * Copyright (C) 2008-15 Christian Franke
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
*
* This program is free software; you can redistribute it and/or modify
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <stdexcept>
#include <getopt.h>
#include "smartctl.h"
#include "utility.h"
-const char * smartctl_cpp_cvsid = "$Id: smartctl.cpp 3826 2013-07-06 21:57:29Z samm2 $"
+const char * smartctl_cpp_cvsid = "$Id: smartctl.cpp 4080 2015-05-05 20:31:22Z chrfranke $"
CONFIG_H_CVSID SMARTCTL_H_CVSID;
// Globals to control printing
sscanf(optarg, "devstat%n,%u%n", &n1, &val, &n2);
if (n1 == len)
ataopts.devstat_all_pages = true;
- else if (n2 == len && val <= 255)
- ataopts.devstat_pages.push_back(val);
- else
- badarg = true;
+ else {
+ if (n2 != len) // retry with hex
+ sscanf(optarg, "devstat,0x%x%n", &val, &n2);
+ if (n2 == len && val <= 0xff)
+ ataopts.devstat_pages.push_back(val);
+ else
+ badarg = true;
+ }
} else if (!strncmp(optarg, "xerror", sizeof("xerror")-1)) {
int n1 = -1, n2 = -1, len = strlen(optarg);
} else {
if (ataopts.smart_selective_args.num_spans >= 5 || start > stop) {
if (start > stop) {
- snprintf(extraerror, sizeof(extraerror), "ERROR: Start LBA (%"PRIu64") > ending LBA (%"PRId64") in argument \"%s\"\n",
+ snprintf(extraerror, sizeof(extraerror), "ERROR: Start LBA (%" PRIu64 ") > ending LBA (%" PRId64 ") in argument \"%s\"\n",
start, stop, optarg);
} else {
snprintf(extraerror, sizeof(extraerror),"ERROR: No more than five selective self-test spans may be"
// Main program without exception handling
static int main_worker(int argc, char **argv)
{
- // Throw if CPU endianess does not match compile time test.
- check_endianness();
+ // Throw if runtime environment does not match compile time test.
+ check_config();
// Initialize interface
smart_interface::init();