Skip to content
Snippets Groups Projects
Commit ecd9174e authored by deuce's avatar deuce
Browse files

For log output, display control chars in ^X format.

Ths should fix the mystery termination bug when ran from xterm.
parent 128d8674
Branches
Tags
No related merge requests found
...@@ -199,6 +199,7 @@ static int lputs(int level, char *str) ...@@ -199,6 +199,7 @@ static int lputs(int level, char *str)
{ {
static pthread_mutex_t mutex; static pthread_mutex_t mutex;
static BOOL mutex_initialized; static BOOL mutex_initialized;
char *p;
#ifdef __unix__ #ifdef __unix__
...@@ -219,8 +220,15 @@ static int lputs(int level, char *str) ...@@ -219,8 +220,15 @@ static int lputs(int level, char *str)
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
/* erase prompt */ /* erase prompt */
printf("\r%*s\r",prompt_len,""); printf("\r%*s\r",prompt_len,"");
if(str!=NULL) if(str!=NULL) {
printf("%s\n",str); for(p=str; *p; p++) {
if(iscntrl(*p))
printf("^%c",'@'+*p);
else
printf("%c",*p);
}
puts("");
}
/* re-display prompt with current stats */ /* re-display prompt with current stats */
if(prompt!=NULL) if(prompt!=NULL)
prompt_len = printf(prompt, thread_count, socket_count, client_count, served); prompt_len = printf(prompt, thread_count, socket_count, client_count, served);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment