$NetBSD: patch-bg,v 1.2 2001/05/17 20:28:19 jlam Exp $ --- src/lib/private.c.orig Thu Jan 2 13:33:34 1997 +++ src/lib/private.c @@ -18,14 +18,19 @@ // // 03/03/93 Brad Appleton // - Added exit_handler() and quit() member-functions to CmdLine +// +// 08/16/00 Johnny Lam +// - Wrapped in namespace cmdline +// - Updated to follow ISO C++ standard +// - Find readline.h in newer versions of readline //-^^--------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include extern "C" { int isatty(int fd); @@ -48,8 +53,14 @@ #include "cmdline.h" #include "states.h" -#include "arglist.h" +namespace cmdline { + +using std::cerr; +using std::cin; +using std::isupper; +using std::ostrstream; +using std::tolower; // Need a portable version of tolower // @@ -236,7 +247,7 @@ // ^FUNCTION: CmdLine::prompt_user - prompt the user for a missing argument // // ^SYNOPSIS: -// unsigned CmdLine::prompt_user(cmdarg); +// unsigned int CmdLine::prompt_user(cmdarg); // // ^PARAMETERS: // CmdArg * cmdarg; @@ -274,7 +285,7 @@ // - if an invalid value was given return ARG_MISSING // - else return 0 //-^^---- -unsigned +unsigned int CmdLine::prompt_user(CmdArg * cmdarg) { // dont prompt if cin or cerr is not interactive @@ -316,7 +327,7 @@ // try to handle the value we read (remember - buf is temporary) if (! errs) { const char * arg = buf; - unsigned save_cmd_flags = cmd_flags; + unsigned int save_cmd_flags = cmd_flags; cmd_flags |= TEMP; errs = handle_arg(cmdarg, arg); if (errs) { @@ -387,7 +398,7 @@ // ^FUNCTION: CmdLine::missing_args - check for missing required arguments // // ^SYNOPSIS: -// unsigned CmdLine::missing_args(void); +// unsigned int CmdLine::missing_args(void); // // ^PARAMETERS: // @@ -424,7 +435,7 @@ // endfor // return the current cmd-status //-^^---- -unsigned +unsigned int CmdLine::missing_args(void) { char buf[256]; @@ -649,3 +660,5 @@ } //for list_iter return last_pos_list ; } + +} // namespace cmdline