[Freeswitch-svn] [commit] r3729 - freeswitch/trunk/src

Freeswitch SVN brian at freeswitch.org
Tue Dec 19 14:15:14 EST 2006


Author: brian
Date: Tue Dec 19 14:15:13 2006
New Revision: 3729

Modified:
   freeswitch/trunk/src/switch_console.c

Log:
ctl-d crap (i still would not recommend doing it

Modified: freeswitch/trunk/src/switch_console.c
==============================================================================
--- freeswitch/trunk/src/switch_console.c	(original)
+++ freeswitch/trunk/src/switch_console.c	Tue Dec 19 14:15:13 2006
@@ -224,11 +224,14 @@
 		FD_ZERO(&efds);
 		FD_SET(fileno(stdin), &rfds);
 		FD_SET(fileno(stdin), &efds);
-		activity = select(fileno(stdin)+1, &rfds, NULL, &efds, &tv);
+		if ((activity = select(fileno(stdin)+1, &rfds, NULL, &efds, &tv)) < 0) {
+            break;
+        }
 
 #ifdef _MSC_VER
 #pragma warning(pop)
 #endif
+
 		if (activity == 0) {
 			fflush(stdout);
 			continue;
@@ -236,7 +239,15 @@
 
 		memset(&cmd, 0, sizeof(cmd));
 		for (x = 0; x < (sizeof(cmd)-1); x++) {
-			cmd[x] = (char) getchar();
+            int c = getchar();
+            if (c < 0) {
+                int y = read(fileno(stdin), cmd, sizeof(cmd));
+                cmd[y-1] = '\0';
+                break;
+            }
+
+			cmd[x] = (char) c;
+
 			if (cmd[x] == '\n') {
 				cmd[x] = '\0';
 				break;



More information about the Freeswitch-svn mailing list