Hypermail runs with cygwin on Win9x!

From: Crispen, Bob <Robert.Crispen_at_HSV.Boeing.com_at_hypermail-project.org>
Date: Thu, 14 Oct 1999 15:17:59 -0500
Message-ID: <ADC9269D74C5D011A41F00805FEA40E8026647E8_at_xch-hsv-02.hv.boeing.com>

Kent Landfield[SMTP:kent_at_landfield.com] sez:
>As I know very little about cygwin other than where to get it...
>Could someone write up a bulleted "how-to"  such as...
>		Getting cigwin32:
>		Installing cigwin32:
>		Unpacking hypermail:
>		Building Hypermail:
>			- run configure
>			- Compile hypermail
>			- If it does not compile
>		Installing hypermail:
>		Concerns running hypermail on a win32 system:
>This would be VERY helpful to a large section of the community.

Here's some more -- note: correction from last time.

Getting cygwin:

Installing cygwin

          C:\Windows\Start Menu\Programs\Cygnus Solutions

          before you can fire up the shell.

	  Using Windows Explorer, go to that folder and right
	  mouse on Cygwin B20.  Select "Properties".  You'll
	  probably want to make the following changes:

	  	* On the "Program" tab, check "Close on exit"

		* On the "Memory" tab set "Initial Environment"
		  to some high number (e.g., 4096).  This avoids
		  a bug in Windows' DOS shell where auto
		  allocating memory fails.

		* On the "Misc" tab, uncheck "Fast Pasting".
		  This will let you use copy and paste to paste
		  text into the bash shell.

		* On the "Screen" tab, select Initial size: 50 lines.
		  This will give you as big a window as you can get.

		* On the "Font" tab, select TT 8 x 16 to start with.
		  This gives you full-sized characters for the window.

* Double-click on Cygwin B20 or use the Start menu to bring
up the shell.
* You'll get a warning message that bash can't find the
/tmp directory. Fix that by typing: mkdir /tmp /bin /usr /etc This is in the instructions you should have read. NOTE: CORRECTION!!!
* In bash, type:
ln -s /cygnus/cygwin~1/h-i586~1/bin/sh.exe /bin/sh.exe (If you've installed cygwin somewhere other than the default location, you'll have to make the left-hand side of the link expression something else). This creates a soft link that's recognizeable by bash. If you use Explorer to make a shortcut, what you'll get in /bin is a file called "she.exe.lnk" which unfortunately bash doesn't recognize as executable. You need to make the link (or a copy of sh.exe) because many scripts (e.g., configure, many makefiles) will call /bin/sh. This is also in the instructions you should have read.
* NOTE: if you don't like the idea of creating all those
directories in the C: root, you absolutely can use links and mount to put them somewhere else. On my system at home, I've got /usr/bin pointed to the Cygnus bin directory and /usr/local pointed somewhere entirely different, and I've got /bin pointing to /usr/bin. This falls under advanced customization, and I don't recommend it unless you have a lot of time to play around with the mount command, which is somewhat different in cygwin (both from Unix and often from their own documentation).
* To exit from bash type
exit You should *not* just click the "X" box in the top right-hand corner of the window. bash can leave your system in a blue-screen-of-death state if you don't exit properly. It's a lot better than it used to be about this, but it's still dangerous to just kill off bash.

Testing the Compiler:

                  gcc hello.c


          and you should get the familiar "Hello, world!".

          Incidentally, you may #include <iostream> or <iostream.h>

                g++ -o hello hello.cpp


                gcc -mno-cygwin hello.c

                g++ -mno-cygwin -o hello hello.cpp

          Disaster! A huge number of error messages.

          To solve it, go out and get         

ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/egcs-1.1.2/egcs-1.1.2- mingw-extra.tar.gz

(that should be all one line -- I hate Exchange!)

          and extract it to:


	  In this tarball, libm.a seems to be a soft link which got
	  copied by mistake into the distribution.  Either extract
	  everything but libm.a or extract everything and delete libm.a
	  from C:\usr\mingw32\lib

	  Now try again, using the following command line arguments:

	  g++ -mno-cygwin -I/usr/mingw32/include -L/usr/mingw32/lib

          This time it should link and run correctly.           

	  The whole issue is explained in:
	  http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ -- click
	  on the article "-mno-cygwin"

