Operating System - HP-UX
1829101 Members
2379 Online
109986 Solutions
New Discussion

missing data when cut/paste

 
Systems Engineers
Occasional Visitor

missing data when cut/paste

Hi,

i need help with a problem i am seeing
when i cut paste from a xwindow terminal
in one server to a second xterminal (ssh'd
to a busy HPUX) running vi, most of the
block is lost.

Then, to test the network i wrote a small
c program (in HPUX server) to read
stdin and save it to a file and it
works fine, no characters are lost.

is there a way to increase the stdin buffer size under HPUX and let vi catch up?

raymundo
6 REPLIES 6
Gordon  Morrison
Trusted Contributor

Re: missing data when cut/paste

Hi Raymundo,
I used to get this problem all the time. For some reason, vi can't keep up with a large paste when you're connected to the target server over a network.
To get around this, on the server where you want to paste the text, do:
cat > temp.txt
Then do
vi temp.txt
Yank the text from the first file and insert it in the other:
For instance, if the text you want is 100 lines long, then in temp.txt, type
"a100y
(doublequote100y - no spaces)
This copies 100 lines into buffer a
Then...
:n
to get to the next file, then put your cursor just before where you want to insert the text and type
"ap
Cheers
Gordon
What does this button do?
MarkSyder
Honored Contributor

Re: missing data when cut/paste

Raymundo,

Apologies if this is an insulting answer, but I've made this mistake so I know how easy it is!

Is the missing text at the beginning of the block? If so, maybe you've forgotten to type "i" for insert text or "o" to open a line. It will then only start copying when it encounters an i or an o.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Muthukumar_5
Honored Contributor

Re: missing data when cut/paste

Just copy the contents from one terminal and paste it in next as,

terminal-2# cat > filename
paste it
ctr+d

It will work easily instead of opening vi i (insert) and all.

hth.
Easy to suggest when don't know about the problem!
Systems Engineers
Occasional Visitor

Re: missing data when cut/paste

I did not forgot to type "i" in vi and this
happend to users while using emacs too.

I was hopping for some "magic" way to have a
larger input buffer and give the text editor
some time to catch up.

Thankx anyway

raymundo
Mel Burslan
Honored Contributor

Re: missing data when cut/paste

unfortunately, copy and paste functionality in xterm is not ment to be used to copy huge chunks of text. I have never figured it out myself but I know for a fact that, it is dependent on the terminal emulator you are using. xterm, native to hpux has one of the lowest amount of buffers I have seen. My suggestion is to use an intel machine and use it with PuTTY in xterm emulation mode. I am yet to see it miss anything when pasting. Again, what I do, usually stays under 5KB at a time.

if you need a anything larger than that, I suggest copying files from command line and using sed and awk to process them.

________________________________
UNIX because I majored in cryptology...
Bill Hassell
Honored Contributor

Re: missing data when cut/paste

Actually, there is a solution. It is due to a missing setting in the default stty setup for /etc/profile. More than a decade ago, I saw this exact problem and looked for a reason and solution. The reason, as you might expect, is that the server is too busy to keep up with a long stream of characters. This is compounded by using Xwindows for simple text windows.

The solution is easy: add the ixoff option to you stty setting in /etc/profile, something like this:

/sbin/stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixon ixoff

(you'll also see -parity, an extremely useful option, especially if you're using modems and/or serial ports). What is happening is that the telnet or ssh protocol sees an incoming stream of characters and knows when it is reaching a maximum string. At that moment, the driver is signaled to send a transmission stop code. In serial transmissions, this is the XOFF character, also known as the DC3 character (device control). XOFF is the CTRL-S character and if typed during a long listing, the system pauses until you type CTRL-Q (XON or DC1), or if the stty option IXANY is set, typing any character will resume transmission. This is also known as terminal pacing.

In the telnet/ssh protocol, there is a similar protocol and is enabled with options: xon xoff and ixany. Although the actual XON/XOFF characters are not used, the effect is the same. The server must have ixon (set by default) and ixoff set and now you can paste hundreds of lines of text into vi or any other program without loss of text. You can immediately test this with:

stty ixoff
stty -a

Since you're using Xwindows, be sure you are really logging in as a normal shell user and running /etc/profile and $HOME/.profile (which is not the default). The secret to getting this behavior is to login to the server that is providing your copy(s) of xterm (hpterm or dtterm) and create $HOME/.Xdefaults like this:

echo "*loginShell:true" >> $HOME/.Xdefaults

then start your terminal program (xterm hpterm or dtterm). You should now see the 'normal' HP-UX login messages from your profiles. Check for the right settings with stty -a (or stty -a | grep xo)


Bill Hassell, sysadmin