From 41f93d4c15dee82dcbc0edb7603b4a70c970f4f0 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Fri, 29 Nov 2013 18:55:15 +0000 Subject: [PATCH] allow setting both ports from command line: --- phpdbg.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/phpdbg.c b/phpdbg.c index f04d69413c..2cedaf4d64 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -873,12 +873,18 @@ phpdbg_main: /* if you pass a listen port, we will accept input on listen port */ /* and write output to listen port * 2 */ - case 'l': /* set listen settings */ - listen[0] = atoi(php_optarg); - listen[1] = (listen[0] * 2); - break; + case 'l': { /* set listen settings */ + if (sscanf(php_optarg, "%d/%d", &listen[0], &listen[1]) != 2) { + if (sscanf(php_optarg, "%d", &listen[0]) != 1) { + /* default to hardcoded ports */ + listen[0] = 4000; + listen[1] = 8000; + } else { + listen[1] = (listen[0] * 2); + } + } + } break; #endif - } } -- 2.50.1