FreeCalypso > hg > freecalypso-sw
view 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 |
line wrap: on
line source
/* * This C module implements object-level analysis. */ #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "types.h" #include "struct.h" #include "globals.h" #include "pathname.h" validate_obj_name(ino, root_special) { struct inode_info *inf = inode_info[ino]; u8 *p, *endp; int c; if (!inf->len) return(0); p = inf->dataptr; endp = p + inf->len; for (; ; p++) { if (p >= endp) return(0); c = *p; if (!c) break; if (c < ' ' || c > '~') return(0); if (root_special || isalnum(c)) continue; switch (c) { case '.': case ',': case '_': case '-': case '+': case '%': case '$': case '#': continue; default: return(0); } } if (!root_special) { c = p - inf->dataptr; if (c < 1 || c > MAX_FN_COMPONENT) return(0); if (!strcmp(inf->dataptr, ".") || !strcmp(inf->dataptr, "..")) return(0); } inf->byte_after_name = p + 1; return(1); }