Make rdesktop return 0 only if a RDP_PDU_DISCONNECT was received,
otherwise return 2 (except for usage errors, where it still returns 1). Documented exit codes of rdesktop in doc/exit_codes.txt. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@423 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
2c32c1ec3a
commit
5e323ca0d3
11
doc/exit_codes.txt
Normal file
11
doc/exit_codes.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
The exit codes of rdesktop are:
|
||||||
|
|
||||||
|
0 Everything went well. Specifically, the server sent a
|
||||||
|
RDP_PDU_DEACTIVATE which seems to be a signal that the
|
||||||
|
session has ended normally.
|
||||||
|
|
||||||
|
1 Usage error, i.e. wrong commandline option, invalid hostname
|
||||||
|
or similar.
|
||||||
|
|
||||||
|
2 End of connection by other reason than received
|
||||||
|
RDP_PDU_DEACTIVATE.
|
2
proto.h
2
proto.h
@ -75,7 +75,7 @@ void process_colour_pointer_pdu(STREAM s);
|
|||||||
void process_cached_pointer_pdu(STREAM s);
|
void process_cached_pointer_pdu(STREAM s);
|
||||||
void process_bitmap_updates(STREAM s);
|
void process_bitmap_updates(STREAM s);
|
||||||
void process_palette(STREAM s);
|
void process_palette(STREAM s);
|
||||||
void rdp_main_loop(void);
|
BOOL rdp_main_loop(void);
|
||||||
BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command,
|
BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command,
|
||||||
char *directory);
|
char *directory);
|
||||||
void rdp_disconnect(void);
|
void rdp_disconnect(void);
|
||||||
|
11
rdesktop.c
11
rdesktop.c
@ -149,7 +149,7 @@ main(int argc, char *argv[])
|
|||||||
char password[16];
|
char password[16];
|
||||||
char shell[128];
|
char shell[128];
|
||||||
char directory[32];
|
char directory[32];
|
||||||
BOOL prompt_password;
|
BOOL prompt_password, rdp_retval = False;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
char *p;
|
char *p;
|
||||||
@ -366,6 +366,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef RDP2VNC
|
#ifdef RDP2VNC
|
||||||
rdp2vnc_connect(server, flags, domain, password, shell, directory);
|
rdp2vnc_connect(server, flags, domain, password, shell, directory);
|
||||||
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (!ui_init())
|
if (!ui_init())
|
||||||
@ -384,7 +385,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (ui_create_window())
|
if (ui_create_window())
|
||||||
{
|
{
|
||||||
rdp_main_loop();
|
rdp_retval = rdp_main_loop();
|
||||||
ui_destroy_window();
|
ui_destroy_window();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,9 +393,13 @@ main(int argc, char *argv[])
|
|||||||
rdp_disconnect();
|
rdp_disconnect();
|
||||||
ui_deinit();
|
ui_deinit();
|
||||||
|
|
||||||
|
if (True == rdp_retval)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 2;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EGD_SOCKET
|
#ifdef EGD_SOCKET
|
||||||
|
5
rdp.c
5
rdp.c
@ -849,7 +849,7 @@ process_data_pdu(STREAM s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Process incoming packets */
|
/* Process incoming packets */
|
||||||
void
|
BOOL
|
||||||
rdp_main_loop(void)
|
rdp_main_loop(void)
|
||||||
{
|
{
|
||||||
uint8 type;
|
uint8 type;
|
||||||
@ -864,6 +864,8 @@ rdp_main_loop(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_PDU_DEACTIVATE:
|
case RDP_PDU_DEACTIVATE:
|
||||||
|
DEBUG(("RDP_PDU_DEACTIVATE\n"));
|
||||||
|
return True;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_PDU_DATA:
|
case RDP_PDU_DATA:
|
||||||
@ -877,6 +879,7 @@ rdp_main_loop(void)
|
|||||||
unimpl("PDU %d\n", type);
|
unimpl("PDU %d\n", type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Establish a connection up to the RDP layer */
|
/* Establish a connection up to the RDP layer */
|
||||||
|
Loading…
Reference in New Issue
Block a user