flen = get_file_length(argv[2]); in = fopen(argv[2], "rb");
name = argv[2]; flen = get_file_length(name); in = fopen(name, "rb");
main(int argc, char **argv){    PRBool verbose_mode = PR_FALSE;    XPTState *state;    XPTCursor curs, *cursor = &curs;    XPTHeader *header;    size_t flen;    char *whole;    FILE *in;#ifdef XP_MAC	if (argc == 0 || argv == NULL)	argc = mac_get_args(&argv);#endif    switch (argc) {    case 2:        if (argv[1][0] == '-') {            xpt_dump_usage(argv);            return 1;        }        flen = get_file_length(argv[1]);        in = fopen(argv[1], "rb");        break;    case 3:        verbose_mode = PR_TRUE;        if (argv[1][0] != '-' || argv[1][1] != 'v') {            xpt_dump_usage(argv);            return 1;        }        flen = get_file_length(argv[2]);        in = fopen(argv[2], "rb");        break;    default:        xpt_dump_usage(argv);        return 1;    }    if (!in) {        perror("FAILED: fopen");        return 1;    }    whole = malloc(flen);    if (!whole) {        perror("FAILED: malloc for whole");        return 1;    }    if (flen > 0) {        size_t rv = fread(whole, 1, flen, in);        if (rv < 0) {            perror("FAILED: reading typelib file");            return 1;        }        if (rv < flen) {            fprintf(stderr, "short read (%d vs %d)! ouch!\n", rv, flen);            return 1;        }        if (ferror(in) != 0 || fclose(in) != 0)            perror("FAILED: Unable to read typelib file.\n");                state = XPT_NewXDRState(XPT_DECODE, whole, flen);        if (!XPT_MakeCursor(state, XPT_HEADER, 0, cursor)) {            fprintf(stdout, "MakeCursor failed\n");            return 1;        }        if (!XPT_DoHeader(cursor, &header)) {            fprintf(stdout, "DoHeader failed\n");            return 1;        }        if (!XPT_DumpHeader(cursor, header, BASE_INDENT, verbose_mode)) {            perror("FAILED: XPT_DumpHeader");            return 1;        }           if (param_problems) {            fprintf(stdout, "\nWARNING: ParamDescriptors are present with "                    "bad in/out/retval flag information.\nThese have been marked "                    "with 'XXX'.\nRemember, retval params should always be marked as out!\n");        }        XPT_DestroyXDRState(state);        free(whole);    } else {        fclose(in);        perror("FAILED: file length <= 0");        return 1;    }    return 0;}