* cygwin mingw crosscompiler / readline bug
@ 2019-10-28 14:03 Alexander Voropay
2020-01-06 21:59 ` Alexander Voropay
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Voropay @ 2019-10-28 14:03 UTC (permalink / raw)
To: cygwin
Hi!
I'm trying to compile a standalone Windows-32 console application
using 'readline' with cygwin's 'i686-w64-mingw32-gcc' crosscompiler.
I have a bug: readline repeates every input line to STDOUT on
Windows-32 application (running from the CMD.EXE, outside a Cygwin)
==
C:\TEMP\readline>readl
enter a string> sadsad
sadsad
You entered: sadsad
enter a string> aa asd
aa asd
You entered: aa asd
enter a string> ^D
C:\TEMP\readline>
==
Note the CMD command prompt. All needed DLLs are transferred to the application
directory
C:\TEMP\readline>dir
..
28.10.2019 16:53 <DIR> .
28.10.2019 16:53 <DIR> ..
26.12.2018 05:42 94 208 libgcc_s_sjlj-1.dll
05.12.2017 12:18 411 648 libncursesw6.dll
12.01.2017 05:52 180 224 libreadline7.dll
05.01.2019 17:09 48 659 libwinpthread-1.dll
28.10.2019 10:53 313 readl.c
28.10.2019 16:53 159 266 readl.exe
This program behaves _differently_ on the Cygwin terminal being
compiles with 'gcc'
==
$ ./readl.exe
enter a string> sadsad
You entered: sadsad
enter a string> aa asd
You entered: aa asd
enter a string>
$
==
My application:
===
#include<stdlib.h>
#include<stdio.h>
#include<readline/readline.h>
#include<readline/history.h>
int main(){
char* line;
while (1) {
line = readline("enter a string> ");
add_history(line);
if(line != NULL) {
printf("You entered: %s\n", line);
free(line);
}else{
break;}
}
}
===
Command line to compile under 'mingw' crosscompiler:
$ i686-w64-mingw32-gcc -o readl readl.c -lreadline
Command line for Cygwin:
$ gcc -o readl readl.c -lreadline
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: cygwin mingw crosscompiler / readline bug
2019-10-28 14:03 cygwin mingw crosscompiler / readline bug Alexander Voropay
@ 2020-01-06 21:59 ` Alexander Voropay
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Voropay @ 2020-01-06 21:59 UTC (permalink / raw)
To: cygwin
Auto-answer..he-he...
> I'm trying to compile a standalone Windows-32 console application
> using 'readline' with cygwin's 'i686-w64-mingw32-gcc' crosscompiler.
>
> I have a bug: readline repeates every input line to STDOUT on
> Windows-32 application (running from the CMD.EXE, outside a Cygwin)
'readline' library requires terminal-specific functions like
tputs()/tgetnum() e.t.c.
and should be linked with old-good 'libtermcap' (not provides with Cygwin now)
or with more recent curses library i.e. 'ncurses' or 'pdcurses'.
On the Cygwin's 'i686-w64-mingw32-gcc' crosscompiler 'libreadline' depends
on the 'ncurses' which has special support for Win32 console 'terminal'.
To enable Win32 console support set a TERM environment:
set TERM=#win32console
(yes! with # character)
--
-=AV=-
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-06 21:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 14:03 cygwin mingw crosscompiler / readline bug Alexander Voropay
2020-01-06 21:59 ` Alexander Voropay
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).