* ctl-d, bash and java
@ 1999-08-03 6:11 tien ho
1999-08-31 23:49 ` tien ho
0 siblings, 1 reply; 6+ messages in thread
From: tien ho @ 1999-08-03 6:11 UTC (permalink / raw)
To: cygwin
Hi everybody,
I'm a newbie in bash. I'm testing some examples of javacc. I'm using cygwin
b20.1 (bash and make) on NT4.0, SP4, english version and jdk 1.2 to test
javacc simple examples. I do need EOF (ctl-d) to shows the results.
Ctl-d is using to stop the cat in the command cat>myfile. It works fine in
cygwin.
The behaviour of bash on ctl-d is quite special (nothing set in IGNOREEOF).
If I'm right, it was defined the following:
If ctl-d is the first character, then it returns EOF, else delete the
character under the cursor.
To test it:
I type the command abcd<ctl-d>, I will received the following message:
bash: abcd: command not found
If ctl-d is the first character, bash disappears.
To test with java, I wrote a very simple test program, which calls the
function System.in.read(b[]). Following is the code:
public class sysIn {
public static void main (String args[]) {
int i;
byte b[]= new byte[256];
try
{
i = System.in.read(b);
}
catch (IOException ioEx)
{
System.err.println(ioEx);
return;
}
System.out.println(i);
for (int j=0; j < i; j++)
System.out.print(b[j]+" ");
System.out.println();
}
}
It displays 1 13 (code of ctl-d), when ctl-d is keyed.
Bash disappers, when "abcd<ctl-d>" were keyed. How can I explain it?
How it reacts with fgets()?
#include <stdio.h>
int main(int argc, char** argv)
{
char s[256];
if (fgets(s,256, stdin ))
{
printf("\nlen: %i\n", strlen(s));
printf("text: %s\n", s);
}
else
printf("\nempty\n");
return (1);
}
When I start the test and gave abcd<ctl-d>, I recieved:
len: 4
text: abcd
bash-2.02$
I gave <ENTER>, bash treats the command abcd and returns
bash: abcd: command not found
How can I changed the behaviour of bash, so that I can received ctl-d key
stroke and input buffer will be flushed?
Thank you for helps
Tien
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* ctl-d, bash and java
1999-08-03 6:11 ctl-d, bash and java tien ho
@ 1999-08-31 23:49 ` tien ho
0 siblings, 0 replies; 6+ messages in thread
From: tien ho @ 1999-08-31 23:49 UTC (permalink / raw)
To: cygwin
Hi everybody,
I'm a newbie in bash. I'm testing some examples of javacc. I'm using cygwin
b20.1 (bash and make) on NT4.0, SP4, english version and jdk 1.2 to test
javacc simple examples. I do need EOF (ctl-d) to shows the results.
Ctl-d is using to stop the cat in the command cat>myfile. It works fine in
cygwin.
The behaviour of bash on ctl-d is quite special (nothing set in IGNOREEOF).
If I'm right, it was defined the following:
If ctl-d is the first character, then it returns EOF, else delete the
character under the cursor.
To test it:
I type the command abcd<ctl-d>, I will received the following message:
bash: abcd: command not found
If ctl-d is the first character, bash disappears.
To test with java, I wrote a very simple test program, which calls the
function System.in.read(b[]). Following is the code:
public class sysIn {
public static void main (String args[]) {
int i;
byte b[]= new byte[256];
try
{
i = System.in.read(b);
}
catch (IOException ioEx)
{
System.err.println(ioEx);
return;
}
System.out.println(i);
for (int j=0; j < i; j++)
System.out.print(b[j]+" ");
System.out.println();
}
}
It displays 1 13 (code of ctl-d), when ctl-d is keyed.
Bash disappers, when "abcd<ctl-d>" were keyed. How can I explain it?
How it reacts with fgets()?
#include <stdio.h>
int main(int argc, char** argv)
{
char s[256];
if (fgets(s,256, stdin ))
{
printf("\nlen: %i\n", strlen(s));
printf("text: %s\n", s);
}
else
printf("\nempty\n");
return (1);
}
When I start the test and gave abcd<ctl-d>, I recieved:
len: 4
text: abcd
bash-2.02$
I gave <ENTER>, bash treats the command abcd and returns
bash: abcd: command not found
How can I changed the behaviour of bash, so that I can received ctl-d key
stroke and input buffer will be flushed?
Thank you for helps
Tien
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: ctl-d, bash and java
1999-08-04 7:45 Lincoln, W. Terry
@ 1999-08-31 23:49 ` Lincoln, W. Terry
0 siblings, 0 replies; 6+ messages in thread
From: Lincoln, W. Terry @ 1999-08-31 23:49 UTC (permalink / raw)
To: 'tien ho', cygwin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4134 bytes --]
Title: RE: ctl-d, bash and java
My uname -a says:
CYGWIN_NT-4.0 MYPC 21.0 (0.8/1/1) 1998-12-30 20:29:58 i686 unknown
When I type:
$ cat
abcd<ctrl-d>
Bash prompts:
abcd$
But as soon as I type a character (x) this happens:
abcd$ abcdx
IOW, bash (or readline) is using c-d as a way of copying the line to the keyboard buffer; or *not clearing it out*. Then when the next key is pressed the earlier text reappears!
W. Terry Lincoln - Senior Engineer      \    \  _  /
Ultimate Technology Corporation          \    \ |J| /
a Tridex Company (NASDAQ:trdx)Â Â Â Â Â Â Â Â Â Â Â Â \Â Â Â Â _|E|_
ICQ# 39362285Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \Â Â |_ S _|
Email: WTerryLincoln@engineer.com           \   |U|
WWW1: www.AngelFire.com/ny/TerryLincoln     \ / |S| \
WWW2:Â < http://terrylincoln.isonfire.com >Â Â Â Â Â \Â | |
================================================ ~~~~~
Opinions expressed do not represent the management of UTC.
> -----Original Message-----
> From: tien ho [ mailto:h_tien@hotmail.com ]
> Sent: Tuesday, August 03, 1999 9:11 AM
> To: cygwin@sourceware.cygnus.com
> Subject: ctl-d, bash and java
>
>
> Hi everybody,
> I'm a newbie in bash. I'm testing some examples of javacc.
> I'm using cygwin
> b20.1 (bash and make) on NT4.0, SP4, english version and jdk
> 1.2 to test
> javacc simple examples. I do need EOF (ctl-d) to shows the results.
> Ctl-d is using to stop the cat in the command cat>myfile. It
> works fine in
> cygwin.
>
> The behaviour of bash on ctl-d is quite special (nothing set
> in IGNOREEOF).
> If I'm right, it was defined the following:
> If ctl-d is the first character, then it returns EOF, else delete the
> character under the cursor.
>
> To test it:
> I type the command abcd<ctl-d>, I will received the following message:
> bash: abcd: command not found
> If ctl-d is the first character, bash disappears.
>
> To test with java, I wrote a very simple test program, which
> calls the
> function System.in.read(b[]). Following is the code:
> public class sysIn {
>Â Â Â Â public static void main (String args[]) {
>Â Â Â Â Â Â int i;
>Â Â Â Â Â Â byte b[]= new byte[256];
>Â Â Â Â Â Â try
>Â Â Â Â Â Â {
>Â Â Â Â Â Â Â Â i = System.in.read(b);
>Â Â Â Â Â Â }
>Â Â Â Â Â Â catch (IOException ioEx)
>Â Â Â Â Â Â {
>Â Â Â Â Â Â Â Â System.err.println(ioEx);
>Â Â Â Â Â Â Â Â return;
>Â Â Â Â Â Â }
>Â Â Â Â Â Â System.out.println(i);
>Â Â Â Â Â Â for (int j=0; j < i; j++)
>Â Â Â Â Â Â Â Â System.out.print(b[j]+" ");
>Â Â Â Â Â Â System.out.println();
>Â Â Â Â }
>Â Â }
>
> It displays 1 13 (code of ctl-d), when ctl-d is keyed.
> Bash disappers, when "abcd<ctl-d>" were keyed. How can I explain it?
>
> How it reacts with fgets()?
> #include <stdio.h>
> int main(int argc, char** argv)
> {
>Â Â char s[256];
>Â Â if (fgets(s,256, stdin ))
>Â Â {
>Â Â Â Â printf("\nlen: %i\n", strlen(s));
>Â Â Â Â printf("text: %s\n", s);
>Â Â }
>Â Â else
>Â Â Â Â printf("\nempty\n");
>Â Â return (1);
> }
> When I start the test and gave abcd<ctl-d>, I recieved:
> len: 4
> text: abcd
> bash-2.02$
> I gave <ENTER>, bash treats the command abcd and returns
> bash: abcd: command not found
>
> How can I changed the behaviour of bash, so that I can
> received ctl-d key
> stroke and input buffer will be flushed?
>
> Thank you for helps
> Tien
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: ctl-d, bash and java
1999-08-05 5:31 tien ho
@ 1999-08-31 23:49 ` tien ho
0 siblings, 0 replies; 6+ messages in thread
From: tien ho @ 1999-08-31 23:49 UTC (permalink / raw)
To: terryl; +Cc: cygwin
Hi Terry,
Thank you for your explication. Can we change this behaviour? I'm not sure
but, I don't think I have the same behaviour with korn shell or c- shell, do
I?
Can I have other shell (korn shell or c-shell), which runs on cygwin?
Thanks,
Tien
>From: "Lincoln, W. Terry" <terryl@ultimatetechnology.com>
>To: 'tien ho' <h_tien@hotmail.com>, cygwin@sourceware.cygnus.com
>Subject: RE: ctl-d, bash and java
>Date: Wed, 4 Aug 1999 09:39:41 -0400
>
>My uname -a says:
>
>CYGWIN_NT-4.0 MYPC 21.0 (0.8/1/1) 1998-12-30 20:29:58 i686 unknown
>
>When I type:
>
>$ cat
>abcd<ctrl-d>
>
>Bash prompts:
>abcd$
>
>But as soon as I type a character (x) this happens:
>
>abcd$ abcdx
>
>IOW, bash (or readline) is using c-d as a way of copying the line to the
>keyboard buffer; or *not clearing it out*. Then when the next key is
>pressed
>the earlier text reappears!
>
>
>W. Terry Lincoln - Senior Engineer \ \ _ /
>Ultimate Technology Corporation \ \ |J| /
>a Tridex Company (NASDAQ:trdx) \ _|E|_
>ICQ# 39362285 \ |_ S _|
>Email: WTerryLincoln@engineer.com \ |U|
>WWW1: www.AngelFire.com/ny/TerryLincoln \ / |S| \
>WWW2: < http://terrylincoln.isonfire.com > \ | |
>================================================ ~~~~~
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: ctl-d, bash and java
@ 1999-08-05 5:31 tien ho
1999-08-31 23:49 ` tien ho
0 siblings, 1 reply; 6+ messages in thread
From: tien ho @ 1999-08-05 5:31 UTC (permalink / raw)
To: terryl; +Cc: cygwin
Hi Terry,
Thank you for your explication. Can we change this behaviour? I'm not sure
but, I don't think I have the same behaviour with korn shell or c- shell, do
I?
Can I have other shell (korn shell or c-shell), which runs on cygwin?
Thanks,
Tien
>From: "Lincoln, W. Terry" <terryl@ultimatetechnology.com>
>To: 'tien ho' <h_tien@hotmail.com>, cygwin@sourceware.cygnus.com
>Subject: RE: ctl-d, bash and java
>Date: Wed, 4 Aug 1999 09:39:41 -0400
>
>My uname -a says:
>
>CYGWIN_NT-4.0 MYPC 21.0 (0.8/1/1) 1998-12-30 20:29:58 i686 unknown
>
>When I type:
>
>$ cat
>abcd<ctrl-d>
>
>Bash prompts:
>abcd$
>
>But as soon as I type a character (x) this happens:
>
>abcd$ abcdx
>
>IOW, bash (or readline) is using c-d as a way of copying the line to the
>keyboard buffer; or *not clearing it out*. Then when the next key is
>pressed
>the earlier text reappears!
>
>
>W. Terry Lincoln - Senior Engineer \ \ _ /
>Ultimate Technology Corporation \ \ |J| /
>a Tridex Company (NASDAQ:trdx) \ _|E|_
>ICQ# 39362285 \ |_ S _|
>Email: WTerryLincoln@engineer.com \ |U|
>WWW1: www.AngelFire.com/ny/TerryLincoln \ / |S| \
>WWW2: < http://terrylincoln.isonfire.com > \ | |
>================================================ ~~~~~
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: ctl-d, bash and java
@ 1999-08-04 7:45 Lincoln, W. Terry
1999-08-31 23:49 ` Lincoln, W. Terry
0 siblings, 1 reply; 6+ messages in thread
From: Lincoln, W. Terry @ 1999-08-04 7:45 UTC (permalink / raw)
To: 'tien ho', cygwin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4134 bytes --]
Title: RE: ctl-d, bash and java
My uname -a says:
CYGWIN_NT-4.0 MYPC 21.0 (0.8/1/1) 1998-12-30 20:29:58 i686 unknown
When I type:
$ cat
abcd<ctrl-d>
Bash prompts:
abcd$
But as soon as I type a character (x) this happens:
abcd$ abcdx
IOW, bash (or readline) is using c-d as a way of copying the line to the keyboard buffer; or *not clearing it out*. Then when the next key is pressed the earlier text reappears!
W. Terry Lincoln - Senior Engineer      \    \  _  /
Ultimate Technology Corporation          \    \ |J| /
a Tridex Company (NASDAQ:trdx)Â Â Â Â Â Â Â Â Â Â Â Â \Â Â Â Â _|E|_
ICQ# 39362285Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \Â Â |_ S _|
Email: WTerryLincoln@engineer.com           \   |U|
WWW1: www.AngelFire.com/ny/TerryLincoln     \ / |S| \
WWW2:Â < http://terrylincoln.isonfire.com >Â Â Â Â Â \Â | |
================================================ ~~~~~
Opinions expressed do not represent the management of UTC.
> -----Original Message-----
> From: tien ho [ mailto:h_tien@hotmail.com ]
> Sent: Tuesday, August 03, 1999 9:11 AM
> To: cygwin@sourceware.cygnus.com
> Subject: ctl-d, bash and java
>
>
> Hi everybody,
> I'm a newbie in bash. I'm testing some examples of javacc.
> I'm using cygwin
> b20.1 (bash and make) on NT4.0, SP4, english version and jdk
> 1.2 to test
> javacc simple examples. I do need EOF (ctl-d) to shows the results.
> Ctl-d is using to stop the cat in the command cat>myfile. It
> works fine in
> cygwin.
>
> The behaviour of bash on ctl-d is quite special (nothing set
> in IGNOREEOF).
> If I'm right, it was defined the following:
> If ctl-d is the first character, then it returns EOF, else delete the
> character under the cursor.
>
> To test it:
> I type the command abcd<ctl-d>, I will received the following message:
> bash: abcd: command not found
> If ctl-d is the first character, bash disappears.
>
> To test with java, I wrote a very simple test program, which
> calls the
> function System.in.read(b[]). Following is the code:
> public class sysIn {
>Â Â Â Â public static void main (String args[]) {
>Â Â Â Â Â Â int i;
>Â Â Â Â Â Â byte b[]= new byte[256];
>Â Â Â Â Â Â try
>Â Â Â Â Â Â {
>Â Â Â Â Â Â Â Â i = System.in.read(b);
>Â Â Â Â Â Â }
>Â Â Â Â Â Â catch (IOException ioEx)
>Â Â Â Â Â Â {
>Â Â Â Â Â Â Â Â System.err.println(ioEx);
>Â Â Â Â Â Â Â Â return;
>Â Â Â Â Â Â }
>Â Â Â Â Â Â System.out.println(i);
>Â Â Â Â Â Â for (int j=0; j < i; j++)
>Â Â Â Â Â Â Â Â System.out.print(b[j]+" ");
>Â Â Â Â Â Â System.out.println();
>Â Â Â Â }
>Â Â }
>
> It displays 1 13 (code of ctl-d), when ctl-d is keyed.
> Bash disappers, when "abcd<ctl-d>" were keyed. How can I explain it?
>
> How it reacts with fgets()?
> #include <stdio.h>
> int main(int argc, char** argv)
> {
>Â Â char s[256];
>Â Â if (fgets(s,256, stdin ))
>Â Â {
>Â Â Â Â printf("\nlen: %i\n", strlen(s));
>Â Â Â Â printf("text: %s\n", s);
>Â Â }
>Â Â else
>Â Â Â Â printf("\nempty\n");
>Â Â return (1);
> }
> When I start the test and gave abcd<ctl-d>, I recieved:
> len: 4
> text: abcd
> bash-2.02$
> I gave <ENTER>, bash treats the command abcd and returns
> bash: abcd: command not found
>
> How can I changed the behaviour of bash, so that I can
> received ctl-d key
> stroke and input buffer will be flushed?
>
> Thank you for helps
> Tien
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1999-08-31 23:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-03 6:11 ctl-d, bash and java tien ho
1999-08-31 23:49 ` tien ho
1999-08-04 7:45 Lincoln, W. Terry
1999-08-31 23:49 ` Lincoln, W. Terry
1999-08-05 5:31 tien ho
1999-08-31 23:49 ` tien ho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).