Posted on
July 19, 2007 by
Juan
One of the problems I had getting the hectospec IRAF scripts installed was that they used
f77 to compile some code. My first thought was to just substitute
g77 in the proper places in the hectospec scripts using the
g77 binary I downloaded from the
High Performance Computing on the Mac website. However, it turns out that
g77 is stricter in its interpretation of logical statements than
f77 … and so the old hectospec code failed to compile. A proper way to compile this old code is to use the -
fugly-logint flag for g77, but that was a pain for so many IRAF scripts. Thus I created the following perl script to allow ancient
f77 code to compile properly with
g77 on the Mac. I just saved this script to
/usr/local/bin and made it executable. Now my old IRAF scripts compile just fine on my new shiny Mac.
#!/usr/bin/env perl
# This script allows the compilation of legacy f77 code with g77 by tossing
# the g77 compiler a -fugly-logint flag to tell it to allow legacy logic
# statements instead of the proper EQV version.
# Initialize
$command = "g77 -fugly-logint ";
for ($i=0; $i<=$#ARGV; $i++)
{
$arg = $ARGV[$i];
$command .= " $arg";
}
`$command`;
exit;
Category
MacOS X, Programming
Posted on
July 19, 2007 by
Juan
Another piece of a fundamental *nix installation that is broken in MacOS X Tiger is xterm. Specifically, the Tektronix 4014 emulation in xterm on the Mac generates ‘empty boxes’ instead of actual characters for text as shown below:

I found that this problem had been reported on Apple’s X11-users mailing list here, but no solution had been determined. I spent a bit of time looking for “missing” fonts as suggested in the posting, then decided this had to be a problem with the xterm executable and tried my previous solution of installing the program from MacPorts via
sudo port install xterm
Since that doesn’t over-ride the default xterm, I then over-rode the default installed
xterm using
sudo mv /usr/X11R6/bin/xterm /usr/X11R6/bin/xterm.disabled
sudo ln -s /opt/local/bin/xterm /usr/X11R6/bin/xterm
Now Tektronix emulation works and I get a screen like the one below:

Category
Astronomical Software, MacOS X, MacOS X Annoyances, MacPorts, X11
Posted on
July 19, 2007 by
Juan
After several days of trying to get the Hectospec folk’s data reduction packages working on my Mac, I realized one of the major problems was that ksh on the Macintosh had a major problem. Normally, in ksh (korn shell), you can set up a loop to read through a list of objects via a read command within a while..do loop. For example, to echo a list of files your ksh script could contain
#!/bin/ksh
ls -1 . | while read fname; do
echo $fname
done
where the
read filename bit reads a line from the piped input and assigns the first block of text (before a space) to the variable
fname. Try this script on MacOS X and it produces no output. “read” fails. This has been documented elsewhere at least twice that I have been able to find with Google,
here and
here. So clearly, there is a serious bug in the installed version of ksh on MacOS X. I fixed it by updating my ksh using MacPorts, a simple
sudo port install ksh93
followed by changes in the Hectospec scripts to point to
/opt/local/bin/ksh instead of
/bin/ksh and I was done.
Category
Command Line Tricks, MacOS X, MacOS X Annoyances, MacPorts