Update of /cvsroot/com0com/com0com/setup
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27654
Modified Files:
setup.cpp
Log Message:
Added --output option
Index: setup.cpp
===================================================================
RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** setup.cpp 10 Nov 2006 14:07:40 -0000 1.10
--- setup.cpp 21 Nov 2006 11:36:06 -0000 1.11
***************
*** 20,23 ****
--- 20,26 ----
*
* $Log$
+ * Revision 1.11 2006/11/21 11:36:06 vfrolov
+ * Added --output option
+ *
* Revision 1.10 2006/11/10 14:07:40 vfrolov
* Implemented remove command
***************
*** 689,700 ****
SetTitle(C0C_SETUP_TITLE " (HELP)");
! Trace(
C0C_SETUP_TITLE "\n"
"\n");
! Trace(
"Usage:\n"
! " %s<command>\n"
, pCmdPref);
! Trace(
"\n"
"Commands:\n"
--- 692,708 ----
SetTitle(C0C_SETUP_TITLE " (HELP)");
! ConsoleWrite(
C0C_SETUP_TITLE "\n"
"\n");
! ConsoleWrite(
"Usage:\n"
! " %s [options] <command>\n"
, pCmdPref);
! ConsoleWrite(
! "\n"
! "Options:\n"
! " --output <file> - file for output, default is console\n"
! );
! ConsoleWrite(
"\n"
"Commands:\n"
***************
*** 717,753 ****
" help - print this help\n"
);
! Trace(
"\n"
"%s",
PortParameters::GetHelp());
! Trace(
"\n"
"Examples:\n"
);
! Trace(
" %sinstall - -\n"
, pCmdPref);
! Trace(
" %sinstall 5 * *\n"
, pCmdPref);
! Trace(
" %sremove 0\n"
, pCmdPref);
! Trace(
" %sinstall PortName=COM2 PortName=COM4\n"
, pCmdPref);
! Trace(
" %sinstall PortName=COM5,EmuBR=yes,EmuOverrun=yes -\n"
, pCmdPref);
! Trace(
" %schange " C0C_PREF_PORT_NAME_A "0 EmuBR=yes,EmuOverrun=yes\n"
, pCmdPref);
! Trace(
" %slist\n"
, pCmdPref);
! Trace(
" %suninstall\n"
, pCmdPref);
! Trace(
"\n");
--- 725,761 ----
" help - print this help\n"
);
! ConsoleWrite(
"\n"
"%s",
PortParameters::GetHelp());
! ConsoleWrite(
"\n"
"Examples:\n"
);
! ConsoleWrite(
" %sinstall - -\n"
, pCmdPref);
! ConsoleWrite(
" %sinstall 5 * *\n"
, pCmdPref);
! ConsoleWrite(
" %sremove 0\n"
, pCmdPref);
! ConsoleWrite(
" %sinstall PortName=COM2 PortName=COM4\n"
, pCmdPref);
! ConsoleWrite(
" %sinstall PortName=COM5,EmuBR=yes,EmuOverrun=yes -\n"
, pCmdPref);
! ConsoleWrite(
" %schange " C0C_PREF_PORT_NAME_A "0 EmuBR=yes,EmuOverrun=yes\n"
, pCmdPref);
! ConsoleWrite(
" %slist\n"
, pCmdPref);
! ConsoleWrite(
" %suninstall\n"
, pCmdPref);
! ConsoleWrite(
"\n");
***************
*** 757,760 ****
--- 765,785 ----
int Main(int argc, const char* argv[])
{
+ SetOutputFile(NULL);
+
+ while (argc > 1) {
+ if (*argv[1] != '-')
+ break;
+
+ if (!strcmp(argv[1], "--output") && argc > 2) {
+ SetOutputFile(argv[2]);
+ argv[2] = argv[0];
+ argv += 2;
+ argc -= 2;
+ } else {
+ ConsoleWrite("Invalid option %s\n", argv[1]);
+ return 1;
+ }
+ }
+
if (argc == 1) {
return 0;
***************
*** 823,827 ****
}
! Trace("Invalid command\n");
return 1;
--- 848,852 ----
}
! ConsoleWrite("Invalid command\n");
return 1;
***************
*** 868,872 ****
if (argc == 1) {
! Trace("Enter 'help' to get info about usage of " C0C_SETUP_TITLE ".\n\n");
argv[0] = "";
--- 893,897 ----
if (argc == 1) {
! ConsoleWrite("Enter 'help' to get info about usage of " C0C_SETUP_TITLE ".\n\n");
argv[0] = "";
***************
*** 890,894 ****
int res = Main(argc, argv);
! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), "\nPress <RETURN> to continue\n");
return res;
--- 915,920 ----
int res = Main(argc, argv);
! if (!GetOutputFile())
! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), "\nPress <RETURN> to continue\n");
return res;
|