command-line editing

command-line editing

Post by Allin Cottrel » Fri, 26 Jan 1996 04:00:00



There's something I don't understand about command-line editing (when it is
possible and to what degree).  

I have a command-driven C program that I run on both my Linux box and our
mainframe (HPUX).  In each case I'm running it in an xterm.  On my own box,
if I start the program from the bash prompt in the X-terminal I get the
following behavior:  If I backspace to correct a mistyped command within the C
program the line appears to be corrected on-screen, but on pressing Enter I get
a seg fault with "Illegal control char. (ASCII 8) encountered".

If I start the C program in its own window ("xterm -exec <C-program> &") I get
much the same.  In this case backspacing makes "^H" appear on-screen, but on
pressing Enter the program crashes as before.

On the HP system, by contrast, the C program behaves in a forgiving manner
(whether it is started straight from the bash prompt, or put into its own xterm
window as above): backspacing and retyping has the desired effect.  

I also get the desirable behavior on my own system if I run the program from the
basic bash prompt, outside of X-Windows.

So I'm wondering: What parameters control this behavior, and how do I change
them?  Thanks very much for any help.

--
Allin Cottrell
Department of Economics
Wake Forest University, NC

 
 
 

command-line editing

Post by David R Tuck » Sun, 28 Jan 1996 04:00:00


-----BEGIN PGP SIGNED MESSAGE-----

   There's something I don't understand about command-line editing (when it is
  possible and to what degree).  

   I have a command-driven C program that I run on both my Linux
  boxand our mainframe (HPUX).  In each case I'm running it in an xterm.
  On myown box, if I start the program from the bash prompt in the
  X-terminal I getthe following behavior: If I backspace to correct a
  mistyped commandwithin the C program the line appears to be corrected
  on-screen, but on pressingEnter I get a seg fault with "Illegal
  control char. (ASCII 8) encountered".

     If I start the C program in its own window ("xterm -exec
  <C-program> &") I get much the same.  In this case backspacing makes
  "^H" appear on-screen, but on pressing Enter the program crashes as
  before.

     On the HP system, by contrast, the C program behaves in a forgiving
  manner (whether it is started straight from the bash prompt, or put
  into its own xterm window as above): backspacing and retyping has the
  desired effect.

     I also get the desirable behavior on my own system if I run the
  program from the basic bash prompt, outside of X-Windows.

     So I'm wondering: What parameters control this behavior, and how do
  I change them?  Thanks very much for any help.

What's going on here is your xmodmap.std (probably
/usr/X11/lib/X11/etc/xmodmap.std) sets the backspace key to BackSpace
(= ^H = "ASCII 8") by default.  Why I don't know.  Try editing it,
commenting out the original keycode 22 entry and changing it to
Delete, so it looks like this:

  !keycode  22 = BackSpace
  keycode  22 = Delete

Or, if you don't want to mess with "system defaults," you can copy
that file to your home directory, edit it there, and change your
.xinitrc to load the new mode map.  Then restart the X server.  This
should fix your line editing problems as well as Emacs, lynx, ftp, and
so on, but it "breaks" Netscape (I *really* don't know why this is),
for which you'll actually have to type ctl-H to delete and back up.

- -drt

========================================================================

|----------------------------------------------------------------------|
| PGP fingerprint: D4 17 D6 86 CC 8E 52 66   22 EF 11 34 9D 46 33 35   |
|======================================================================|
|  To get PGP (US/CDN), point to http://web.mit.edu/network/pgp.html   |
========================================================================

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMQpBoVoNWgLzR285AQFJOwP+M4zUVZ8OpmJg2PMiqnlUpg0caeGMd+VE
kTH+1l2RPB7Y4RS436hKaD6iwiaUm+44XF0M8IYiFx9ISvYYim6RO+XpOZ6TwyqF
srWMkkvu6IedEX6Z9YuKvN3ryZWTsWlLO+hRqj2/3oXZeu/0d4gSxNsacO7YTESR
SSzXcKxIZnA=
=ygYF
-----END PGP SIGNATURE-----

 
 
 

1. command-line editing

I think that there is some way to make the TCSH command-line act like
the VI line editor. Is there anyway to make the BASH command-line
behave the same way as VI? If so how do I go about it?

                                                        Yousuf Khan

2. Help installing Linux on a laptop

3. A new command-line editing library like readline

4. Q: max # of inetd instances

5. HELP: Command-line editing with ksh/csh

6. how do I ...

7. Command-line editing within C program

8. XF86Config Intellimouse 1.1A PS/2 Compatible Solution

9. ksh -o emacs and command-line editing problem

10. RH6, bash, command-line editing

11. Help: Command-Line Editing Issues

12. RH6, bash, command-line editing

13. Historical Question about command-line editing.