summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorChristian Schneider2020-05-08 15:49:31 +0200
committerChristian Schneider2020-05-08 15:49:31 +0200
commitc412f1c1463327866baee117504c3a4b3fc33bd6 (patch)
tree80241b1f58f371b3a050d5c336f3e78e36936459 /it.class
parentc230360afbb9406ab239dbacd1181c149f9aa628 (diff)
downloaditools-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.class6
1 files changed, 5 insertions, 1 deletions
diff --git a/it.class b/it.class
index a6e387b..b3505ea 100644
--- a/it.class
+++ b/it.class
@@ -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());