The logic comes up with three ways that "prototype" could be a
completion for a function name followed by a period, so just make
sure that we end up with only one in the final list. Also, convert
tabs to spaces and fix up for code style in shellAutocomplete().
Provide command completions for partially typed commands without
requiring case-correctness in the partially typed command. The
completion (replacement) text is always case-correct, it's just
the to-be-replaced text that is now case-insensitive.
Make the mongo shell's 'edit' command work in Windows. Change
the code to use C file stream functions instead of Unix low level
IO (fopen instead of open), close and reopen the file so there are
fewer OS dependencies, delete (remove()) the file ourselves where
needed. Also, remove #ifdefs are are now constant (USE_LINENOISE,
USE_TABCOMPLETION) and the unused code they supported, and try to
get the entire source file to adhere to the kernel code style.
We no longer need mongo_vstudio.cpp and it is removed from the Git
repository with this commit. Visual Studio 2010 will now generate its
own copies of shell/mongo.cpp and shell/mongo-server.cpp. The code
that creates these files closely mimics the jsToH function in SConstruct
such that the resulting files are identical (quirks and all).
SConstruct no longer creates shell/mongo_vstudio.cpp and Visual Studio
creates and uses the same filename as SCons (shell/mongo.cpp). All
projects that were using mongo_vstudio.cpp will now instead generate
shell/mongo.cpp as a "Pre-Build" step.
Remove the duplicate db.getMongo().setSlaveOk() help line from db.help()
(I kept the one with the more terse text), remove an extraneous space
from the end of db.getProfilingStatus(), sort the lines alphabetically.
Track the strdup-ed (i.e. malloc-ed) strings returned by linenoise, and
free the memory when we are done with it. Free command line history
memory explicitly when we save the history to a file and stop using it.
Non-Windows versions were freeing this memory using an atexit handler,
but this handler isn't set up for Windows.