xrdp/xrdp/xrdp.c

68 lines
1.7 KiB
C
Raw Normal View History

2004-08-03 11:39:35 +08:00
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2004-09-27 11:26:07 +08:00
xrdp: A Remote Desktop Protocol server.
2005-01-07 09:37:57 +08:00
Copyright (C) Jay Sorg 2004-2005
2004-08-03 11:39:35 +08:00
main program
*/
#include "xrdp.h"
static struct xrdp_listen* g_listen = 0;
/*****************************************************************************/
/* i can't get stupid in_val to work, hum using global var for now */
2004-10-21 11:18:23 +08:00
THREAD_RV THREAD_CC xrdp_listen_run(void* in_val)
2004-08-03 11:39:35 +08:00
{
2004-10-06 11:35:59 +08:00
DEBUG(("listener started\n\r"));
2004-08-03 11:39:35 +08:00
xrdp_listen_main_loop(g_listen);
2004-10-06 11:35:59 +08:00
DEBUG(("listener done\n\r"));
2004-08-03 11:39:35 +08:00
return 0;
}
//#define CLEAN_CLOSE
2004-08-03 11:39:35 +08:00
/*****************************************************************************/
int main(int argc, char** argv)
{
int rv;
2004-09-12 05:27:39 +08:00
g_init_system();
2004-08-03 11:39:35 +08:00
rv = 0;
g_listen = xrdp_listen_create();
#ifdef CLEAN_CLOSE
2004-08-03 11:39:35 +08:00
if (g_thread_create(xrdp_listen_run, 0) == 0)
{
g_getchar();
g_set_term(1);
while (g_listen->status > 0)
{
2004-08-03 11:39:35 +08:00
g_sleep(100);
}
2004-08-03 11:39:35 +08:00
}
else
{
2004-08-03 11:39:35 +08:00
rv = 1;
}
#else
xrdp_listen_main_loop(g_listen);
#endif
2004-08-03 11:39:35 +08:00
xrdp_listen_delete(g_listen);
2004-09-12 05:27:39 +08:00
g_exit_system();
2004-08-03 11:39:35 +08:00
return rv;
}