diff options
author | Christian Schneider | 2020-05-08 15:49:31 +0200 |
---|---|---|
committer | Christian Schneider | 2020-05-08 15:49:31 +0200 |
commit | c412f1c1463327866baee117504c3a4b3fc33bd6 (patch) | |
tree | 80241b1f58f371b3a050d5c336f3e78e36936459 /it.class | |
parent | c230360afbb9406ab239dbacd1181c149f9aa628 (diff) | |
download | itools-c412f1c1463327866baee117504c3a4b3fc33bd6.tar.gz itools-c412f1c1463327866baee117504c3a4b3fc33bd6.tar.bz2 itools-c412f1c1463327866baee117504c3a4b3fc33bd6.zip |
Do not call it::_stdin_next() trying to open first optional argument unless it::gets() is used
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -932,7 +932,6 @@ static function getopt($usage, $p = array()) it_debug::set($result['debug']); $GLOBALS['it_stdin']['args'] = $result['args'] ? $result['args'] : array("-"); - it::_stdin_next(); if ($result['verbose']) $GLOBALS['debug_verbose']++; @@ -959,6 +958,11 @@ static function _stdin_next() */ static function gets() { + static $initialized = 0; + + if (!$initialized++) + it::_stdin_next(); + do { $result = fgets($GLOBALS['it_stdin']['fd']); } while (($result === false) && it::_stdin_next()); |