#include #include #include #include #include #include #include static void emptyIT() { return; } static void hddIT() { return; } int main(int argc, char *argv[]) { unsigned int i; /* init hardware */ if(initHardware("hardware.ini") == 0) { fprintf(stderr, "Error in hardware initialization\n"); exit(EXIT_FAILURE); } /* Interreupt handlers */ for(i=0; i<16; i++) IRQVECTOR[i] = emptyIT; IRQVECTOR[HDA_IRQ] = hddIT; /* Allows all IT */ _mask(1); if ( argc < 3 ) { printf("Utilisation : %s VOLUME CHEMIN\n", argv[0]); return EXIT_FAILURE; } unsigned int volume = atoi(argv[1]); if ( mount(volume) < 0 ) { printf("Erreur de montage du volume!\n"); return EXIT_FAILURE; } struct file_desc_t fd; printf("Fichier : %s\n", argv[2]); if ( open_file(&fd, argv[2]) >= 0 ) { if ( fd.type != FILET_REG ) { printf("Ce n'est pas un fichier!\n"); close_file(&fd); return EXIT_FAILURE; } char buf[50]; int a; while( (a = read_file(&fd, buf, sizeof(buf)-1)) > 0 ) { buf[a] = '\0'; printf("%s", buf); } printf("\n"); close_file(&fd); } else printf("Ce fichier n'existe pas.\n"); umount(); return EXIT_SUCCESS; }