diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-27 22:38:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-27 22:38:18 +0000 |
commit | 55e45a0d588de0392d2198753e45d75cd58f9e4d (patch) | |
tree | 358fbf59150b403df32a1cdce8203a6a430df110 /Build/source/utils/asymptote/interact.cc | |
parent | 7aca5de4dcd646af709f86123599cdcb45d6445f (diff) |
asy 2.26 sources
git-svn-id: svn://tug.org/texlive/trunk@33703 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/interact.cc')
-rw-r--r-- | Build/source/utils/asymptote/interact.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/interact.cc b/Build/source/utils/asymptote/interact.cc index 044b46fc6e8..cc172984ac8 100644 --- a/Build/source/utils/asymptote/interact.cc +++ b/Build/source/utils/asymptote/interact.cc @@ -13,6 +13,7 @@ #include <unistd.h> #include <csignal> #include <cstdio> +#include <cstring> #include "interact.h" #include "runhistory.h" @@ -85,10 +86,21 @@ FILE *fin=NULL; char *readpipeline(const char *prompt) { +#if _POSIX_VERSION >= 200809L char *line=NULL; size_t n; getline(&line,&n,fin); return line; +#else + const int max_size=256; + static char buf[max_size]; + ostringstream s; + do { + if(fgets(buf,max_size-1,fin) == NULL) break; + s << buf; + } while(buf[std::strlen(buf)-1] != '\n'); + return StrdupMalloc(s.str()); +#endif } void pre_readline() |