Redirecting COM1 to COM2

Morning,

Is there a possibility to redirect the input of one COM Port to the
output of another COM Port? ( COM1 → COM2 )
Or do I need to make a small programm.

Thank You

Just a quick 2 sec guess…

cat /dev/ser1 > /dev/ser2

I imagine should do the trick… mind you this is monday…

E.


Cipriano Patrik <patrik.cipriano@unaxis.com> wrote:

Morning,

Is there a possibility to redirect the input of one COM Port to the
output of another COM Port? ( COM1 → COM2 )
Or do I need to make a small programm.

Thank You

Hi,

Hardware Support Account <hw@qnx.com> wrote in article <a5dl33$il3$5@nntp.qnx.com>…

Just a quick 2 sec guess…

cat /dev/ser1 > /dev/ser2

I imagine should do the trick… mind you this is monday…

Is any “End Of File” symbol in QNXRTP for cat utility? If so, this symbol in stream will destroy
such “communication tube” :wink:

I’ve done some experiment and I need some clarification. My experiment:

cat <&1 >myfile.txt

  1. After few lines of text, I press ctrl-d. Text is saved, I get shell’s prompt. There is no cat in
    memory anymore. Is it symbol (ctrl+d) EOF?

  2. After few lines of text, I press ctrl-c. Text is saved except last line , I get shell’s prompt.
    There is no cat in memory anymore. I guess it’s just “control-break” for the running in foreground
    cat…

  3. After few lines of text, I press ctrl-z. Text is saved except last line, I get shell’s prompt.
    Cat is still alive in memory. ‘slay cat’ has no effect (‘kill -9’ works perfectly). Is ctrl+z a
    special symbol to put the running in foreground process to background? Why cat is still in memory
    after it gets SIGSTOP?

I’m on QNXRTP 6.1.0 Patch A, ksh (default).

Thanks in advance,
Eduard.

E.


Cipriano Patrik <> patrik.cipriano@unaxis.com> > wrote:
Morning,

Is there a possibility to redirect the input of one COM Port to the
output of another COM Port? ( COM1 → COM2 )
Or do I need to make a small programm.

Thank You
\

Ctrl-D is standard EOF character. Ctrl-C sends SIGINT to foreground process
and Ctrl-Z moves foreground to background (which is not same as SIGSTOP).
You can send SIGSTOP by Ctrl-S and SIGCONT by Ctrl-Q. Those are standard
designations in all Unix shells. I don’t know why do you think process
should not be in memory after getting SIGSTOP.

  • igor

“ed1k” <ed1k@yahoo.com> wrote in message
news:01c1bea3$9e920180$106fa8c0@ED1K…

Hi,

Hardware Support Account <> hw@qnx.com> > wrote in article
a5dl33$il3$> 5@nntp.qnx.com> >…
Just a quick 2 sec guess…

cat /dev/ser1 > /dev/ser2

I imagine should do the trick… mind you this is monday…

Is any “End Of File” symbol in QNXRTP for cat utility? If so, this symbol
in stream will destroy
such “communication tube” > :wink:

I’ve done some experiment and I need some clarification. My experiment:

cat <&1 >myfile.txt

  1. After few lines of text, I press ctrl-d. Text is saved, I get shell’s
    prompt. There is no cat in
    memory anymore. Is it symbol (ctrl+d) EOF?

  2. After few lines of text, I press ctrl-c. Text is saved except last
    line , I get shell’s prompt.
    There is no cat in memory anymore. I guess it’s just “control-break” for
    the running in foreground
    cat…

  3. After few lines of text, I press ctrl-z. Text is saved except last
    line, I get shell’s prompt.
    Cat is still alive in memory. ‘slay cat’ has no effect (‘kill -9’ works
    perfectly). Is ctrl+z a
    special symbol to put the running in foreground process to background? Why
    cat is still in memory
    after it gets SIGSTOP?

I’m on QNXRTP 6.1.0 Patch A, ksh (default).

Thanks in advance,
Eduard.


E.


Cipriano Patrik <> patrik.cipriano@unaxis.com> > wrote:
Morning,

Is there a possibility to redirect the input of one COM Port to the
output of another COM Port? ( COM1 → COM2 )
Or do I need to make a small programm.

Thank You
\

Hi Igor,

Igor Kovalenko <kovalenko@attbi.com> wrote in article <a5fiv9$joo$1@inn.qnx.com>…

Ctrl-D is standard EOF character.

So, I think this character will destroy discussed above redirection.

Ctrl-C sends SIGINT to foreground process
and Ctrl-Z moves foreground to background (which is not same as SIGSTOP).

I guess ‘slay cat’ sends SIGSTOP.

You can send SIGSTOP by Ctrl-S and SIGCONT by Ctrl-Q. Those are standard
designations in all Unix shells.

