X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/5df9bdcff11e0a64b9c05ca5294d6edf0a62603f..eb9e911d67728e6729bff9ea6d05ac3a9c6c8d00:/emufs/emufs.c?ds=sidebyside diff --git a/emufs/emufs.c b/emufs/emufs.c index 33c114a..7bbc3b0 100644 --- a/emufs/emufs.c +++ b/emufs/emufs.c @@ -266,9 +266,10 @@ int ver_archivo_FS(EMUFS *emu) fprintf(stderr, "no pude abrir el archivo %s\n",name_f_block_free); return -1; } + fprintf(stderr,"BOQUES Y ESPACIO LIBRE\n"); fread(®,sizeof(reg),1,f_block_free); while ( !feof(f_block_free) ){ - fprintf(stderr, " Bloque = %li Espacio libre = %li\n",reg.marker, reg.freespace); + fprintf(stderr, "Bloque = %li Espacio libre = %li\n",reg.marker, reg.freespace); fread(®,sizeof(reg),1,f_block_free); } @@ -278,17 +279,15 @@ int ver_archivo_FS(EMUFS *emu) fprintf(stderr, "BLOQUES Y REGISTROS\n"); strcpy(name_f_block_free,emu->nombre); strcat(name_f_block_free,".idx"); + f_block_free = fopen(name_f_block_free, "r"); { EMUFS_IDX r; - f_block_free = fopen(name_f_block_free, "r"); - fread(&r, sizeof(EMUFS_IDX), 1, f_block_free); while (!feof(f_block_free)) { + if (fread(&r, sizeof(EMUFS_IDX), 1, f_block_free) != 1) continue; fprintf(stderr, "ID %li en bloque %li\n", r.id_reg, r.location); - fread(&r, sizeof(EMUFS_IDX), 1, f_block_free); } - fclose(f_block_free); } - + fclose(f_block_free); return 0; }