Beispiel #1
0
int
main(int argc, const char *argv[])
{
  apr_pool_t *pool;
  int exit_code = EXIT_SUCCESS;
  svn_error_t *err;

  /* Initialize the app. */
  if (svn_cmdline_init("svnraisetreeconflict", stderr) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  /* Create our top-level pool.  Use a separate mutexless allocator,
   * given this application is single threaded.
   */
  pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));

  err = sub_main(&exit_code, argc, argv, pool);

  /* Flush stdout and report if it fails. It would be flushed on exit anyway
     but this makes sure that output is not silently lost if it fails. */
  err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));

  if (err)
    {
      exit_code = EXIT_FAILURE;
      svn_cmdline_handle_exit_error(err, NULL, "svnraisetreeconflict: ");
    }

  svn_pool_destroy(pool);
  return exit_code;
}
Beispiel #2
0
int
main(int argc, const char *argv[])
{
  apr_pool_t *pool;
  int exit_code = EXIT_SUCCESS;
  svn_error_t *err;

  /* Initialize the app.  Send all error messages to 'stderr'.  */
  if (svn_cmdline_init(argv[0], stderr) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  pool = svn_pool_create(NULL);

  err = sub_main(&exit_code, argc, argv, pool);

  /* Flush stdout and report if it fails. It would be flushed on exit anyway
     but this makes sure that output is not silently lost if it fails. */
  err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));

  if (err)
    {
      if (exit_code == 0)
        exit_code = EXIT_FAILURE;
      svn_cmdline_handle_exit_error(err, NULL, "svnauthz: ");
    }

  svn_pool_destroy(pool);
  return exit_code;
}
Beispiel #3
0
int
main(int argc, const char *argv[])
{
  apr_pool_t *pool;
  int exit_code = EXIT_SUCCESS;
  svn_error_t *err;

  /* Initialize the app. */
  if (svn_cmdline_init("svnserve", stderr) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  /* Create our top-level pool. */
  pool = apr_allocator_owner_get(svn_pool_create_allocator(TRUE));

  err = sub_main(&exit_code, argc, argv, pool);

  /* Flush stdout and report if it fails. It would be flushed on exit anyway
     but this makes sure that output is not silently lost if it fails. */
  err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));

  if (err)
    {
      exit_code = EXIT_FAILURE;
      svn_cmdline_handle_exit_error(err, NULL, "svnserve: ");
    }

#if APR_HAS_THREADS
  /* Explicitly wait for all threads to exit.  As we found out with similar
     code in our C test framework, the memory pool cleanup below cannot be
     trusted to do the right thing. */
  if (threads)
    apr_thread_pool_destroy(threads);
#endif

  /* this will also close the server's socket */
  svn_pool_destroy(pool);
  return exit_code;
}
Beispiel #4
0
int main(int argc, char** argv, char** env)
{
	// 將所有參數存起來
	try
	{g_app.Set(argv, env);}
	catch(std::exception& exp)
	{std::cout << "threw an exception \"" << exp.what() << "\"." << std::endl;}
	catch(const char* errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(const std::string& errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(...)
	{std::cout << "threw an unknown exception."<< std::endl;}


	// 主程式
	try
	{sub_main();}
	catch(std::exception& exp)
	{std::cout << "threw an exception \"" << exp.what() << "\"." << std::endl;}
	catch(const char* errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(const std::string& errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(...)
	{std::cout << "threw an unknown exception."<< std::endl;}


	// 確保資源一定會釋放
	try
	{if(g_ptrMainProc.get()!=NULL)	g_ptrMainProc->Release();}
	catch(std::exception& exp)
	{std::cout << "threw an exception \"" << exp.what() << "\"." << std::endl;}
	catch(const char* errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(const std::string& errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(...)
	{std::cout << "threw an unknown exception."<< std::endl;}


	// g_app
	try
	{g_app.Release();}
	catch(std::exception& exp)
	{std::cout << "threw an exception \"" << exp.what() << "\"." << std::endl;}
	catch(const char* errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(const std::string& errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(...)
	{std::cout << "threw an unknown exception."<< std::endl;}


	// 釋放g_sigmsg
	try
	{g_sigmsg.Release();}
	catch(std::exception& exp)
	{std::cout << "threw an exception \"" << exp.what() << "\"." << std::endl;}
	catch(const char* errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(const std::string& errMsg)
	{std::cout << "threw an exception \"" << errMsg << "\"." << std::endl;}
	catch(...)
	{std::cout << "threw an unknown exception."<< std::endl;}

	return 0;
}