1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
diff -uNr -r sleuthkit-2.08-orig/src/fstools/fscheck.c sleuthkit-2.08/src/fstools/fscheck.c
--- sleuthkit-2.08-orig/src/fstools/fscheck.c 2007-03-13 21:05:37.000000000 +0100
+++ sleuthkit-2.08/src/fstools/fscheck.c 2007-04-11 18:03:00.000000000 +0200
@@ -11,8 +11,10 @@
** This software is distributed under the Common Public License 1.0
**
*/
+#include <locale.h>
#include "fs_tools.h"
+static TSK_TCHAR *progname;
static void
usage()
@@ -36,58 +38,71 @@
int
main(int argc, char **argv)
{
- char *fstype = NULL;
+ TSK_TCHAR *fstype = NULL;
int ch;
- FS_INFO *fs;
- char *imgtype = NULL, *imgoff = NULL;
- IMG_INFO *img;
+ TSK_FS_INFO *fs;
+ TSK_TCHAR *imgtype = NULL;
+ SSIZE_T imgoff = 0;
+ TSK_IMG_INFO *img;
progname = argv[0];
+ setlocale(LC_ALL, "");
- while ((ch = getopt(argc, argv, "f:i:o:vV")) > 0) {
+ while ((ch = getopt(argc, argv, _TSK_T("f:i:o:vV"))) > 0) {
switch (ch) {
- case '?':
+ case _TSK_T('?'):
default:
- fprintf(stderr, "Invalid argument: %s\n", argv[optind]);
+ fprintf(stderr, _TSK_T("Invalid argument: %s\n"), argv[optind]);
usage();
- case 'f':
+ case _TSK_T('f'):
fstype = optarg;
+ if (TSTRCMP(fstype, _TSK_T("list")) == 0) {
+ tsk_fs_print_types(stderr);
+ exit(1);
+ }
break;
- case 'i':
+ case _TSK_T('i'):
imgtype = optarg;
+ if (TSTRCMP(imgtype, _TSK_T("list")) == 0) {
+ tsk_img_print_types(stderr);
+ exit(1);
+ }
break;
- case 'o':
- imgoff = optarg;
+ case _TSK_T('o'):
+ if ((imgoff = tsk_parse_offset(optarg)) == -1) {
+ tsk_error_print(stderr);
+ exit(1);
+ }
break;
- case 'v':
- verbose++;
+ case _TSK_T('v'):
+ tsk_verbose++;
break;
- case 'V':
- print_version(stdout);
+ case _TSK_T('V'):
+ tsk_print_version(stdout);
exit(0);
}
}
/* We need at least one more argument */
if (optind >= argc) {
- fprintf(stderr, "Missing image name\n");
+ tsk_fprintf(stderr, "Missing image name\n");
usage();
}
img =
- img_open(imgtype, imgoff, argc - optind,
- (const char **) &argv[optind]);
+ tsk_img_open(imgtype, argc - optind,
+ (const TSK_TCHAR **) &argv[optind]);
if (img == NULL) {
tsk_error_print(stderr);
exit(1);
}
- if (fs = fs_open(img, fstype)) {
+ if (fs = tsk_fs_open(img, imgoff, fstype)) {
if (tsk_errno == TSK_ERR_FS_UNSUPTYPE)
tsk_print_types(stderr);
|