#include #include #include int main (int argc, char *argv[]) { int i,fd; unsigned char buf[4]; unsigned int options; for (i=1; i < argc; i++) { printf("%s: ",argv[i]); if (! (fd = open(argv[i],O_RDONLY))) { printf("can't open!\n"); goto NEXT; } /* Not quite safe, should be put in a for loop */ if (4 != read(fd,buf,4)) { printf("can't read!\n"); goto NEXT1; } if ((buf[0] == 0x96) && (buf[1] == 0x02)) { options = (buf[2] << 8) + buf[3]; printf("big endian (options: %04x)\n",options); } else if ((buf[0] == 0x02) && (buf[1] == 0x96)) { options = (buf[3] << 8) + buf[2]; printf("little endian (options: %04x)\n",options); } else { printf("not an ispell dictionary!\n"); goto NEXT1; } if (options & 0x01) printf(" #define NO8BIT\n"); else printf(" #undef NO8BIT\n"); if (options & 0x02) printf(" #define NO_CAPITALIZATION_SUPPORT\n"); else printf(" #undef NO_CAPITALIZATION_SUPPORT\n"); if ((options & 0x0c) == 0x00) printf (" #define MASKBITS 32\n"); else if ((options & 0x0C) == 0x04) printf (" #define MASKBITS 64\n"); else if ((options & 0x0C) == 0x08) printf (" #define MASKBITS 128\n"); else if ((options & 0x0C) == 0x0c) printf (" #define MASKBITS 256\n"); NEXT1: close(fd); NEXT: } exit(0); }