int main (int argc, char **argv) { parse_args (argc, argv); parse_file (inst_defn_file, 'd'); parse_file (inst_trace_file, 't'); create_arch(); while (instr_proc < instr_count) { cycles++; issue (); execute (); write_back(); } finish (); return 0; }
int main(int argc, char **argv) { int option; char *path, *arch_name; int mod = -1, arch_name_taken = 0; int fd, len_read; struct arch_header *node = NULL; struct arch_header *temp = NULL; struct stat fstat; SHA1Context sha; int i, countIndex = 1; if(!arch_name_taken) //±âº» ¹±â ÆÄÀÏ »ý¼º { arch_name = (char *)malloc(sizeof(char *) * strlen("custom(SHA1_O).txt") +1); strcpy(arch_name, "custom(SHA1_O).txt"); } while ((option = getopt(argc, argv, "c:d:r:h:")) != -1) { switch (option) { case 'c': path = optarg; mod = CREATE; if(mod == CREATE) { temp = (struct arch_header *)calloc(1, sizeof(struct arch_header)); stat(path, &fstat); strcpy(temp->name, path); temp->file_info = fstat; temp->locationIndex = countIndex; //ÀԷµǴ À§Ä¡°ª ÁöÁ¤ temp->duplicateLocationIndex[0] = 0; //Áߺ¹ÆÄÀÏ À§Ä¡°ª ÁöÁ¤ temp->next = NULL; node = create_arch(node, temp, arch_name); countIndex++; } else printf("No creation\n"); break; case 'd': path = optarg; mod = DELETE; if(mod == DELETE) { node = delete_arch(path, arch_name); } else printf("No deletion\n"); break; case 'r': path = optarg; mod = RELEASE; if(mod == RELEASE) { release_arch(arch_name); } else printf("No release\n"); break; case 'h': path = optarg; SHA1Reset(&sha); SHA1Input(&sha, (const unsigned char *) path, strlen(path)); if (!SHA1Result(&sha)) { fprintf(stderr, "ERROR-- could not compute message digest\n"); } else { printf("%s\n", path); for(i = 0; i < 5 ; i++) { printf("%x ", sha.Message_Digest[i]); } } break; default: printf("option search error\n"); } } print_list(node); return 0; }