[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 to avoid namespace 
> conflicts), and get this on my Linux system:
>   echo eHl6enkK | perl
> xyzzy
> And this on my Solaris system:
>   echo eHl6enkK | perl

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
| Too many arguments for substr at line 29, near "q())"
| Execution of aborted due to compilation errors.

Debugging it, you can see:

- "sprintf(q(%06b)" is used. But "%06b" isn't a defined by default for

- 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:

# 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 //, 

my %bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255;


# 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]