utils/readline: use fmt-based apis

This commit is contained in:
Dirk-Jan C. Binnema
2023-07-25 21:22:51 +03:00
parent 9580d11fef
commit 11c807f955

View File

@ -1,5 +1,5 @@
/* /*
** Copyright (C) 2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** Copyright (C) 2020-2023 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the ** under the terms of the GNU General Public License as published by the
@ -16,15 +16,13 @@
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
** **
*/ */
#include "mu-readline.hh"
#include "config.h" #include "config.h"
#include <iostream> #include "mu-utils.hh"
#include <unistd.h> #include "mu-readline.hh"
#include <string> #include <string>
#include <glib.h> #include <unistd.h>
#include <glib/gprintf.h>
#ifdef HAVE_LIBREADLINE #ifdef HAVE_LIBREADLINE
#if defined(HAVE_READLINE_READLINE_H) #if defined(HAVE_READLINE_READLINE_H)
@ -72,7 +70,6 @@ Mu::have_readline()
return HAVE_READLINE != 0; return HAVE_READLINE != 0;
} }
void void
Mu::setup_readline(const std::string& histpath, size_t maxlines) Mu::setup_readline(const std::string& histpath, size_t maxlines)
{ {
@ -120,7 +117,7 @@ Mu::read_line(bool& do_quit)
#endif /*HAVE_READLINE*/ #endif /*HAVE_READLINE*/
std::string line; std::string line;
std::cout << ";; mu> "; mu_print(";; mu> ");
if (!std::getline(std::cin, line)) if (!std::getline(std::cin, line))
do_quit = true; do_quit = true;