[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tramp and NT-Emacs with plink
From: |
Michael Albinus |
Subject: |
Re: Tramp and NT-Emacs with plink |
Date: |
13 Sep 2002 11:07:45 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Jonathan Epstein <address@hidden> writes:
> Now, I ran this program (named tramp_decode_test.pl to avoid namespace
> conflicts), and get this on my Linux system:
>
> echo eHl6enkK | perl tramp_decode_test.pl
> xyzzy
>
> And this on my Solaris system:
> echo eHl6enkK | perl tramp_decode_test.pl
I can reproduce the problem. On SunOS 5.7, Perl 5.005_02, same result
as Jonathan. On HP-UX B.10.20, Perl 5.004_04, there is even an error:
| address@hidden:[1040] echo eHl6enkK | perl tramp_decode_test.pl
| Too many arguments for substr at tramp_decode_test.pl line 29, near "q())"
| Execution of tramp_decode_test.pl aborted due to compilation errors.
Debugging it, you can see:
- "sprintf(q(%06b)" is used. But "%06b" isn't a defined by default for
sprintf.
- In statement "my $chunk = substr($pending, 0, $len & ~3, q());" the
last parameter of substr isn't defined by default (therefore the
error with HP-UX Perl). I guess, it's optional, so not necessary.
The script could be changed as follows:
---
#!/bin/perl
# This script contributed by Juanma Barranquero <address@hidden>.
# Copyright (C) 2002 Free Software Foundation, Inc.
use strict;
my %trans = do {
my $i = 0;
map {($_, substr(unpack(q(B8), chr $i++), 2, 6))}
split //,
q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/);
};
my %bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255;
binmode(\*STDOUT);
# We are going to accumulate into $pending to accept any line length
# (we do not check they are <= 76 chars as the RFC says)
my $pending = q();
while (my $data = <STDIN>) {
chomp $data;
# If we find one or two =, we have reached the end and
# any following data is to be discarded
my $finished = $data =~ s/(==?).*/$1/;
$pending .= $data;
my $len = length($pending);
my $chunk = substr($pending, 0, $len & ~3);
# Easy method: translate from chars to (pregenerated) six-bit packets, join,
# split in 8-bit chunks and convert back to char.
print join q(),
map $bytes{$_},
((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g);
last if $finished;
}
---
This works for me under Solaris & HP-UX.
Kai, could you please test it under Linux? Here at work I haven't one ...
> Jonathan
Best regards, Michael.
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/07
- Tramp 2.0.15: endless loop queries password, Rainer Thiel, 2002/09/08
- Re: Tramp and NT-Emacs with plink, Douglas Gray Stephens, 2002/09/12
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/12
- Re: Tramp and NT-Emacs with plink, Jonathan Epstein, 2002/09/12
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/12
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/12
- Re: Tramp and NT-Emacs with plink, Jonathan Epstein, 2002/09/12
- Re: Tramp and NT-Emacs with plink,
Michael Albinus <=
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Douglas Gray Stephens, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Rainer Thiel, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Douglas Gray Stephens, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Kai Großjohann, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Douglas Gray Stephens, 2002/09/13
- Re: Tramp and NT-Emacs with plink, Douglas Gray Stephens, 2002/09/13