00001 // more/readline.h -- a wrapper around the autoconf test for readline 00002 // Copyright (C) 2001 Petter Urkedal (petter.urkedal@matfys.lth.se) 00003 // 00004 // This file is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This file is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 // 00018 // As a special exception, you may use this file as part of a free 00019 // software library without restriction. Specifically, if other files 00020 // instantiate templates or use macros or inline functions from this 00021 // file, or you compile this file and link it with other files to 00022 // produce an executable, this file does not by itself cause the 00023 // resulting executable to be covered by the GNU General Public 00024 // License. This exception does not however invalidate any other 00025 // reasons why the executable file might be covered by the GNU General 00026 // Public License. 00027 // 00028 // $Id: readline.h,v 1.1 2002/05/30 18:01:37 petter_urkedal Exp $ 00029 00030 00031 #ifndef MORE_READLINE_H 00032 #define MORE_READLINE_H 00033 00034 #include <more/bits/config.h> 00035 #if (defined(HAVE_READLINE_H) || defined(HAVE_READLINE_READLINE_H)) && \ 00036 (defined(HAVE_HISTORY_H) || defined(HAVE_READLINE_HISTORY_H)) && \ 00037 defined(HAVE_READLINE) 00038 #define MORE_HAVE_READLINE 1 00039 #endif 00040 00041 namespace more { 00042 namespace io { 00043 00044 /** Prompt the user for input. Readline is used if it was detected 00045 by configure, otherwise the \c std::cout and \c std::cin are 00046 used. */ 00047 char* readline(char* prompt); 00048 00049 /** Add a history item to the readline history. If readline was not 00050 detected by configure, this function does nothing. */ 00051 void add_history(char* ln); 00052 } 00053 } 00054 00055 #endif