/*--------------------------------------------------------------------
 * FICHERO:  CnfAbre.c
 * OBJETIVO: Definir la funcin Cnf_Abre()
 * AUTOR:    Pedro Reina
 * FECHA:    L.29.5.1995
 *------------------------------------------------------------------*/

/*--------------------------------------------------------------------
 * Ficheros de cabecera
 *------------------------------------------------------------------*/

#include "Config.h"

/*--------------------------------------------------------------------
 * Definicin de funciones
 *------------------------------------------------------------------*/

/*--------------------------------------------------------------Olimpo
 * FUNCION:  Cnf_Abre()
 * OBJETIVO: Abrir un fichero de configuracin
 * ENTRADAS: El nombre del fichero
 * SALIDAS:  Un objeto config o NIL si ha habido algn error
 * EJEMPLO:  Cnf_Abre ( "Datos.dat" )
 *------------------------------------------------------------------*/
config Cnf_Abre (Nombre)
cadena Nombre;
  {
  config  Nuevo;
  fichero Fichero;

  if ( Nuevo = (config) Mem_Crea (sizeof(Cnf_st)) )
    {
    if ( Fichero = Fch_AbreLeer (Nombre,FCH_TEXTO) )
      {
      Cnf_PonFichero (Nuevo, Fichero);
      Cnf_PonLinea (Nuevo, 0);
      }

    else
      {
      Mem_Destruye (Nuevo);
      Nuevo = NIL;
      }
    }

  return ( Nuevo ) ;
  }
