X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fmain.cc;h=c405bf203fd72732f39f8e098732d923360f53d7;hb=9065046a3fd404f72fb090cb0da65cfa8443032f;hp=d6c4ecbfa59e82c25cbda5802905c291c0632826;hpb=3893029e70c654f4fcf3bf8f8ba5b404afc6d446;p=awesomized%2Flibmemcached diff --git a/libtest/main.cc b/libtest/main.cc index d6c4ecbf..c405bf20 100644 --- a/libtest/main.cc +++ b/libtest/main.cc @@ -34,7 +34,7 @@ * */ -#include +#include "libtest/yatlcon.h" #include #include @@ -220,22 +220,24 @@ int main(int argc, char *argv[]) is_massive(opt_massive); } - char tmp_directory[1024]; + libtest::vchar_t tmp_directory; + tmp_directory.resize(1024); if (getenv("LIBTEST_TMP")) { - snprintf(tmp_directory, sizeof(tmp_directory), "%s", getenv("LIBTEST_TMP")); + snprintf(&tmp_directory[0], tmp_directory.size(), "%s", getenv("LIBTEST_TMP")); } else { - snprintf(tmp_directory, sizeof(tmp_directory), "%s", LIBTEST_TEMP); + snprintf(&tmp_directory[0], tmp_directory.size(), "%s", LIBTEST_TEMP); } - if (chdir(tmp_directory) == -1) + if (chdir(&tmp_directory[0]) == -1) { - char getcwd_buffer[1024]; - char *dir= getcwd(getcwd_buffer, sizeof(getcwd_buffer)); + libtest::vchar_t getcwd_buffer; + getcwd_buffer.resize(1024); + char *dir= getcwd(&getcwd_buffer[0], getcwd_buffer.size()); - Error << "Unable to chdir() from " << dir << " to " << tmp_directory << " errno:" << strerror(errno); + Error << "Unable to chdir() from " << dir << " to " << &tmp_directory[0] << " errno:" << strerror(errno); return EXIT_FAILURE; } @@ -292,7 +294,7 @@ int main(int argc, char *argv[]) return EXIT_SKIP; case TEST_FAILURE: - std::cerr << __FILE__ << ":" << __LINE__ << ": " << "frame->create()" << std::endl; + std::cerr << "frame->create()" << std::endl; return EXIT_FAILURE; } } @@ -329,7 +331,7 @@ int main(int argc, char *argv[]) std::ofstream xml_file; std::string file_name; - file_name.append(tmp_directory); + file_name.append(&tmp_directory[0]); file_name.append(frame->name()); file_name.append(".xml"); xml_file.open(file_name.c_str(), std::ios::trunc); @@ -340,27 +342,27 @@ int main(int argc, char *argv[]) } catch (libtest::fatal& e) { - std::cerr << __FILE__ << ":" << __LINE__ << ": " << "FATAL:" << e.what() << std::endl; + std::cerr << "FATAL:" << e.what() << std::endl; exit_code= EXIT_FAILURE; } catch (libtest::disconnected& e) { - std::cerr << __FILE__ << ":" << __LINE__ << ": " << "Unhandled disconnection occurred:" << e.what() << std::endl; + std::cerr << "Unhandled disconnection occurred:" << e.what() << std::endl; exit_code= EXIT_FAILURE; } catch (std::exception& e) { - std::cerr << __FILE__ << ":" << __LINE__ << ": " << "std::exception:" << e.what() << std::endl; + std::cerr << "std::exception:" << e.what() << std::endl; exit_code= EXIT_FAILURE; } catch (char const*) { - std::cerr << __FILE__ << ":" << __LINE__ << ": " << "Exception:" << std::endl; + std::cerr << "Exception:" << std::endl; exit_code= EXIT_FAILURE; } catch (...) { - std::cerr << __FILE__ << ":" << __LINE__ << ": " << "Unknown exception halted execution." << std::endl; + std::cerr << "Unknown exception halted execution." << std::endl; exit_code= EXIT_FAILURE; }