An interactive cross-platform command-line shell. Menusys facilitates the creation of programs that provide a scriptable command-line for user interaction. Standard command line functionality is provided by this library, for instance, command help, options, file handling, scripting, timing, and loops. Only the commands for your own functionality (e.g. stress test clients, C or C++ API testing) needs to be implemented. It is designed explicitly to be portable to any platform and has been tested on Windows and Linux. Released as open-source and free using the MIT licence.
Documentation
Full documentation of the interface is available in either online documentation or as a separate download.
Downloads
The current version of menusys is 1.2 (last updated: 20 June 2007)
Download menusys-1.2.zip (about 50Kb)
Download Doxygen documentation (about 90Kb)
Source Repository
Full source code and test program are included in the download. The homepage of the project is here, however the source repository is stored at google code.
Features
- MIT Licence allows free use in all software (including GPL and commercial)
- multi-platform (Windows 95/98/ME/NT/2K/XP, Linux, Unix)
- full command line parsing into commands and arguments
- summary and extended help for internal and user commands
- MBCS and UNICODE input/output (current locale and UTF-8)
- generic file system commands (e.g. cd, pwd, shell)
- timing and timing analysis (multiple timers, lap timers)
- multiple threads (start, stop, join)
- simple procedures and loops
- easy to use with implementation in only 2 files: header and source
- supports both MBCS and UNICODE build types on Windows
- compiles cleanly at warning level 4 (Windows/VC.NET 2003), warning level 3 (Windows/VC6) and -Wall (Linux/gcc)
Usage
The following steps are required to file main.cpp included with the menusys distribution implements the minimal menusys-based program.
-
Include the menusys.h header file. It is recommended to also include the <locale.h> header and call setlocale() in main().
#include <locale.h> #include "menusys.h"
-
Provide implementations for the functions MSYS_ThreadUserCreate(), MSYS_ThreadUserDestroy(), and MSYS_GetPrompt().
-
Define an array of MSYS_DispatchEntry entries as MSYS_Commands. This is the command definition and help text for each command implemented by you. The internal menusys commands will be automatically added to this list.
-
Implement the main() function and call MSYS_Process().
int _tmain( int argc, TCHAR * argv[] ) { setlocale(LC_ALL, ""); fprintf(stdout, "MENUSYS\n\n"); const TCHAR * pInputFile = (argc > 1) ? argv[1] : NULL; return MSYS_Process(pInputFile, true) ? 0 : 1; }Change History
1.2 (20 June 2007)
Fixed handling of command line quoting and handling of backslashes. Changed help so internal and external help is separate and only external help is displayed by default.1.1 (18 June 2007)
Re-upload of version 1.1 because I forgot to remove an incorrect assertion.1.1 (17 June 2007)
Added support for automatic loading of properties. Manual saving and loading of properties. Better thread support for properties.1.0 (21 May 2007)
Initial release