Thank you very much. I’m unaware about standard Unix designations, and I did not found it in help
viewer (maybe, I did not pay enough attention). I came from DOS, and Ctrl-Z has another sense there
:wink:

I don’t know why do you think process
should not be in memory after getting SIGSTOP.

I thought “slay cat” should remove cat from memory.

Thank you again,
Eduard.

  • igor

Igor Kovalenko <kovalenko@attbi.com> wrote in article <a5fiv9$joo$1@inn.qnx.com>…
<…>

Those are standard
designations in all Unix shells.

By the way, I’m glad to hear there is standard in all Unix shells. Since I worked with many shells
and terminals… except perhaps I did not work with BESM-6 :wink: … but I had very funny thing in my
childhood, it was arithmometer “Iron Felix” :wink:
Eduard.

“ed1k” <ed1k@yahoo.com> wrote in message
news:01c1beaa$c139e840$106fa8c0@ED1K…

Hi Igor,

Igor Kovalenko <> kovalenko@attbi.com> > wrote in article
a5fiv9$joo$> 1@inn.qnx.com> >…
Ctrl-D is standard EOF character.

So, I think this character will destroy discussed above redirection.

Ctrl-C sends SIGINT to foreground process
and Ctrl-Z moves foreground to background (which is not same as
SIGSTOP).

I guess ‘slay cat’ sends SIGSTOP.

No, slay by default should send a SIGTERM

You can send SIGSTOP by Ctrl-S and SIGCONT by Ctrl-Q. Those are standard
designations in all Unix shells.

Thank you very much. I’m unaware about standard Unix designations, and I
did not found it in help
viewer (maybe, I did not pay enough attention). I came from DOS, and
Ctrl-Z has another sense there
:wink:

Note that after you use Ctrl-Z you can use job control commands such as ‘fg’
and ‘bg’ (foreground and background respectively). Also note that if you
run ‘stty’ with no arguments, it will show you the keys that are mapped to
signals. I find Ctrl-\ to be handy - sends a SIGQUIT which will generate a
core file. If I have a process doing something strange and I don’t feel
like attaching to it, I just SIGQUIT it, get a core and see what it was up
to.

cheers,

Kris

I don’t know why do you think process
should not be in memory after getting SIGSTOP.

I thought “slay cat” should remove cat from memory.

Thank you again,
Eduard.

\

  • igor

Hi Kris,

Kris Warkentin <kewarken@qnx.com> wrote in article <a5g3f2$e47$1@nntp.qnx.com>…

“ed1k” <> ed1k@yahoo.com> > wrote in message
news:01c1beaa$c139e840$106fa8c0@ED1K…
Hi Igor,

Igor Kovalenko <> kovalenko@attbi.com> > wrote in article
a5fiv9$joo$> 1@inn.qnx.com> >…
Ctrl-D is standard EOF character.

So, I think this character will destroy discussed above redirection.

Ctrl-C sends SIGINT to foreground process
and Ctrl-Z moves foreground to background (which is not same as
SIGSTOP).

I guess ‘slay cat’ sends SIGSTOP.

No, slay by default should send a SIGTERM

Ok, then my question is why does the ‘cat’ ignore SIGTERM if it’s in background? Sorry, I didn’t
refresh my memory about signals from docs :wink: I only launch

cat <&1 >file.txt

Ctrl+Z

slay cat

Nothing happens. If I have few 'cat’s in memory, slay ask about which cat I’d like to terminate,
but nothing really happens…

You can send SIGSTOP by Ctrl-S and SIGCONT by Ctrl-Q. Those are standard
designations in all Unix shells.

Thank you very much. I’m unaware about standard Unix designations, and I
did not found it in help
viewer (maybe, I did not pay enough attention). I came from DOS, and
Ctrl-Z has another sense there

btw, Ctrl+Z is EOF in DOS, could try “type con >file.txt”

:wink:

Note that after you use Ctrl-Z you can use job control commands such as ‘fg’
and ‘bg’ (foreground and background respectively). Also note that if you
run ‘stty’ with no arguments, it will show you the keys that are mapped to
signals.

Thanks. Perhaps ‘stty’ without args is exactly what I need :wink:
Cheers,
Eduard.

I find Ctrl-\ to be handy - sends a SIGQUIT which will generate a
core file. If I have a process doing something strange and I don’t feel
like attaching to it, I just SIGQUIT it, get a core and see what it was up
to.

cheers,

Kris

“ed1k” <ed1k@yahoo.com> wrote in message
news:01c1beda$92cde6c0$106fa8c0@ED1K…

Hi Kris,

Kris Warkentin <> kewarken@qnx.com> > wrote in article
a5g3f2$e47$> 1@nntp.qnx.com> >…
“ed1k” <> ed1k@yahoo.com> > wrote in message
news:01c1beaa$c139e840$106fa8c0@ED1K…
Hi Igor,

Igor Kovalenko <> kovalenko@attbi.com> > wrote in article
a5fiv9$joo$> 1@inn.qnx.com> >…
Ctrl-D is standard EOF character.

So, I think this character will destroy discussed above redirection.

Ctrl-C sends SIGINT to foreground process
and Ctrl-Z moves foreground to background (which is not same as
SIGSTOP).

I guess ‘slay cat’ sends SIGSTOP.

No, slay by default should send a SIGTERM

Ok, then my question is why does the ‘cat’ ignore SIGTERM if it’s in
background? Sorry, I didn’t
refresh my memory about signals from docs > :wink: > I only launch

cat <&1 >file.txt

Ctrl+Z

slay cat

Nothing happens. If I have few 'cat’s in memory, slay ask about which cat
I’d like to terminate,
but nothing really happens…

It can’t exit. It’s not running. If you were to type ‘fg’ or ‘bg’ after
the Ctrl-Z, (or hit it with a SIGCONT I think?) then you’d see some action.

You can send SIGSTOP by Ctrl-S and SIGCONT by Ctrl-Q. Those are
standard
designations in all Unix shells.

Thank you very much. I’m unaware about standard Unix designations, and
I
did not found it in help
viewer (maybe, I did not pay enough attention). I came from DOS, and
Ctrl-Z has another sense there

btw, Ctrl+Z is EOF in DOS, could try “type con >file.txt”

:wink:

Note that after you use Ctrl-Z you can use job control commands such as
‘fg’
and ‘bg’ (foreground and background respectively). Also note that if
you
run ‘stty’ with no arguments, it will show you the keys that are mapped
to
signals.

Thanks. Perhaps ‘stty’ without args is exactly what I need > :wink:

In some cases (ie Cygwin) you may need to do a ‘stty -a’ to print all your
settings.

Cheers,
Eduard.

I find Ctrl-\ to be handy - sends a SIGQUIT which will generate a
core file. If I have a process doing something strange and I don’t feel
like attaching to it, I just SIGQUIT it, get a core and see what it was
up
to.

cheers,

Kris

ed1k <ed1k@yahoo.com> wrote:

Igor Kovalenko <> kovalenko@attbi.com> > wrote in article <a5fiv9$joo$> 1@inn.qnx.com> >…
Ctrl-D is standard EOF character.

So, I think this character will destroy discussed above redirection.

Only if the device is in the “canonical” (edited) mode. In this mode,
various control characters and escape sequences are interpreted by the
OS. Ctrl-D is one of them, but it’s not really an “EOF character” –
not much more than Ctrl-H is a “delete the previous character”
character, anyway…

If you need to see all the bytes the way they arrived on the wire, you
need to switch the device to the “raw” mode. If you do that, you’ll
never see an end of file.

Ctrl-C sends SIGINT to foreground process
and Ctrl-Z moves foreground to background (which is not same as SIGSTOP).

More accurately, Ctrl-Z sends a SIGTSTP to the foreground process (even
more accurately, to the foreground process group). That’s not the
same as a SIGSTOP, but it’s similar: it stops the process. Typically,
the shell notices that and gives you a prompt, allowing you to let the
stopped process continue, for instance by using the “fg” or “bg”
commands.

I guess ‘slay cat’ sends SIGSTOP.

No, slay sends a SIGTERM, but a SIGTERM doesn’t kill a stopped process
until it gets a SIGCONT.

You can send SIGSTOP by Ctrl-S and SIGCONT by Ctrl-Q. Those are standard
designations in all Unix shells.

Actually, Ctrl-S and Ctrl-Q don’t send any signals. Ctrl-S is just a
flow control character that stops the transmission, and Ctrl-Q resumes
it. A program trying to write to the terminal doesn’t necessarily get
stopped – it just gets blocked inside write() if it tries to write to
the terminal.

(BTW These characters don’t really have much to do with Unix shells –
they’re handled by the OS.)

Thank you very much. I’m unaware about standard Unix designations, and I did not found it in help
viewer (maybe, I did not pay enough attention). I came from DOS, and Ctrl-Z has another sense there
:wink:

You can read more about all this in the POSIX standard:

http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap11.html

I don’t know why do you think process
should not be in memory after getting SIGSTOP.

I thought “slay cat” should remove cat from memory.

“slay” just sends a signal. The signal usually causes the process to
terminate, but not always. (Guess what: you can read more about this in
the POSIX standard. :wink:


Wojtek Lerch QNX Software Systems Ltd.

Hi Wojtek,
Thank you for detailed explanation and special thanks for the link to the standards…
Cheers,
Eduard.