summaryrefslogtreecommitdiffstats
path: root/skdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'skdump.c')
-rw-r--r--skdump.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/skdump.c b/skdump.c
new file mode 100644
index 0000000..6fa9167
--- /dev/null
+++ b/skdump.c
@@ -0,0 +1,23 @@
+#include <string.h>
+#include <errno.h>
+
+#include "smart.h"
+
+int main(int argc, char *argv[]) {
+ int ret;
+ const char *device;
+ SkDevice *d;
+
+ device = argc >= 2 ? argv[1] : "/dev/sda";
+
+ if ((ret = sk_disk_open(device, &d)) < 0) {
+ g_printerr("Failed to open disk %s: %s\n", device, strerror(errno));
+ return 1;
+ }
+
+ sk_disk_dump(d);
+
+ sk_disk_free(d);
+
+ return 0;
+}