/*****************************************************************************1*2* Elmer, A Finite Element Software for Multiphysical Problems3*4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland5*6* This library is free software; you can redistribute it and/or7* modify it under the terms of the GNU Lesser General Public8* License as published by the Free Software Foundation; either9* version 2.1 of the License, or (at your option) any later version.10*11* This library is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU14* Lesser General Public License for more details.15*16* You should have received a copy of the GNU Lesser General Public17* License along with this library (in file ../LGPL-2.1); if not, write18* to the Free Software Foundation, Inc., 51 Franklin Street,19* Fifth Floor, Boston, MA 02110-1301 USA20*21*****************************************************************************/222324#include <stdio.h>25#include <signal.h>26#include <string.h>27#include "../config.h"2829#ifdef USE_READLINE30# ifdef HAVE_READLINE_READLINE_H31# include <readline/readline.h>32# include <readline/history.h>33# else34# ifdef HAVE_READLINE_H35# include <readline.h>36# include <history.h>37# endif38# endif39#endif4041/* prototype */42char *mtc_domath(char *);43void mtc_init( FILE *, FILE *, FILE *);4445int main( int argc, char **argv )46{47char strt[2000];48char *str;49char *ioptr;50515253(void)mtc_init( stdin, stdout, stderr );54str = mtc_domath( "source(\"mc.ini\")" );5556signal( SIGINT, SIG_IGN );5758while( 1 )59{60#ifdef USE_READLINE61str = readline ("MATC> ");62/* add to history */63if (str && *str)64add_history (str);6566#else67ioptr = fgets( strt, 2000 , stdin);68str = strt;69#endif7071/* kludge to enable exit. */72#if defined(WIN32) || defined(MINGW32)73if( stricmp(str,"exit") == 0 || stricmp(str,"quit") == 0 ||74stricmp(str,"exit\n") == 0 || stricmp(str,"quit\n") == 0 )75#else76if( strcasecmp(str,"exit") == 0 || strcasecmp(str,"quit") == 0 ||77strcasecmp(str,"exit\n") == 0 || strcasecmp(str,"quit\n") == 0 )78#endif79{80return 0;81}82if ( *str ) fprintf( stdout, "%s\n", mtc_domath( str ) );8384#ifdef USE_READLINE85free(str);86#endif87}88return 0;89}909192