Subject: | Trouble with NCCS constant and termios |
Hi!
I hope you feel not spammed. :-)
I just don't want to intermix two topics in one report.
Using the constant NCCS, as used in CC_FIELDS of Term::ReadPassword,
troubles the POSIX module's getcc() function. The following call
use POSIX qw(:termios_h);
my $term = POSIX::Termios->new();
print $term->getcc(NCCS), "\n";
croaks with
Bad getcc subscript at nccs_example.pl line 3.
Looking at
http://search.cpan.org/src/NWCLARK/perl-5.8.8/ext/POSIX/POSIX.xs
there is an "if (ccix >= NCCS)" that's responsible for that:
------------------------------------------------
cc_t
getcc(termios_ref, ccix)
POSIX::Termios termios_ref
int ccix
CODE:
#ifdef I_TERMIOS /* References a termios structure member so ifdef it
out. */
if (ccix >= NCCS)
croak("Bad getcc subscript");
RETVAL = termios_ref->c_cc[ccix];
#else
not_here("getcc");
RETVAL = 0;
#endif
OUTPUT:
RETVAL
------------------------------------------------
Now I'm not sure what's up with that NCCS constant. Is it
Term::ReadPassword's mistake to use it or is it maybe a bug
in POSIX.xs, e.g. that the ">=" should be an ">".
Unfortunately I don't know anything about this termios stuff.
On some of my systems it works, probably dependent on the
surrounding #ifdef.
Thanks.
Steffen
--
Steffen Schwigon <schwigon@webit.de>
Dresden Perl Mongers <http://dresden-pm.org/>
Deutscher Perl-Workshop <http://www.perl-workshop.de/>