/*
	Programa de prueba que vuelca el contenido de un fichero básico

	Uso: vuelca nombre_disco nombre_fichero 
*/

#include "sfbasico.h"
#include "errores.h"

#include <stdio.h>


main (int argc,char* argv[])
{
  IFB ifb;
  char* bufer;
  WORD num_bloques;
  int i,tam_bloque_datos;

  if (argc<2) return 1;

  MontaSFB(argv[1],0);
  tam_bloque_datos = TamBloqueDatos();
  bufer = (char*)malloc(tam_bloque_datos);
  ifb = BuscaFB(argv[2]);
  if (HAY_ERROR) return 2;
  
  num_bloques = LongitudFB(ifb);
  for (i=0;i<num_bloques;i++)
  {
    int k;
    LeeBloqueFB(ifb,i,bufer);
    for (k=0;k<tam_bloque_datos;k++)
      putchar(bufer[k]);
  }

  DesmontaSFB();
  if (HAY_ERROR) return 2;
}