X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:from:date:message-id:subject:to
	:content-type; q=dns; s=default; b=W4R5sR14FLb/VLweNRkvh2a9iYYK1
	vRTUNavgChNS5x0I02uYrzbrU33DZUc5mcnpKXWDO+lZPTvVHfue/bfWXvHp2O77
	Q3QozoKRsezfuHk4fiZ0ekTk0tN/KYlgMfRzHJSsthcPyPhx+5a25AVtgPLSLI0F
	bPXH6EwpDxggpM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:from:date:message-id:subject:to
	:content-type; s=default; bh=D5EeTR76pmIRu+b//TRqRmF57RI=; b=iEv
	QH+6HY0+u40vCb5FrthmFMo0eclkwTfA0IGMpmafkVt3c/yl0JoXgAvKEb8mcOAQ
	BFfet+HGwV+9pXlEEPvg0TkOoDL0+EM1LABckiUdWth9W/f1aS/P5Vx9pY7QA0nS
	p/Tl00z6bSHmop5FtggH5MxiF0kgUI8aHlnHFdLA=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=enter, 28102019, cygwins
X-HELO: mail-qt1-f181.google.com
MIME-Version: 1.0
From: Alexander Voropay <alec@sensi.org>
Date: Mon, 28 Oct 2019 17:02:48 +0300
Message-ID: <CAGqcPWC7T_FHmS1+nRgAA56fUoWNOk1LuCqkOqb4FG=Zgkx5Qg@mail.gmail.com>
Subject: cygwin mingw crosscompiler / readline bug
To: cygwin@cygwin.com
Content-Type: text/plain; charset="UTF-8"
X-IsSubscribed: yes

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

