FreeCalypso > hg > freecalypso-sw
comparison ffstools/tiffs-rd/object.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 | |
children | 024042383a26 |
comparison
equal
deleted
inserted
replaced
232:73372cfdaf7f | 233:ae9ff2d1e3da |
---|---|
1 /* | |
2 * This C module implements object-level analysis. | |
3 */ | |
4 | |
5 #include <ctype.h> | |
6 #include <stdio.h> | |
7 #include <stdlib.h> | |
8 #include <string.h> | |
9 #include <strings.h> | |
10 #include "types.h" | |
11 #include "struct.h" | |
12 #include "globals.h" | |
13 #include "pathname.h" | |
14 | |
15 validate_obj_name(ino, root_special) | |
16 { | |
17 struct inode_info *inf = inode_info[ino]; | |
18 u8 *p, *endp; | |
19 int c; | |
20 | |
21 if (!inf->len) | |
22 return(0); | |
23 p = inf->dataptr; | |
24 endp = p + inf->len; | |
25 for (; ; p++) { | |
26 if (p >= endp) | |
27 return(0); | |
28 c = *p; | |
29 if (!c) | |
30 break; | |
31 if (c < ' ' || c > '~') | |
32 return(0); | |
33 if (root_special || isalnum(c)) | |
34 continue; | |
35 switch (c) { | |
36 case '.': | |
37 case ',': | |
38 case '_': | |
39 case '-': | |
40 case '+': | |
41 case '%': | |
42 case '$': | |
43 case '#': | |
44 continue; | |
45 default: | |
46 return(0); | |
47 } | |
48 } | |
49 if (!root_special) { | |
50 c = p - inf->dataptr; | |
51 if (c < 1 || c > MAX_FN_COMPONENT) | |
52 return(0); | |
53 if (!strcmp(inf->dataptr, ".") || !strcmp(inf->dataptr, "..")) | |
54 return(0); | |
55 } | |
56 inf->byte_after_name = p + 1; | |
57 return(1); | |
58 } |