Exemplo n.º 1
0
/*programe main entry*/
int main(const int argc, const char *argv[]) {
    char option[BUFSIZE];
    int to_print[BUFSIZE];
    int negate = 0;
    int fpos;
    int type;
    int i;
    FILE *fp;
    type = get_valid_com(argc, argv, option, &negate, &fpos);
    if (type == 0)
        return 1;
    if (!set_range(option, to_print, negate))
        return 2;
    for (i = fpos; i < argc; i++) {
        if ((fp = fopen(argv[i], "r+b")) == 0) {
            perror("fopen");
            return 3;
        }
        if (type == 1)
            display_c(fp, to_print);
        else
            display_f(fp, to_print);
        if (fclose(fp) != 0) {
            perror("fclose");
            return 4;
        }
    }
    return 0;
}
Exemplo n.º 2
0
static void display_l(Tr_level l) {
	static int lnum;
	if (l->parent) {
		printf("parent: %s\n", Temp_labelstring(l->parent->name));
	} else {
		printf("parent: root\n");
	}
	printf("addr: %s\n", Temp_labelstring(l->name));
	display_f(l->frame);
}