* Now test gcc on a Windows program. Copy the following file
http://www.geocities.com/Tokyo/Towers/6162/win32/simple.txt to the directory you're working in and rename it to simple.c
* Compile it as follows:
gcc -mwindows simple.c or gcc -mno-cygwin -mwindows simple.c
* Execute it from your shell:
* If you compiled it -mno-cygwin, you can execute it from
Explorer by double-clicking on the icon. If you compiled it without that option, you'll need to make a copy of cygwin1.dll somewhere in your executable path before you can execute it by double-clicking on the icon.
* A somewhat more complex Win32 program is at
http://www.geocities.com/Tokyo/Towers/6162/win32/test.txt Rename it to test.c and compile as you did simple.c

Extracting hypermail:

Configuring and compiling hypermail:

                  cd //c/aawork/hypermail-2b25         

                sh ./configure         

	  This should give you a lot of messages and complete
	  successfully.  If you've used configure on a Unix system,
	  the only surprise is how familiar the outputs look.

* In bash, type
make This should also complete successfully, with one warning message: mail.c: In function `lookupnumaddr': mail.c:40: warning: return discards `const' from pointer target type
* Use a plain text editor to edit the makefiles. I suppose
there is a good way to do this in the configuration, but it's so easy to do by hand, why not? Edit src/Makefile Look for a line in the file that calls install (not the command, but the program). Change "hypermail" to "hypermail.exe" on that line. In my src/Makefile it's line 107. Edit archive/Makefile There are several lines in that file to change: the first is "hmail" and the last is "na-rdmsg". In each case, add ".exe" to the name in the line that calls install. In my archive/Makefile, these statements start at line 99 and there's 10 of them.
* In bash, type
mkdir /usr/local /usr/local/bin /usr/local/man mkdir /usr/local/man/man1 /usr/local/man/man4 This creates the directories your programs and documents will reside in. Yes, I know install is supposed to do a mkdir if it can't find those files, but that seems to be broken.
* In bash, type
make install If you've changed all the makefiles correctly, you should see the following directory contents: BASH.EXE-2.02$ ls -F /usr/local/bin hmail.exe* na-mail.exe* nu-rdmsg.exe* hrdmsg.exe* na-rdmsg.exe* wu-rdmsg.exe* hypermail.exe* nu-mail.exe* wuftpdmail.exe* BASH.EXE-2.02$ ls -F /htdocs customizing.html hr.yellow.gif hypermail.html hmrc.html hypermail.gif BASH.EXE-2.02$ ls -RF /usr/local/man man1/ man4/ /usr/local/man/man1: hypermail.1 /usr/local/man/man4: hmrc.4

Testing Hypermail:

                yourlogin:x:500:10:Your Name://c/Bob:/usr/bin/bash

          Note that I define HOME in C:\autoexec.bat:

                SET HOME=C:\Bob

	  so vim doesn't end up writing its scratch files everywhere.
	  It *appears* that the routine in file.c uses this entry to
	  find $HOME and that no other routine finds $HOME any other
	  way.  Still, it probably isn't a bad idea to go ahead and
	  define HOME in C:\autoexec.bat and reboot.

	  In the line above, the user number "500" is important.  The
	  group number "10" probably isn't (I don't have an /etc/group),
	  and (obviously) //c/Bob isn't important unless your name is Bob.
	  Just make sure the directory exists.

	  Incidentally, creating /etc/passwd was the *only* thing I had
	  to do to get hypermail to run.  Before I did this, it crashed
	  on line 231 of file.c

		    sprintf(tmppath, "%s%s", pp->pw_dir, path + 1);

	  because pp was null.

CODE GURUS: You might want to think about checking the return of getpwuid() and getting $HOME out of the environment if it's NULL. That would avoid a crash for Win32 users who don't bother to set up /etc/passwd

                cp hmrc.example ~/.hmrc

		cd test
		mkdir foo

* From bash, execute hypermail to build your archive.
/usr/local/bin/hypermail -m Sent -d foo
* Admire the results.
(speaking of admire, included mail files seem to lack the <PRE> and look awful!) (I also noticed that a JPEG file that was attached to one of the messages didn't seem to translate properly, though the JPEG header looked good.) If nobody else runs into this, forget it and chalk it up to a bad file. Otherwise, you might want to look at Jorgen Hagg's base64 routine, which I got permission to use in foxynews: http://home.hiwaay.net/~crispen/src/#foxynews I'm sure he'd give you permission to use it in hypermail.

Now if you want to know about receiving mail on Win9x/NT and using hypermail interactively, I've run out of things I know how to do. Somebody else want to pick up the ball?

Bob Crispen
bob.crispen_at_boeing.com Received on Thu 14 Oct 1999 10:21:16 PM GMT

This archive was generated by hypermail 2.3.0 : Sat 13 Mar 2010 03:46:11 AM GMT GMT