HP3000-L Archives

June 2004, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Emerson, Tom" <[log in to unmask]>
Reply To:
Emerson, Tom
Date:
Wed, 16 Jun 2004 18:05:52 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (84 lines)
> -----Original Message-----
> From: Rick Gilligan
> 
>  I also just noticed this:
> 
>         !ECHO !userpwd          >> FTPPUT

From the "you just can't win" department comes this tidbit:

it doesn't matter WHERE in the line the I/O redirection characters and filename occur, but this doesn't always work as planned either.  For instance, you can issue the command as:

   !ECHO >>FTPPUT !userpwd

and be (somewhat) assured there are no TRAILING spaces, however there will now be a LEADING space as this sample shows:

:setvar pass "word"
:echo >>ftpput!pass
>>ftpputword
:echo >>ftpput !pass
:print ftpput
 word
:echo !pass>>ftpput
:print ftpput
 word
word

:echo !pass >>ftpput
:echo !pass             >>ftpput

Using MPEX to show what (MPE) thinks of the file, it would appear trailing spaces aren't a problem:

%print ftpput;format=strwrite("["+r+"]")
[ word]
[word]
[word]
[word]

but this is a case of MPEX "being helpful" -- fcopy;hex shows the real story:

:fcopy from=ftpput;to=;hex;char
HP31900A.05.04 FILE COPIER (C) HEWLETT-PACKARD CO. 1999
FTPPUT RECORD 0 (%0, #0)
0000: 2077 6F72 64                             word
FTPPUT RECORD 1 (%1, #1)
0000: 776F 7264                               word
FTPPUT RECORD 2 (%2, #2)
0000: 776F 7264 20                            word
FTPPUT RECORD 3 (%3, #3)
0000: 776F 7264 2020 2020 2020 2020 2020 2020 word
0008: 20

So indeed, the only instance of NO leading OR trailing spaces is

   :ECHO !pass>>file

but again, beware...

   :ECHO  !pass>>file

results in a leading space [view this message in a fixed font to see the difference]

:echo !pass>>ftpput
:echo  !pass>>ftpput
:fcopy from=ftpput;to=;char;hex
HP31900A.05.04 FILE COPIER (C) HEWLETT-PACKARD CO. 1999
FTPPUT RECORD 0 (%0, #0)
0000: 776F 7264                               word
FTPPUT RECORD 1 (%1, #1)
0000: 2077 6F72 64                             word
EOF 

And to even further screw things up, any instance of a ">" or ">>" BEFORE the final redirection causes whatever "word" happens to follow the earlier redirections to simply "dissappear":

:echo >> file1 another !pass >> file2 
:print file1
       ^
NONEXISTENT PERMANENT FILE  (FSERR 52)
The PRINT command failed. (CIERR 9080)
:print file2
 another word

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2