Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Run and Compile on Cygwin #5

Open
E3V3A opened this issue Dec 13, 2018 · 2 comments
Open

How to Run and Compile on Cygwin #5

E3V3A opened this issue Dec 13, 2018 · 2 comments

Comments

@E3V3A
Copy link

E3V3A commented Dec 13, 2018

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:

tiger2_100_96

The Result (in Cygwin Bash):

mintty_2018-12-13_20-35-52

In ConEmu (PowerShell 5.1.1)

conemu64_2018-12-13_20-47-50


  • 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
Copy link
Owner

stolk commented Dec 13, 2018

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
Copy link
Author

E3V3A commented Dec 13, 2018

Yes, your pre-built only show a few pixels, like in the other issue, so much worse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants