Re: porting Unix programs to windows

2008-02-04 Thread Doug Bohl
You need to clarify what you mean by port Unix C programs to Windows
VC using cygwin means.  As Brian has pointed out, Cygwin's headers
are written for Cygwin's libraries, just as MSVC's headers are written
for MSVC's libraries.

You'll find that it's quite easy to port UNIX programs using Cygwin's
automake, gcc, and so forth, provided you have the necessary
dependencies installed.

In what way are you porting to Windows VC?  To me that means you
either (a) want the program to link to the Microsoft Visual C++
Runtime Library, or (b) you do not want the program to link to the
Microsoft Visual C++ Runtime Library.

My recommendation: Use MSVC as an IDE only.  Go into MSVC and make
sure that the paths to the compiler, linker, assembler, preprocessor,
etc., etc., etc., includes, libs, etc., etc., are all cygwin.  You
might even be able to get MSVC to use /bin/make.

On Feb 3, 2008 4:15 PM, Wei Le [EMAIL PROTECTED] wrote:
 Hello,

 I tried to port Unix C programs to Windows VC using
 cygwin. I hope the programs can be compiled and linked
 correctly under VC. However,  it does not require that
 the programs run correctly.

 As the first step, I tried the compilation. I added
 sys/cygwin.h to the beginning of the unix C program.
 VC compiler reports errors:
 .. \iquery\iquery.cpp(100) : error C2660: 'printf' :
 function does not take 1 arguments
 .. \iquery\iquery.cpp(111) : error C2660: 'printf' :
 function does not take 1 arguments
 .. \iquery\iquery.cpp(134) : error C2660: 'printf' :
 function does not take 3 arguments
 .. \iquery\iquery.cpp(136) : error C2660: 'memcpy' :
 function does not take 3 arguments

 I added a statement printf(); to the program as a
 test, the compiler does not complain about that
 printf that do not have any paramters.

 What can I do to fix those compilation errors?

 Thanks.

 Wei

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Problem reports:   http://cygwin.com/problems.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Cygwin/Xterm scroll while selecting text

2006-05-07 Thread Doug Bohl

Yeah, Thomas is right.  I personally don't like the scrollbars, I just
use the scrollwheel on my mouse to scroll up and down text in xterm. 
So my method for selecting a large amount of text is:


- scroll to location of beginning text
- right click once on exactly where i want to begin selection
- scroll down with scrollwheel until end text is reached
- right click again exactly where i want to end selection

Of course, in conjunction with right-clicking, you could alternatively
use the scrollbar ;-)

On 5/4/06, Bill Shaffer [EMAIL PROTECTED] wrote:

Hello
All:
I am sorry if this is a repeat question - I've searched for a while and
haven't found anthing.

is there a way to get xterm to scroll up or down while selecting text, when
the cursor hits the top/bottom of the window?  Currently I am limited to one
screen at a time, which is painful if I want to select a lot of data.

I am using cygwin 1.5.19-4, x11-base 6.8.2.0-1, xterm 202-1 on Win XP Pro.

Thanks for any help.

Bill

_
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Redirecting bash stdin

2006-05-07 Thread Doug Bohl

Hmmm... I'll take a look at your code if I get time, but here's an
inefficient (yet simple) solution that would at least work: You could
start Cygwin/bash in an invisible DOS prompt window, and send commands
to it by simulating keystrokes (PostMessage or SendMessage...
WM_KEYDOWN, WM_KEYUP).  Yeah, it's sloppy, but it would probably do
the trick.

On 4/21/06, Dave [EMAIL PROTECTED] wrote:

I'm trying to get a mingw GUI application to pipe commands to cygwins
bash by redirecting its stdin as described here
http://support.microsoft.com/?id=190351.

This nearly works.

1. Start app.
2. Spawn bash with redirected stdin. bash process visible in process
explorer.
3. Send command1 to bash. No response.
4. Send command2 to bash. Response to command1 seen
5. Exit app. Response to command2 seen.

Command1 and command2 start notepad with different files, so the
response I'm expecting is a visible notepad window.

I'm ensuring the commands are terminated with \n\0 and even tried
\r\n\0 and \n\n\0.

I'm flushing the write end of the stdin pipe with FlushFileBuffers.

I've tried adding a 2nd WriteFile (just spaces and \n) to see if that
flushes the buffer. It doesn't.

The Microsoft documentation states that it is the responsibility of the
child process (bash) to empty its stdin.

I've tried a couple shells: ash and pdksh appear to work as expected.
tcsh responds immediately but exits after the first command. zsh acts
like bash.

Does anyone know what I can do to get bash to respond promptly? Or will
this approach not work with bash?

If necessary I can put the code on the net somewhere.

Thanks,

Dave.

Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 4

cygwin1.dll version 1.5.19

GNU bash, version 3.00.16(14)-release (i686-pc-cygwin)
Copyright (C) 2004 Free Software Foundation, Inc.


PS If I can get it working, the above is intended for a revamped chere.
So I need it to work with bash, since ash won't let me get a login shell
and pdksh seems like an odd requirement.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



GDB Interrupts on Cygwin

2006-03-17 Thread Doug Bohl
When running a Windows application from GDB, GDB gives control to the
application at a certain point.  It would be nice to, at an arbitrary
time, suspend the application and give control back to GDB.  I know
that I can set breakpoints, but sometimes I don't know exactly when I
want to break until after I'm running the application.  Ctrl-C
supposedly sends the SIGINT signal to GDB, breaking the running
application and restoring control to GDB.  However, this does not
appear to work, at least not on Cygwin.

I've tried /bin/kill -f -s SIGINT pid.  Sending SIGINT, or in fact any
other signal, simply terminates the Windows application.

I even wrote a simple program to suspend the Windows application at my
command using the Win32 API function SuspendThread.  While the program
does indeed suspend, GDB remains locked.

Perhaps there is some way to, using the Windows API, simulate a SIGINT
signal, or another signal to break the program (perhaps SIGSEGV would
be easiest).  Perhaps GDB could be modified in some way--it could map
Windows messages to UNIX signals.  Or maybe it could look for
keystrokes using Windows hooks rather than its current method (I'm not
even entirely sure what its current method is).  If anyone thinks any
of these methods would be feasible, I would be happy to contribute
code.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Doug Bohl
Yes, I'm running it from a Windows console.  I had CYGWIN=tty, but
I've now removed it, and Ctrl-C still isn't working.

I tried the MinGW version of GDB.  Still no Ctrl-C.  I tried Bob's tty
'voodoo'.  Still no Ctrl-C.

I'm using GDB 6.3.50_2004-12-28-cvs (cygwin-special), I have also
compiled GDB 6.4 but it crashes immediately upon trying to debug a
program (I'm not interested in solving this problem for now).

For anyone who has gotten Ctrl-C to work on Cygwin: what version of
GDB are you using?

On 3/17/06, Christopher Faylor [EMAIL PROTECTED] wrote:
 On Fri, Mar 17, 2006 at 06:56:55AM -0500, Bob Rossi wrote:
 On Fri, Mar 17, 2006 at 03:55:08AM -0500, Doug Bohl wrote:
  When running a Windows application from GDB, GDB gives control to the
  application at a certain point.  It would be nice to, at an arbitrary
  time, suspend the application and give control back to GDB.  I know
  that I can set breakpoints, but sometimes I don't know exactly when I
  want to break until after I'm running the application.  Ctrl-C
  supposedly sends the SIGINT signal to GDB, breaking the running
  application and restoring control to GDB.  However, this does not
  appear to work, at least not on Cygwin.
 
 Even though this may seem strange, try this. Before starting GDB, type
 'tty' at the console. Then, after you start GDB, run the command 'tty
 outputofttycommandfromconsole'. I think this will enable the ^c.

 This is a no-voodoo zone.

 CTRL-C works fine in gdb.  I use it ALL of the time.

 Maybe the OP has CYGWIN=tty set or is trying to run from rxvt.  If so,
 don't do that.  Run gdb from a windows console and it should work fine.

 cgf

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Problem reports:   http://cygwin.com/problems.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Doug Bohl
I know.  I removed it using the Environment Variables option in My
Computer, logged off, and logged back on, went into Cygwin, and
checked the $CYGWIN variable.  tty was no longer there.

On 3/17/06, Christopher Faylor [EMAIL PROTECTED] wrote:
 On Fri, Mar 17, 2006 at 02:11:54PM -0500, Doug Bohl wrote:
 Yes, I'm running it from a Windows console.  I had CYGWIN=tty, but
 I've now removed it, and Ctrl-C still isn't working.

 What does I've removed it mean?  You can't just unset it in a bash shell.
 You have to remove it before any cygwin program runs.

 cgf

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Problem reports:   http://cygwin.com/problems.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Windows programs in Cygwin/X ?

2006-02-27 Thread Doug Bohl
After much turmoil, I've managed to get a number of window managers
running in Cygwin/X.  What I'm wondering is this:  Is it at all
possible to allow my windows programs to be managed by my Cygwin/X
window manager?  Presently, if I'm in -fullscreen mode and I'm running
some X programs, I'd have to alt+tab out of X and into explorer.

If this isn't possible, what would I have to do to make it possible? 
Maybe write an X program to 'trap' the window of a Windows program
into an invisible X window.  Or something like that.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/