diff options
| -rw-r--r-- | it.class | 16 | 
1 files changed, 16 insertions, 0 deletions
@@ -1021,6 +1021,22 @@ static function _stdin_next()  }  /** + * Get all lines from command line arguments or stdin. + * Transparently reads existing files in the command line arguments and passes on all other arguments. + * Note: You need to call getopt() before using this function. + */ +static function gets_all() +{ +	while (it::_stdin_next()) { +		if (($fd = $GLOBALS['it_stdin']['fd'])) +			while ($line = fgets($fd)) +				yield rtrim($line, "\n"); +		else +			yield $GLOBALS['it_stdin']['filename']; +	} +} + +/**   * Get one line from stdin (or files given on command line) a la Perl <>.   * Note: You need to call getopt() before using this function.   * @return Line (including newline) or false on eof  |