Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

PuTTy backspace

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am doing a console progress program in Java which periodically erases old messages and prints new ones. The problem is when the program is run with PuTTy terminal (on Solaris for example) it doesn't erase the old messages so it floods the screen with text. The very problem comes from the erasing since I use backspaces - the backspace character (\b) and PuTTy is set to use different character value for backspace. This could be resolved by changing the configuration setting of PuTTy by changing the Keyboard/Backspace key option - Control-? to Control-H.
I need to know if there is any other reserved character or way for erasing characters in the console, or any way to detect programmatically what the current setting of PuTTy is so the user is not urged to check and change the configuration settings of PuTTy.
I would appreciate any advise or suggestion.
 
Saloon Keeper
Posts: 24557
168
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two very important words: "curses" and "termcaps".

Termcaps is the Terminal Capabilities definition. It provides an abstraction between the user's console hardware and generic screen-mode graphical capabilities so that you don't have to code hardware dependencies into your shell scripts. Actually, I think termcaps has been superseded by a newer system, but if you search for termcaps (or display the man/info page), you'll at least be headed in the right direction.

Curses provides the ability to do text-mode cursor control while remaining hardware independent. Among the facilities that use it are the bash script output commands that do x-y positioning onscreen and the text gui dialog controls.

Every interactive terminal logged into a Linux or Unix server should carry a terminal type definition, which is how the system knows to translate the portable graphics codes to hardware-specific actions such as erase-to-end-of-line. Probably the most popular one is Dec VT-100 emulation. I think there's an option in PuTTy to set that.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic