How to Run and Compile on Cygwin
E3V3A opened this issue · 2 comments
E3V3A commented
I've managed to compile this on Cygwin (under Win 8.1) using the following patch:
diff --git a/Makefile b/Makefile
index db49cec..f9a1bb7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
imcat: imcat.c
- cc -std=c99 -Wall -g -o imcat imcat.c -lm
+ x86_64-w64-mingw32-gcc -std=c99 -Wall -g -o imcat imcat.c -lm
+ #gcc -std=c99 -Wall -g -o imcat imcat.c -lm
run: imcat
./imcat ~/Desktop/*.png
diff --git a/imcat.c b/imcat.c
index 635fbc0..7b681b1 100644
--- a/imcat.c
+++ b/imcat.c
@@ -21,6 +21,12 @@ static unsigned char termbg[3] = { 0,0,0 };
#if defined(_WIN64)
# include <windows.h>
+
+#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
+#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
+#endif
+
+
static void get_terminal_size(void)
{
const HANDLE hStdout = GetStdHandle( STD_OUTPUT_HANDLE );
Yeah, you need MinGW for Cygwin.
The output works for a small and original PNG:
The Original:
The Result (in Cygwin Bash):
In ConEmu (PowerShell 5.1.1)
- trying to output the png you included in
./image/*.png
silently fails.
(Please add real png for testing!) - Running this in PowerShell fails on most systems not using ConPty or newest ConHost.
(I.e. on OS < Win10) - If your terminal window is smaller (in character count) than the image pixel count (in any direction) the image gets broken up.
- Also works on ConEmu, but look very ugly!
stolk commented
It should work with any size image, with any size terminal, without breaking up the image.
Did you try my pre-built windows binary to see if it behaves better? If so, there may be something wrong with the cygwin build?
E3V3A commented
Yes, your pre-built only show a few pixels, like in the other issue, so much worse.