string.lib.c
/******************************************** -*-c-*- ***********************************************/
/*                                                                                                  */
/* string.c:                                                                                        */
/*                                                                                                  */
/****************************************************************************************************/

/****************************************************************************************************/
/*                                                                                                  */
/*     Copyright (C) 2004 Joerg Kunze                                                               */
/*                                                                                                  */
/*     This file is part of siliconBrainLib.                                                        */
/*                                                                                                  */
/*     siliconBrainLib is free software; you can redistribute it and/or modify                      */
/*     it under the terms of the GNU General Public License as published by                         */
/*     the Free Software Foundation; either version 2 of the License, or                            */
/*     (at your option) any later version.                                                          */
/*                                                                                                  */
/*     siliconBrainLib is distributed in the hope that it will be useful,                           */
/*     but WITHOUT ANY WARRANTY; without even the implied warranty of                               */
/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                */
/*     GNU General Public License for more details.                                                 */
/*                                                                                                  */
/*     You should have received a copy of the GNU General Public License                            */
/*     along with this program; if not, write to the Free Software                                  */
/*     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                    */
/*                                                                                                  */
/****************************************************************************************************/

// char *siliconBrainRelease       = "$siliconBrainRelease: 0.0.4 $";
// char *siliconBrainRcsIdentifier = "$Id: string.lib.c,v 1.9 2004/12/14 23:09:01 joerg Exp $";
// char *siliconBrainSaveStamp     = "$siliconBrainSaveStamp: 2004/12/14 22:30:57, Joerg Kunze$";

#include <stdio.h>

#include <unistd.h>

#include "siliconBrainLib"

/****************************************************************************************************/
/*                                                                                                  */
/* stringToBool:                                                                                    */
/*                                                                                                  */
/****************************************************************************************************/
extern bool stringToBool( const char *boolString ) {

   if( !boolString ) {
      return false;
   }
   else if( strequ( boolString, "false" ) ) {
      return false;
   }
   else if( strequ( boolString, "true"  ) ) {
      return true;
   }
   else if( strequ( boolString, ""      ) ) {
      return true;
   }
   else {
      fprintf( stderr, "Invalid value for bool variable\n" );
      exit( 42 );
   }
}

/*
$Log: string.lib.c,v $
Revision 1.9  2004/12/14 23:09:01  joerg
published for new release 0.0.4

Revision 1.8  2004/12/14 23:02:56  joerg
published for new release 0.0.3

Revision 1.7  2004/12/14 22:44:36  joerg
allFiles: all sources have a Log CVS keyword at the end now.

*/