Simple Use of Cygwin

CygwinKazuro Furukawa
Dec. 2003, Apr. 2004, Aug.2006.

K.Furukawa, Dec.2003, Apr.2004, Aug.2006..

1

Simple Use of Cygwin

Background & History
Needs for Gnu & Open Source Tools on Win32
Porting of Unix Tools One-by-one was TediousProviding of POSIX Environment was Preferable
Microsoft Announced POSIX Support for WinNT4, But …?
Personal Users use Win98 etc. instead of WinNT etc.

Competitive Solutions
Interix/OpenNT (Commercial, later bought by Microsoft),
Cygnus/GNU-win32 (OpenSource, later Redhat/Cygwin),
AT&T/UWin (Free but not OpenSource)Evaluated OpenNT and Gnuwin32/Cygwin in 1998
and Cygwin (beta18) was Already Mature Enough including Sockets
 Ported Several e-Linac Software on to Cygwin (There was no Setup.exe yet)
K.Furukawa, Dec.2003, Apr.2004, Aug.2006..

2

Simple Use of Cygwin

Cygwin API - System Calls
Cygwin API
Originally aimed at POSIX
Currently Supports Most Linux facilities,
POSIX/System5/BSD
System Calls and System Subroutines Including pthreadCygwin1.dll (+ Registry and Shared Memory)
Provides Most of the Functionalities
Try to Utilize Windows Services Transparentlyas much as Possible with Some CompromiseOnly System5 IPC Needs Another Process“cygserver” (formally “IPC-Daemon2”)
Designed to Support Open Source Tools
Development of Windows-native Application is also Possible
Development of dll Possible
Good Support from Redhat
K.Furukawa, Dec.2003, Apr.2004, Aug.2006..

3

Simple Use of Cygwin

Cygwin Applications/Environment
Most of the Open-Source Application Tools on Unix are Ported
Fileutils, XXXutils, Compilers, Debuggers, Editors, Internet Clients,Interpreters, Development Tools, Document Tools,
Very Quick to Follow Updates (Because of Centralized Management)

Servers
Sshd, Apache (php etc.), Squid, PostgreSQL, Inetutils, Xinetd, Proftpd, NFS, …

X11
Many of Standard X11 Clients
X11 Server with Root-less Capability
Ghostscript, etc.

EPICSClient could be Compiled in 2000 with Cygwin 1.1/EPICS 3.13
Now Many people Use EPICS 3.14 on Cygwin
K.Furukawa, Dec.2003, Apr.2004, Aug.2006..

4

Simple Use of Cygwin

Hint 1
ShellSee the definition of “Cygwin” Icon (“Command Prompt” +Bash)Replace with Rxvt + Tcsh, and your own .cshrc»Example@echo off
rem cygtcsh.bat k.furukawa may.13.2001, apr.4.2002.
set path=c:¥cygwin¥bin;%path%¥cygwin¥bin¥rxvt -fn Courier -geometry 80x40 -sl 1000 -e /usr/bin/tcsh -lFile Sharing
Samba, scp (ssh), …
 ln -s /cygdrive/c /c ; ln -s /cygdrive/d /d ; …

ServersSshd /usr/bin/ssh-host-config ; crypt xxx ; paste result into /etc/passwd
 sshdSystemV IPC
/usr/bin/cygserver-config
cygserver &K.Furukawa, Dec.2003, Apr.2004, Aug.2006..

5Simple Use of Cygwin

Hint 2
“sh” is not complete “sh”, “bash” is not “sh”Line Terminater
Line-feed is the default (bin-mode)
Unix : Line-feed,
DOS/Windows : Carriage-return + Line-feed
MacOS 9 and before, OS9 : Carriage-return

Compiler Predefined Symbol
__CYGWIN__, __CYGWIN32__, __i386__, __unix__, etc
But not _WIN32
 We should use “__CYGWIN__” for Cygwin and “_WIN32” for Windows-native.

.EXE File Name Extension
Most Gnu Tools support it Now including autoconf
K.Furukawa, Dec.2003, Apr.2004, Aug.2006..

6

Simple Use of Cygwin

Documentations
Main Site<URL : http://cygwin.com/docs.html>

Document Installed under Cygwin
/usr/share/man/ : Manual Pages
/usr/(share)/doc/ ; /usr/share/info/ : Standard Docs
/usr/(share)/doc/Cygwin/ : Modifications for Cygwin
/etc/setup/ : List of Installed Packages

Others (now somewhat old)
<URL:http://www.nanotech.wisc.edu/~khan/software/gnu-win32/>

Recommended packages
binutils, bzip2, diffutils, findutils, gcc, grep, gv, gzip, less, make, ncftp,openssh, perl, rsync, rxvt, tar, tcsh, tetex, wget, x11
K.Furukawa, Dec.2003, Apr.2004, Aug.2006..

7