FreeCalypso > hg > freecalypso-reveng
view pirollback/checknames.c @ 339:77c86062e253
fluid-mnf/fluid.c: passes compilation
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 13 Mar 2020 02:33:21 +0000 |
parents | 78ac405716db |
children |
line wrap: on
line source
#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include "types.h" #include "struct.h" #include "pathname.h" extern struct inode_info inode[]; extern int last_inode; static void check_inode(ino) { struct inode_info *in; u8 *cp; int cnt; in = inode + ino; switch (in->type) { case 0xE1: case 0xF1: case 0xF2: break; case 0x00: case 0xF4: return; default: fprintf(stderr, "inode #%x: unexpected type %02X\n", ino, in->type); exit(1); } for (cp = in->dataptr, cnt = 0; ; cp++, cnt++) { if (cnt >= in->len) { fprintf(stderr, "inode #%x: name expected at %x: length overrun\n", ino, in->offset); exit(1); } if (!*cp) break; if (cnt >= MAX_FN_COMPONENT) { fprintf(stderr, "inode #%x: name exceeds program limit of %d chars\n", ino, MAX_FN_COMPONENT); exit(1); } if (*cp < '!' || *cp > '~') { fprintf(stderr, "inode #%x: name expected at %x: bad character\n", ino, in->offset); exit(1); } } if (!cnt) { fprintf(stderr, "inode #%x: name expected at %x: null string\n", ino, in->offset); exit(1); } in->byte_after_name = cp + 1; } check_object_names() { int ino; for (ino = 1; ino <= last_inode; ino++) check_inode(ino); }