From: krakjoe Date: Fri, 29 Nov 2013 18:55:15 +0000 (+0000) Subject: allow setting both ports from command line: X-Git-Tag: php-5.6.0alpha1~110^2~30^2~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41f93d4c15dee82dcbc0edb7603b4a70c970f4f0;p=php allow setting both ports from command line: --- 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 - } }