FreeCalypso > hg > freecalypso-reveng
comparison pirollback/inopath.c @ 45:18472a2ccf55
pirollback: pathname reconstruction implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 06 Jul 2013 22:06:38 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
44:074237879eca | 45:18472a2ccf55 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include "pathname.h" | |
4 | |
5 extern char *imgfile; | |
6 extern int last_inode; | |
7 | |
8 main(argc, argv) | |
9 char **argv; | |
10 { | |
11 int ino; | |
12 char *strtoul_endp; | |
13 char pathname[PATHNAME_BUF_SIZE]; | |
14 | |
15 if (argc != 3) { | |
16 usage: fprintf(stderr, "usage: %s ffs-image inode\n", argv[0]); | |
17 exit(1); | |
18 } | |
19 imgfile = argv[1]; | |
20 ino = strtoul(argv[2], &strtoul_endp, 16); | |
21 if (!argv[2][0] || *strtoul_endp) | |
22 goto usage; | |
23 read_img_file(); | |
24 read_inodes(); | |
25 if (ino < 1 || ino > last_inode) { | |
26 fprintf(stderr, "%s: bad inode number specified\n", argv[0]); | |
27 exit(1); | |
28 } | |
29 walk_tree(); | |
30 check_object_names(); | |
31 if (pathname_of_inode(ino, pathname) < 0) { | |
32 fprintf(stderr, "unable to get the pathname\n"); | |
33 exit(1); | |
34 } | |
35 printf("%s\n", pathname); | |
36 exit(0); | |
37 } |