diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-12-29 00:22:46 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-12-29 00:22:46 +0000 |
commit | 31ab43723c3de06d6737b62d8faf71841baeba99 (patch) | |
tree | 55b019cb0f16c46831bb4fdeb01de7afcdd98512 /lib | |
parent | f1cfadec34fae419fd3e43c947e579aa6b80678f (diff) |
Avoid using gcc libstdc++ internals that we have no business grotting
around with. Fixes compilation under gcc 3.2. OK espie@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcurses++/cursesw.cc | 41 | ||||
-rw-r--r-- | lib/libcurses++/cursesw.h | 9 |
2 files changed, 17 insertions, 33 deletions
diff --git a/lib/libcurses++/cursesw.cc b/lib/libcurses++/cursesw.cc index 8898991746c..c817e931ae9 100644 --- a/lib/libcurses++/cursesw.cc +++ b/lib/libcurses++/cursesw.cc @@ -45,43 +45,36 @@ bool NCursesWindow::b_initialized = FALSE; int NCursesWindow::scanw(const char* fmt, ...) { -#if defined(__GNUG__) - va_list args; - va_start(args, fmt); + int result = ERR; char buf[BUFSIZ]; - int result = wgetstr(w, buf); - if (result == OK) { - strstreambuf ss(buf, sizeof(buf)); - result = ss.vscan(fmt, (_IO_va_list)args); + + if (::wgetnstr(w, buf, sizeof(buf)) != ERR) { + va_list args; + va_start(args, fmt); + if (::vsscanf(buf, fmt, args) != -1) + result = OK; + va_end(args); } - va_end(args); return result; -#else - return ERR; -#endif } int NCursesWindow::scanw(int y, int x, const char* fmt, ...) { -#if defined(__GNUG__) - va_list args; - va_start(args, fmt); + int result = ERR; char buf[BUFSIZ]; - int result = wmove(w, y, x); - if (result == OK) { - result = wgetstr(w, buf); - if (result == OK) { - strstreambuf ss(buf, sizeof(buf)); - result = ss.vscan(fmt, (_IO_va_list)args); + + if (::wmove(w, y, x) != ERR) { + if (::wgetnstr(w, buf, sizeof(buf)) != ERR) { + va_list args; + va_start(args, fmt); + if (::vsscanf(buf, fmt, args) != -1) + result = OK; + va_end(args); } } - va_end(args); return result; -#else - return ERR; -#endif } diff --git a/lib/libcurses++/cursesw.h b/lib/libcurses++/cursesw.h index 135bc835784..209d1d223f8 100644 --- a/lib/libcurses++/cursesw.h +++ b/lib/libcurses++/cursesw.h @@ -7,15 +7,6 @@ #include <etip.h> #include <stdio.h> #include <stdarg.h> -#ifdef __MWERKS__ -/* This is a bogus check, stringstream is actually ANSI C++ standard, - * but old compilers like GCC don't have it, and new compilers like Metrowerks - * don't have strstream - */ -#include <sstream> -#else -#include <strstream.h> -#endif extern "C" { # include <curses.h> |