diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-29 05:44:06 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-29 05:44:06 +0000 |
commit | af20dc6685ea32900412e91144a15a28c7272a8c (patch) | |
tree | d1f085524babe3f7aa01b9387f4ca4c3caa3744a /examples | |
parent | 482e49d77e96f4f68887fea46cceeec932b60aef (diff) | |
download | ATCD-af20dc6685ea32900412e91144a15a28c7272a8c.tar.gz |
ChangeLogTag:Wed Mar 28 21:39:26 2001 Darrell Brunsch <brunsch@uci.edu>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/NT_Service/main.cpp | 20 | ||||
-rw-r--r-- | examples/OS/Process/process.cpp | 198 | ||||
-rw-r--r-- | examples/Reactor/WFMO_Reactor/test_directory_changes.cpp | 8 |
3 files changed, 114 insertions, 112 deletions
diff --git a/examples/NT_Service/main.cpp b/examples/NT_Service/main.cpp index 304758b118b..74472b4af4d 100644 --- a/examples/NT_Service/main.cpp +++ b/examples/NT_Service/main.cpp @@ -31,11 +31,11 @@ public: Process (void); ~Process (void); - int run(int argc, char* argv[]); + int run(int argc, ACE_TCHAR* argv[]); private: void parse_args (int argc, - char* argv[]); + ACE_TCHAR* argv[]); void print_usage_and_die (void); private: @@ -90,9 +90,9 @@ Process::print_usage_and_die (void) } void -Process::parse_args (int argc, char* argv[]) +Process::parse_args (int argc, ACE_TCHAR* argv[]) { - ACE_Get_Opt get_opt (argc, argv, "i:rskt:d"); + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("i:rskt:d")); int c; while ((c = get_opt ()) != -1) @@ -125,7 +125,7 @@ Process::parse_args (int argc, char* argv[]) default: // -i can also be given without a value - if so, it defaults // to defined value. - if (ACE_OS::strcmp (get_opt.argv_[get_opt.optind-1], "-i") == 0) + if (ACE_OS::strcmp (get_opt.argv_[get_opt.optind-1], ACE_TEXT ("-i")) == 0) { opt_install = 1; opt_startup = DEFAULT_SERVICE_INIT_STARTUP; @@ -149,13 +149,13 @@ ConsoleHandler (DWORD ctrlType) ACE_NT_SERVICE_DEFINE (Beeper, Service, - "Annoying Beeper Service"); + ACE_TEXT ("Annoying Beeper Service")); int -Process::run (int argc, char* argv[]) +Process::run (int argc, ACE_TCHAR* argv[]) { - SERVICE::instance ()->name ("Beeper", - "Annoying Beeper Service"); + SERVICE::instance ()->name (ACE_TEXT ("Beeper"), + ACE_TEXT ("Annoying Beeper Service")); parse_args (argc, argv); @@ -200,7 +200,7 @@ Process::run (int argc, char* argv[]) } int -main (int argc, char* argv[]) +main (int argc, ACE_TCHAR* argv[]) { return PROCESS::instance ()->run (argc, argv); } diff --git a/examples/OS/Process/process.cpp b/examples/OS/Process/process.cpp index fd33ff7f4b7..a920926ee00 100644 --- a/examples/OS/Process/process.cpp +++ b/examples/OS/Process/process.cpp @@ -59,49 +59,49 @@ parse_args (int argc, char **argv) switch (c) { case 't': - run_tokenizer = 1; - break; + run_tokenizer = 1; + break; case 's': - run_setenv = 1; - break; + run_setenv = 1; + break; case 'a': - run_all = 1; - break; + run_all = 1; + break; case 'd': - run_date = 1; - break; + run_date = 1; + break; case 'l': - run_ls = 1; - break; + run_ls = 1; + break; case 'x': - executable = get_opt.optarg; - break; + executable = get_opt.optarg; + break; case 'p': - print_file = get_opt.optarg; - break; + print_file = get_opt.optarg; + break; case 'e': - environment_string = get_opt.optarg; - break; + environment_string = get_opt.optarg; + break; case 'g': - get_env = 1; - break; + get_env = 1; + break; case 'w': - run_wait = 1; - break; + run_wait = 1; + break; case 'u': default: - ACE_ERROR_RETURN ((LM_ERROR, "Usage:\n" - "-d print date\n" - "-l run ls\n" - "-x <executable=more.com>\n" - "-p print <file_name>\n" - "-e <env variable message>\n" - "-s setenv ACE_PROCESS_ENV and spawn -g\n" - "-g get_env ACE_PROCESS_ENV\n" - "-t test tokenizer\n" - "-w test wait functions\n" - "-a run all (d,l,e \"running\")\n"), -1); - break; + ACE_ERROR_RETURN ((LM_ERROR, "Usage:\n" + "-d print date\n" + "-l run ls\n" + "-x <executable=more.com>\n" + "-p print <file_name>\n" + "-e <env variable message>\n" + "-s setenv ACE_PROCESS_ENV and spawn -g\n" + "-g get_env ACE_PROCESS_ENV\n" + "-t test tokenizer\n" + "-w test wait functions\n" + "-a run all (d,l,e \"running\")\n"), -1); + break; } } @@ -130,7 +130,7 @@ test_more (void) int error = ACE_OS::last_error (); ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_more", + "test_more", error)); } @@ -160,7 +160,7 @@ test_date (void) int error = ACE_OS::last_error (); ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_date", + "test_date", error)); return; } @@ -186,7 +186,7 @@ test_ls (void) int error = ACE_OS::last_error (); ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_ls", + "test_ls", error)); } @@ -209,7 +209,7 @@ test_wait (void) int error = ACE_OS::last_error (); ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_ls", + "test_ls", error)); } @@ -239,7 +239,7 @@ test_wait (void) int error = ACE_OS::last_error (); ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_ls", + "test_ls", error)); } @@ -269,12 +269,12 @@ static void win32_test_ls (void) { PROCESS_INFORMATION process_info; - STARTUPINFO startup_info; + ACE_TEXT_STARTUPINFO startup_info; ACE_OS::memset ((void *) &startup_info, - 0, + 0, sizeof startup_info); ACE_OS::memset ((void *) &process_info, - 0, + 0, sizeof process_info); startup_info.cb = sizeof startup_info; startup_info.dwFlags = STARTF_USESTDHANDLES; @@ -282,12 +282,12 @@ win32_test_ls (void) ACE_HANDLE std_out = ACE_STDOUT; if (!::DuplicateHandle (::GetCurrentProcess (), - std_out, - ::GetCurrentProcess (), - &startup_info.hStdOutput, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) + std_out, + ::GetCurrentProcess (), + &startup_info.hStdOutput, + NULL, + TRUE, + DUPLICATE_SAME_ACCESS)) { ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", @@ -296,16 +296,16 @@ win32_test_ls (void) } BOOL fork_result = - ::CreateProcess ("c:\\Utils\\bin\\ls.exe", - "-a", - NULL, // No process attributes. - NULL, // No thread attributes. - TRUE, // Allow handle inheritance. - NULL, // CREATE_NEW_CONSOLE, // Create a new console window. - NULL, - 0, // Current directory to start in. - &startup_info, - &process_info); + ACE_TEXT_CreateProcess ("c:\\Utils\\bin\\ls.exe", + "-a", + NULL, // No process attributes. + NULL, // No thread attributes. + TRUE, // Allow handle inheritance. + NULL, // CREATE_NEW_CONSOLE, // Create a new console window. + NULL, + 0, // Current directory to start in. + &startup_info, + &process_info); ::CloseHandle (startup_info.hStdOutput); @@ -331,12 +331,12 @@ static void win32_spawn_environment_process (void) { PROCESS_INFORMATION process_info; - STARTUPINFO startup_info; + ACE_TEXT_STARTUPINFO startup_info; ACE_OS::memset ((void *) &startup_info, - 0, + 0, sizeof startup_info); ACE_OS::memset ((void *) &process_info, - 0, + 0, sizeof process_info); startup_info.cb = sizeof (startup_info); startup_info.dwFlags = STARTF_USESTDHANDLES; @@ -346,12 +346,12 @@ win32_spawn_environment_process (void) ACE_HANDLE std_err = ACE_STDERR; if (!::DuplicateHandle (::GetCurrentProcess(), - std_out, - ::GetCurrentProcess(), - &startup_info.hStdOutput, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) + std_out, + ::GetCurrentProcess(), + &startup_info.hStdOutput, + NULL, + TRUE, + DUPLICATE_SAME_ACCESS)) { ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", "spawn_environment_process")); @@ -359,12 +359,12 @@ win32_spawn_environment_process (void) } if (!::DuplicateHandle (::GetCurrentProcess(), - std_err, - ::GetCurrentProcess(), - &startup_info.hStdError, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) + std_err, + ::GetCurrentProcess(), + &startup_info.hStdError, + NULL, + TRUE, + DUPLICATE_SAME_ACCESS)) { ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", @@ -373,12 +373,12 @@ win32_spawn_environment_process (void) } if (!::DuplicateHandle (::GetCurrentProcess(), - std_in, - ::GetCurrentProcess(), - &startup_info.hStdInput, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) + std_in, + ::GetCurrentProcess(), + &startup_info.hStdInput, + NULL, + TRUE, + DUPLICATE_SAME_ACCESS)) { ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", @@ -386,34 +386,36 @@ win32_spawn_environment_process (void) return; } - char *existing_environment = ::GetEnvironmentStrings (); + // Normally, this would be just GetEnvironmentStrings, but it + // doesn't follow the same rules as the rest of the Win32 API + char *existing_environment = ACE_OS::getenvstrings (); char environment[10240]; ACE_OS::sprintf (environment, "ACE_PROCESS_TEST=%s", - environment_string); + environment_string); int size = 0; while (existing_environment[size] != '\0') size += ACE_OS::strlen (existing_environment + size) + 1; ACE_OS::memcpy (environment + (ACE_OS::strlen (environment) + 1), - existing_environment, - size); + existing_environment, + size); - ::FreeEnvironmentStrings (existing_environment); + ACE_TEXT_FreeEnvironmentStrings (existing_environment); BOOL fork_result = - ::CreateProcess ("d:\\harrison\\ACE_wrappers\\examples\\OS\\Process\\process.exe", - "process -g", - NULL, // No process attributes. - NULL, // No thread attributes. - TRUE, // Allow handle inheritance. - NULL, // CREATE_NEW_CONSOLE, // Create a new console window. - environment, // Environment. - //"d:\\harrison\\ACE_wrappers\\examples\\OS\\Process\\", - 0, - &startup_info, - &process_info); + ACE_TEXT_CreateProcess ("d:\\harrison\\ACE_wrappers\\examples\\OS\\Process\\process.exe", + "process -g", + NULL, // No process attributes. + NULL, // No thread attributes. + TRUE, // Allow handle inheritance. + NULL, // CREATE_NEW_CONSOLE, // Create a new console window. + environment, // Environment. + //"d:\\harrison\\ACE_wrappers\\examples\\OS\\Process\\", + 0, + &startup_info, + &process_info); ::CloseHandle (startup_info.hStdOutput); ::CloseHandle (startup_info.hStdError); @@ -471,7 +473,7 @@ tokenize (char *buffer) { temp = parser.next (); if (temp == 0) - break; + break; ACE_DEBUG ((LM_DEBUG, temp)); ACE_DEBUG ((LM_DEBUG, @@ -499,7 +501,7 @@ main (int argc, char *argv[]) argv[0]); ACE_Process process; if (process.spawn (options) == -1) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); @@ -523,9 +525,9 @@ main (int argc, char *argv[]) char *value2 = ACE_OS::getenv ("ACE_PROCESS_TEST2"); ACE_DEBUG ((LM_DEBUG, "ACE_PROCESS_TEST = %s.\n" - "ACE_PROCESS_TEST2 = %s.\n", - value == 0 ? "no value" : value, - value2 == 0 ? "no value" : value2)); + "ACE_PROCESS_TEST2 = %s.\n", + value == 0 ? "no value" : value, + value2 == 0 ? "no value" : value2)); } if (run_ls) diff --git a/examples/Reactor/WFMO_Reactor/test_directory_changes.cpp b/examples/Reactor/WFMO_Reactor/test_directory_changes.cpp index fbcc5367a4d..48c486380cb 100644 --- a/examples/Reactor/WFMO_Reactor/test_directory_changes.cpp +++ b/examples/Reactor/WFMO_Reactor/test_directory_changes.cpp @@ -46,10 +46,10 @@ Event_Handler::Event_Handler (ACE_Reactor &reactor) int change_notification_flags = FILE_NOTIFY_CHANGE_FILE_NAME; - this->handle_ = ::FindFirstChangeNotification (directory, // pointer to name of directory to watch - FALSE, // flag for monitoring directory or directory tree - change_notification_flags // filter conditions to watch for - ); + this->handle_ = ACE_TEXT_FindFirstChangeNotification (directory, // pointer to name of directory to watch + FALSE, // flag for monitoring directory or directory tree + change_notification_flags // filter conditions to watch for + ); if (this->handle_ == ACE_INVALID_HANDLE) ACE_ERROR ((LM_ERROR, "FindFirstChangeNotification could not be setup\n")); |