Configuring Cygwin Pine

Last modified $Date: 2003/12/03 22:55:57 $, $Revision: 1.1 $.

I was happy to see that Pine is now included in Cygwin, but dismayed when it didn't integrate easily into my Cygwin setup. I have what some people may consider to be an unusual setup, but I tend to work on several different computers and like to keep my configurations as portable as possible. In this setup I have Cygwin installed in a subfolder of a folder in the C:\ drive and have non-Cygwin scripts installed outside of the Cygwin root. Also, Pine's home is not my home so my home doesn't get cluttered with Pine files, and I like to navigate through my entire computer when attaching or exporting files, not just through the Cygwin directories.

If you are not familiar with UNIX/Linux shell stuff, this is probably not the best place to start. There is a version of Pine for Windows not depending on Cygwin called PC-Pine. I used it successfully for several years. I switched to Cygwin Pine because I'm expecting that upgrades through Cygwin will be easier, and I am more familiar with Pine from the UNIX side, in particular as regards to running it via ssh and integrating it with Emacs.

If you are beginning with Cygwin Pine I highly recommend

Configuration and Scripts

The environment variable %HOME% is set to "C:\Glenn". That's so my home directory is not buried in a cygwin/home directory. I tried setting it to "C:\Documents and Settings\Glenn\", but the blanks in the pathname caused problems (for a possible fix see this).

I have a folder C:\Glenn\Pine containing my .pinerc, mailcap, pine.pwd and mime.types. (The purpose of this folder is to catch the annoying .ab*, .pine-debug*, etc. files so they won't clutter up my %HOME%.) I also put a copy (not a link) of my .emacs there.

My cygwin installation root directory is C:\MyProgramFiles\cygwin\.

%TMP% is set to "C:\MyProgramFiles\cygwin\tmp". I don't know if it has to be set to this value, but this worked.

In C:\MyProgramFiles\cygwin\bin I have run:

    ln -s bash.exe csh.exe  

I created a folder C:\MyProgramFiles\cygwin\home and in it ran

    ln -s /cygdrive/c/Glenn Glenn 

In cygwin/etc/passwd I have a line (which may have been there already):

    Glenn:unused_by_nt/2000/xp:506:513:U-BEAUTIFUL\Glenn,S-1-5-21-299502267-436374069-839522115-501:/home/Glenn:/bin/bash
    

In my .pinerc I have:

    
      mailcap-search-path=/cygdrive/c/Glenn/Pine/mailcap
      mimetype-search-path=/cygdrive/c/Glenn/Pine/mime.types
      image-viewer=mozilla
      editor=pineemacs
      ssh-path=/cygdrive/c/MyProgramFiles/cygwin/bin/ssh
      ssh-command=%s %s -l %s exec /etc/rimapd
    

The mailcap contents are:

    
      Application/MSWORD;            /usr/bin/winstart -p word %s
      Application/VND.MS-EXCEL       /usr/bin/winstart -p excel %s
      Application/MSWORD;            /usr/bin/winstart -p word %s
      Application/PDF;               /usr/bin/winstart -p acrobat %s
      Application/vnd.ms-powerpoint; /usr/bin/winstart -p powerpoint %s
      Application/MSEXCEL;           /usr/bin/winstart -p excel %s
      Application/vnd.ms-excel       /usr/bin/winstart -p excel %s
      Application/VND.MS-EXCEL       /usr/bin/winstart -p excel %s
    

The mime.types has appended:

    
      Application/PDF                 pdf
      Application/MSWORD              doc dot
      Application/msaccess            mdb
      Application/vnd.ms-powerpoint   ppt pps pot
      Application/MSEXCEL             xls xlb
    

I have the following scripts:

-- C:\MyProgramFiles\bin\mozilla ---

#!/bin/sh
      /cygdrive/C/Program\ Files/mozilla.org/Mozilla/mozilla.exe $1 
    

--- C:\MyProgramFiles\bin\pine.bat ---

      @echo off
      c:
      chdir \MyProgramFiles\cygwin\bin
      bash -c /bin/startpine
    

--- C:\MyProgramFiles\bin\startpine ---

      #!/bin/sh
      # We set the home variable so .debug and dead-letter don't clutter
      # up the real home.
      export HOME=/cygdrive/c/Glenn/Pine
      /bin/rxvt -geometry 80x44+144+30 -fn fixedsys +sb -title "Local Pine" -e /bin/pine -p /cygdrive/c/Glenn/Pine/.pinerc
    

--- C:\MyProgramFiles\bin\winstart ---

      #!/bin/sh
      #
      # Script to start native Windows apps from cygwin.  For example:
      #    $ winstart word Yo.doc
      #
      if [ "$1" = "-h" ] || [ "$1" = "" ]; then
      echo "Usage: winstart [-h] [-p] [acrobat|excel|powerpoint|word] [file]"
      echo ""
      echo " -h	Prints this message"
      echo " -p	Use this option when you call $0 from pine"
      echo "[file]	Name of the file to edit  "
      echo ""
      exit
      fi
      #
      # Fix pathname for files in the $TMP directory (e.g. Pine)
      #
      if [ "$1" = "-p" ]; then
      FILE="C:/MyProgramFiles/cygwin$3"
      APP=$2
      else
      APP=$1
      if [ "$2" != "" ]; then
      EXIST=`file $2`
      fi
      if [ "$EXIST" != "" ]; then
      FILE="$2"
      else
      echo "File $2 does not exist."
      fi
      fi
      DOSFILE=`cygpath -w "$FILE"`
      #
      # Call the appropriate app.
      #
      case $APP in

      acrobat) /cygdrive/c/Program\ Files/Adobe/Acrobat\ 5.0/Acrobat/Acrobat.exe $DOSFILE;;

      excel) /cygdrive/c/Program\ Files/Microsoft\ Office/Office/excel.exe $DOSFILE;;

      powerpoint) /cygdrive/c/Program\ Files/Microsoft\ Office/Office/powerpnt.exe $DOSFILE;;

      word) /cygdrive/c/Program\ Files/Microsoft\ Office/Office/winword.exe $DOSFILE;;

      *) echo $APP: unknown option
      esac
    

--- C:\MyProgramFiles\bin\pineemacs ---

      #!/bin/sh
      #
      # This line fixes up the argument, but don't need the first sed.
      RIGHTNAME=`echo $1 | sed s/MYPROG~1/MyProgramFiles/g | sed 's/^\/cygdrive\/c/C:/'`
      # Follow the emacs link
      /cygdrive/c/MyProgramFiles/bin/emacs.exe -ms green4 -bg cornsilk3 -fn "-*-fixedsys-normal-r-*-*-*-*-*-*-c-*-*-*" $RIGHTNAME
    

--- C:\MyProgramFiles\bin\pine.bat ---

      @echo off
      c:
      chdir \MyProgramFiles\cygwin\bin
      bash -c /bin/startpine
    

I like to keep my scripts separate from the Cygwin tree for portability reasons, so in C:\MyProgramFiles\cygwin\bin I have run:

   
      ln -s /cygdrive/c/MyProgramFiles/bin/startpine startpine
      ln -s /cygdrive/c/MyProgramFiles/bin/winstart winstart
      ln -s /cygdrive/c/MyProgramFiles/emacs-21.2/bin/emacs.exe emacs.exe
      ln -s /cygdrive/c/MyProgramFiles/bin/pineemacs pineemacs
      ln -s /cygdrive/c/MyProgramFiles/bin/mozilla mozilla
    

Good luck!


Copyright 2002 by Glenn Murray