Qnx2->Qnx4 port, and scanf()

Hi,

We’ve recently ported our applications from Qnx2 to Qnx4 and this is one of
the differences I can’t resolve.

One of the processes we wrote is used to send a text message entered from
the command line to another process, similar to the way other processes in
the system send it messages. We use this for testing.

The process prompts the user to enter a message, ending with an key.
The program uses scanf() to read in the text message.

In Qnx2 the UP key would bring back the last text entered, and then it could
be modified and re-sent. I assume the shell would intercept this key and
put up the text.
In Qnx4 the UP key is read by the program into the text message and does not
bring back the previous text.

Any ideas on getting the Qnx4 process to function the same as in Qnx2?

Thanks,
ms…

Mike Schneider <Mike.Schneider@us.heidelberg.com> wrote:
: Hi,

: We’ve recently ported our applications from Qnx2 to Qnx4 and this is one of
: the differences I can’t resolve.

: One of the processes we wrote is used to send a text message entered from
: the command line to another process, similar to the way other processes in
: the system send it messages. We use this for testing.

: The process prompts the user to enter a message, ending with an key.
: The program uses scanf() to read in the text message.

: In Qnx2 the UP key would bring back the last text entered, and then it could
: be modified and re-sent. I assume the shell would intercept this key and
: put up the text.
: In Qnx4 the UP key is read by the program into the text message and does not
: bring back the previous text.

: Any ideas on getting the Qnx4 process to function the same as in Qnx2?

You will want to look at a command line history library.
There are several around (readline comes to mind, there
are others non-gpl’ed as well) or roll your own. Once your
program is running, the shell is out of the way.

Thomas




\


Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf

Previously, Mike Schneider wrote in qdn.public.qnx4:

Hi,

We’ve recently ported our applications from Qnx2 to Qnx4 and this is one of
the differences I can’t resolve.

One of the processes we wrote is used to send a text message entered from
the command line to another process, similar to the way other processes in
the system send it messages. We use this for testing.

The process prompts the user to enter a message, ending with an key.
The program uses scanf() to read in the text message.

In Qnx2 the UP key would bring back the last text entered, and then it could
be modified and re-sent. I assume the shell would intercept this key and
put up the text.
In Qnx4 the UP key is read by the program into the text message and does not
bring back the previous text.

Any ideas on getting the Qnx4 process to function the same as in Qnx2?

if you read your user input with “input_line”, which is not prototyped in stdio.h,
you will get that kind of command line history.

Thanks,
ms…
\

Thanks, that works.
But why the difference between Qnx2 and Qnx4?
Is it just the difference between the two shells, or the C libraries, or ???
ms…


Horst Hannappel <Horst.Hannappel@mbs-software.de> wrote in message
news:Voyager.001010170214.22833A@qnx-node3.mbs

Previously, Mike Schneider wrote in qdn.public.qnx4:
Hi,

We’ve recently ported our applications from Qnx2 to Qnx4 and this is one
of
the differences I can’t resolve.

One of the processes we wrote is used to send a text message entered
from
the command line to another process, similar to the way other processes
in
the system send it messages. We use this for testing.

The process prompts the user to enter a message, ending with an <Enter
key.
The program uses scanf() to read in the text message.

In Qnx2 the UP key would bring back the last text entered, and then it
could
be modified and re-sent. I assume the shell would intercept this key
and
put up the text.
In Qnx4 the UP key is read by the program into the text message and does
not
bring back the previous text.

Any ideas on getting the Qnx4 process to function the same as in Qnx2?

if you read your user input with “input_line”, which is not prototyped in
stdio.h,
you will get that kind of command line history.


Thanks,
ms…

\

Previously, Mike Schneider wrote in qdn.public.qnx4:

Thanks, that works.
But why the difference between Qnx2 and Qnx4?
Is it just the difference between the two shells, or the C libraries, or ???
ms…

My recollection is that it was impossible to port the way QNX2 works
and still be POSIX compatible.



Mitchell Schoenbrun --------- maschoen@pobox.com