summaryrefslogtreecommitdiffstats
path: root/skdump.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-06-30 21:50:56 +0200
committerLennart Poettering <lennart@poettering.net>2008-06-30 21:50:56 +0200
commitf671a647e5480a709f09a66252995bf07e512e32 (patch)
tree35e768e9bc096abe54e7a2d59c75d1aae84afca8 /skdump.c
parent09358348c50656e7c6d508767cee3996e8a3d77f (diff)
a lot of love
Diffstat (limited to 'skdump.c')
-rw-r--r--skdump.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/skdump.c b/skdump.c
index 6fa9167..7d1cdb6 100644
--- a/skdump.c
+++ b/skdump.c
@@ -1,23 +1,53 @@
+/*-*- Mode: C; c-basic-offset: 8 -*-*/
+
+/***
+ This file is part of SmartKit.
+
+ Copyright 2008 Lennart Poettering
+
+ libcanberra is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 2.1 of the
+ License, or (at your option) any later version.
+
+ libcanberra is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with libcanberra. If not, If not, see
+ <http://www.gnu.org/licenses/>.
+***/
+
#include <string.h>
#include <errno.h>
#include "smart.h"
int main(int argc, char *argv[]) {
- int ret;
- const char *device;
- SkDevice *d;
+ int ret;
+ const char *device;
+ SkDisk *d;
+
+ if (argc != 2) {
+ g_printerr("%s [DEVICE]", argv[0]);
+ return 1;
+ }
- device = argc >= 2 ? argv[1] : "/dev/sda";
+ device = argv[1];
- if ((ret = sk_disk_open(device, &d)) < 0) {
- g_printerr("Failed to open disk %s: %s\n", device, strerror(errno));
- return 1;
- }
+ if ((ret = sk_disk_open(device, &d)) < 0) {
+ g_printerr("Failed to open disk %s: %s\n", device, g_strerror(errno));
+ return 1;
+ }
- sk_disk_dump(d);
+ if ((ret = sk_disk_dump(d)) < 0) {
+ g_printerr("Failed to dump disk data: %s\n", g_strerror(errno));
+ return 1;
+ }
- sk_disk_free(d);
+ sk_disk_free(d);
- return 0;
+ return 0;
}