fix stupid copynpaste idiocy
[platform/upstream/libatasmart.git] / skdump.c
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 /***
4     This file is part of SmartKit.
5
6     Copyright 2008 Lennart Poettering
7
8     SmartKit is free software; you can redistribute it and/or modify
9     it under the terms of the GNU Lesser General Public License as
10     published by the Free Software Foundation, either version 2.1 of the
11     License, or (at your option) any later version.
12
13     SmartKit is distributed in the hope that it will be useful, but
14     WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16     Lesser General Public License for more details.
17
18     You should have received a copy of the GNU Lesser General Public
19     License along with SmartKit. If not, If not, see
20     <http://www.gnu.org/licenses/>.
21 ***/
22
23 #include <string.h>
24 #include <errno.h>
25
26 #include "smart.h"
27
28 int main(int argc, char *argv[]) {
29         int ret;
30         const char *device;
31         SkDisk *d;
32
33         if (argc != 2) {
34                 g_printerr("%s [DEVICE]", argv[0]);
35                 return 1;
36         }
37
38         device = argv[1];
39
40         if ((ret = sk_disk_open(device, &d)) < 0) {
41                 g_printerr("Failed to open disk %s: %s\n", device, g_strerror(errno));
42                 return 1;
43         }
44
45         if ((ret = sk_disk_dump(d)) < 0) {
46                 g_printerr("Failed to dump disk data: %s\n", g_strerror(errno));
47                 return 1;
48         }
49
50         sk_disk_free(d);
51
52         return 0;
53 }