Crypt-CBCeasy

 view release on metacpan or  search on metacpan

eg/chat2new.pl  view on Meta::CPAN

}

# ($pty,$tty) = $chat'_getpty(PTY,TTY):
# internal procedure to get the next available pty.
# opens pty on handle PTY, and matching tty on handle TTY.
# returns undef if can't find a pty.
# Modify "/dev/pty" to "/dev/pts" for Dell Unix v2.2 (aka SVR4.04). Joe Doupnik.

sub _getpty { ## private
	local($_PTY,$_TTY) = @_;
	$_PTY =~ s/^([^']+)$/(caller)[$[]."'".$1/e;
	$_TTY =~ s/^([^']+)$/(caller)[$[]."'".$1/e;
	local($pty, $tty, $kind);
	if( -e "/dev/pts000" ){		## mods by Joe Doupnik Dec 1992
		$kind = "pts";		## SVR4 Streams
	} else {
		$kind = "pty";		## BSD Clist stuff
	}
	for $bank (112..127) {
		next unless -e sprintf("/dev/$kind%c0", $bank);
		for $unit (48..57) {
			$pty = sprintf("/dev/$kind%c%c", $bank, $unit);



( run in 0.353 second using v1.01-cache-2.11-cpan-b61123c0432 )