FreeCalypso > hg > freecalypso-sw
comparison ffstools/tiffs-rd/inode.c @ 233:ae9ff2d1e3da
tiffs IVA: basic ls integrated
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 26 Jan 2014 10:54:42 +0000 |
parents | 73372cfdaf7f |
children | 024042383a26 |
comparison
equal
deleted
inserted
replaced
232:73372cfdaf7f | 233:ae9ff2d1e3da |
---|---|
2 * This C module implements the reading and decoding of inode information. | 2 * This C module implements the reading and decoding of inode information. |
3 */ | 3 */ |
4 | 4 |
5 #include <sys/types.h> | 5 #include <sys/types.h> |
6 #include <endian.h> | 6 #include <endian.h> |
7 #include <ctype.h> | |
8 #include <stdio.h> | 7 #include <stdio.h> |
9 #include <stdlib.h> | 8 #include <stdlib.h> |
10 #include <string.h> | 9 #include <string.h> |
11 #include <strings.h> | 10 #include <strings.h> |
12 #include "types.h" | 11 #include "types.h" |
13 #include "struct.h" | 12 #include "struct.h" |
14 #include "globals.h" | 13 #include "globals.h" |
15 #include "pathname.h" | |
16 | 14 |
17 u8 blank_flash_line[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | 15 u8 blank_flash_line[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
18 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; | 16 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
19 | 17 |
20 alloc_inode_table() | 18 alloc_inode_table() |
159 return(0); | 157 return(0); |
160 } | 158 } |
161 fprintf(stderr, "error: no root inode found; try -r\n"); | 159 fprintf(stderr, "error: no root inode found; try -r\n"); |
162 exit(1); | 160 exit(1); |
163 } | 161 } |
164 | |
165 validate_obj_name(ino, root_special) | |
166 { | |
167 struct inode_info *inf = inode_info[ino]; | |
168 u8 *p, *endp; | |
169 int c; | |
170 | |
171 if (!inf->len) | |
172 return(0); | |
173 p = inf->dataptr; | |
174 endp = p + inf->len; | |
175 for (; ; p++) { | |
176 if (p >= endp) | |
177 return(0); | |
178 c = *p; | |
179 if (!c) | |
180 break; | |
181 if (c < ' ' || c > '~') | |
182 return(0); | |
183 if (root_special || isalnum(c)) | |
184 continue; | |
185 switch (c) { | |
186 case '.': | |
187 case ',': | |
188 case '_': | |
189 case '-': | |
190 case '+': | |
191 case '%': | |
192 case '$': | |
193 case '#': | |
194 continue; | |
195 default: | |
196 return(0); | |
197 } | |
198 } | |
199 c = p - inf->dataptr; | |
200 if (c < 1 || c > MAX_FN_COMPONENT && !root_special) | |
201 return(0); | |
202 inf->byte_after_name = p + 1; | |
203 return(1); | |
204 } |