473,387 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ncurses and key commands

Hi,
I am writing a shell and am using ncurses to recognize key commands
like up_arrow(KEY_UP) and down_arrow(KEY_DOWN). In a unix/linux OS the
up arrow would give you the last command you input. I am trying to do
that, but I don't know how to explain it well but I am trying to get
that browsing look. I can access the history and retrieve the last
command but if i want to browse three or four further back I can't get
it to act the same way as the OS does. What I mean is that in a unix
shell, if you press the up arrow it would give you the last command
you input and if you press the up arrow several more times, the input
is simply replaced. I can't get it to replace the previous input.

I am sorry for my poor explanation but if anyone understands what I
mean, I would greatly appreciate your help.

Thank you in advance,
natalie

Feb 8 '07 #1
4 2912
In article <11*********************@p10g2000cwp.googlegroups. com>,
lnatz <nm**********@gmail.comwrote:
>I am writing a shell and am using ncurses to recognize key commands
like up_arrow(KEY_UP) and down_arrow(KEY_DOWN). In a unix/linux OS the
Try comp.unix.programming . The C language itself barely recognizes
the existance of keys (it likes -characters- though). ncurses requires
OS-specific extensions to C.
--
All is vanity. -- Ecclesiastes
Feb 8 '07 #2
lnatz wrote:
>
I am writing a shell and am using ncurses to recognize key commands
like up_arrow(KEY_UP) and down_arrow(KEY_DOWN). In a unix/linux OS
the up arrow would give you the last command you input. I am trying
to do that, but I don't know how to explain it well but I am trying
to get that browsing look. I can access the history and retrieve
the last command but if i want to browse three or four further back
I can't get it to act the same way as the OS does. What I mean is
that in a unix shell, if you press the up arrow it would give you
the last command you input and if you press the up arrow several
more times, the input is simply replaced. I can't get it to replace
the previous input.
I suggest you look at the way 4dos works, under DOS or w9x. You
might want to sniff around comp.os.msdos.4dos. Many have been
trying to persuade Rex Conn to port it to Linux. However, he has
released the source. There is some confusion as to the terms.

Shells, ncurses, etc. are all off-topic here. c.l.c discusses the
C language, as defined by the various standards. Cross posted and
f'ups set.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
Feb 8 '07 #3
On 8 Feb, 02:11, "lnatz" <nmrabinov...@gmail.comwrote:
>... In a unix/linux OS the
up arrow would give you the last command you input.
<Off-topic>
Not on most of the unixes I've worked on, but I'm _very_ old. I worked
for many years with the bourne shell, and no command history at all.

These days I tend to use ksh with vi-style editing from choice, which
still doesn't mean arrow keys work.

Please don't confuse the behaviour of a shell with the behaviour of
the OS...
</Off-topic>

Feb 8 '07 #4
lnatz wrote:
Hi,
I am writing a shell and am using ncurses to recognize key commands
like up_arrow(KEY_UP) and down_arrow(KEY_DOWN). In a unix/linux OS the
up arrow would give you the last command you input. I am trying to do
that, but I don't know how to explain it well but I am trying to get
that browsing look. I can access the history and retrieve the last
command but if i want to browse three or four further back I can't get
it to act the same way as the OS does. What I mean is that in a unix
shell, if you press the up arrow it would give you the last command
you input and if you press the up arrow several more times, the input
is simply replaced. I can't get it to replace the previous input.
There's a GNU readline package that will do this for you. I have
used it, wrapped up so that if it's not available it falls back
to using fgets on stdin; the rest of the program doesn't know or
care about the gnu magic.

(GNU readline isn't topical, but the trick of wrapping it is!)

--
Chris "electric hedgehog" Dollin
Nit-picking is best done among friends.

Feb 8 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Volker Kamp | last post by:
Hi, I'm using the CLI SAPI of PHP to create ncurses programs. All works fine instead of debugging, since most PHP debuggers are not compatible to CLI. The worst is, that after calling...
2
by: Nick R | last post by:
I know, my title really sucks. How do you draw an individual pixel with ncurses?
9
by: Sinan Nalkaya | last post by:
hi, i want to use ncurses library in python i`ve found proper library for that, PyNcurses. then i searched for some documentation about ncurses programming, i only found that web site ;...
5
by: arve.knudsen | last post by:
Hi I'm trying to build a Python package that I can use on different Linux setups, for this purpose it would be nice to weld external dependencies (libraries) into Python itself. So far I've...
2
by: mark.e.nelson | last post by:
Hi, I am trying to pass a pointer to a struct to a function that uses the data in the struct, and also happens to use ncurses. I always get a segmentation violation when the program exits. I...
6
by: dimitris.papastamos | last post by:
Hello everyone, I've been working on a simple editor myself and I seem to be having some problems with ncurses or so. I have been debugging this program quite a lot trying to detect where the bug...
2
by: =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki | last post by:
Is it a library at C++ by means of library of ncurses at linux,that it implement library of ncurses but by means language of C++,it is by means of class,struct and other? if yes is it any?
3
by: sirix | last post by:
Hi, I'm using g++ 4.1.2 and ncurses 5.6. Following simple code correctly displays dimensions of an xterm while one resizes it's window. I thought that uncommenting wouldn't change anything in a...
1
by: ChuckB | last post by:
Ok, I'm trying to create a GTK+ application that scrolls Hs across the screen until you press q or Q. I've got it working in console wise using ncurses. What I'm trying to do now is make a full...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.