Archive-name: aux-faq/part4
Last-modified: Tue Jul  5 14:00:55 EDT 1994

         This is the Frequently Asked Question (FAQ) list for A/UX 3.x.x


\\\\\\\\\\\\\\\\\\\\\\ START OF PART 4 OF 4 //////////////////////

:::::::::::::::::::::::::::::::::::
::::: PORTING AND PROGRAMMING :::::
:::::::::::::::::::::::::::::::::::

================================================================
P.01)  How come rn|elm|less|etc... act weird concerning signals?
----------------------------------------------------------------

Well, it's not really them at all. Many people have found that more than a
few ports require the addition of the 'set42sig()' call to enable BSD 4.2
signal delivery. The best place to add this is as the 1st executable statement
under

    "main() {"

Another point about porting applications: A/UX's 'cc' does provide "strict"
BSD, SystemV and Posix libraries. If you are porting a BSD program, you can
enable BSD "emulation" by adding the "-ZB -lbsd" options to your 'cc' command
line. In fact, using just the '-lbsd' option alleviates the need for adding
the 'set42sig()' call mentioned above and is, in many cases, the suggested
option. Compiling with gcc also helps out a great deal.

===================================
P.02)  Is X11R5 available for A/UX?
-----------------------------------

Yes! Thomas Eberhardt has ported X11R5 and the binaries (which includes full
shared libraries) for A/UX are available via anon-ftp on wuarchive.wustl.edu
under systems/aux/X11R5 (our overseas friends should get it from
ftp.uni-stuttgart.de due to US Export regs).  Patches for X11R5 compiled with
gcc are also available. It looks like it results in a nice 10-20% increase in
performance! Thomas had "taken over" X11R5 with his new port; John Coolidge
used to do it...

%%% For more information about X11R5 for A/UX, E-mail Thomas %%%

====================================
P.03)  FSF GNU doesn't support A/UX?
------------------------------------

P.03)  I've noticed that FSF GNU doesn't support A/UX. Does that mean
       I'll miss out on all the neat Gnu-stuff like gcc?

Although it's true that FSF is "boycotting" Apple and A/UX (FSF doesn't like
Apple's predisposition of suing to protect "look and feel"), ports of most
Gnu applications are available. Of particular interest is gcc version 2.5.7
which has been ported by John Coolidge (coolidge@apple.com) and is available
via anon-ftp on wuarchive.wustl.edu in systems/aux/gnu. The binaries, sources
and diffs are all available.

GCC version 2.5.7 for A/UX has been ported and is available... Highly
recommended!

As a nice compliment to using GCC, gdb (4.9) is also available.

%%% For more info about gcc for A/UX, please contact John via E-mail %%%

=======================================
P.04)  Mail reader problems under A/UX
---------------------------------------

P.04)  I've ported Elm (or other mail reader) and it doesn't seem to work.
       Why?

It seems most likely that the reason is because they attempt to use a
different file locking scheme that /bin/mail does. Pre-3.0 versions of mail
used 'flock' style file locking. 3.x.x now uses the '.lock' scheme for mail
file locking. Elm 2.4.X requires that both flock and .lock be enabled. Elm
2.3.X requires _only_ .lock locking.

=============================================
P.05)  What languages are available for A/UX?
---------------------------------------------

A/UX comes with a C compiler ('cc'), a FORTRAN-77 compiler ('f77') as well
as an assembler ('as'), SNOBOL ('sno') and a kinda-basic interpreter ('bs').
'cc' is a nice, stable, if not-too-quick compiler. 'f77' is a true FORTRAN-77
compiler and appears quite workable. I've not used 'sno' (I couldn't recall
how to program in SNOBOL if my life depended on it :) or 'bs'.

If you are doing any work in C, then it would be well worth it to get a copy
of the GNU C compiler ('gcc') (see Q&A #P.03). gcc is K&R and ANSI compatible
so if you are doing ANSI work you'll need it. Apple also has an ANSI C
compiler ('c89') that you can buy. It's available on the "A/UX Developer's
Toolkit CD" from APDA. There is also at least one other 3rd-party C compiler
out there, but I can't recall it's name right now. gcc is free; c89 runs
about $800. Both include C++ capabilities.

There are also 2 very good 3rd-party FORTRAN compilers: NKR FORTRAN and Absoft
MacFORTRAN II. In my opinion, MacFORTRAN II is the better product...  it has
finer compiler control, a wide number of compatibility options (such as VAX
FORTRAN) and excellent speed. If you do order MFII, be _sure_ to get the A/UX
version. They also sell an MPW version that will work under A/UX but it's
run under, you guessed it, MPW. The A/UX version is a true "Unix" compiler
and it's optimized for A/UX. Both MFII and NKR FORTRAN run about $500-$600.

Oasys sells 3 compiler packages: C, C++ and FORTRAN. All the compilers are
based on the GreenHills compilers which are known to be robust and fast.
However, the Oasys packages are expensive, running about $2000 per language
(although you do get assemblers and linker/loaders with the package).  Unisoft
used to distribute their "Optimizing Compilers" (FORTRAN and C) for A/UX,
but they are no longer available... Pity, because they also were based on
GreenHills and were quite nice.

At present, I know of no true Pascal compilers for A/UX.

Finally, if you are doing program development, then you'll need a good
debugger. As described above in "List of ports...", gdb has been ported if
you would prefer using something other than sdb or dbx, which are included
with A/UX. If you are using FORTRAN, then Absoft also makes an excellent
debugger which has been fine-tuned to work with MFII (it also does quite well
with C); it's called FX. It has two interfaces, character and Motif, and is
quite powerful.

=======================================
P.06)  Is OSF/Motif available for A/UX?
---------------------------------------

The only source for OSF/Motif (1.1.4) for A/UX that I know of is:

   Integrated Computer Solutions
   201 Broadway
   Cambridge, MA 02139
   617-547-0510

However, they have stopped producing this and have since stopped support for
A/UX OSF/Motif. They may still have a few copies of it available, so if you
don't mind using unsupported software, give them a call.

If you have, or can get, the actual source code for Motif then the following
will be of some help: 1.1.4 compiles with minimal changes to the source using
'cc' and works "great." However, the source for 1.2.2 makes calls to various
XIM multi-character routines, leaving many unresolved externals when linking.
Now, if someone ported X11R5 and left the XIM routines intact, then maybe
compiling and linking 1.2.2 would go off without a hitch... Any takers??

===========================
P.07)  Looking for 'ranlib'
---------------------------

P.07)  While trying to port some software, the Makefile looks
       for a program called 'ranlib' and dies when it can't
       find it. What is it and where can I get it.

'ranlib' is a program that increases the efficiency of accessing and using
archives (*.a files). A/UX's 'ar' already does this, so it isn't needed.
To get around this, do something like:

    ln /bin/true /bin/ranlib

You could also use '/bin/touch' but the above will (hopefully) take care of
cases when ranlib is called with options. If you want to put 'ranlib'
somewhere else, then that's OK. If the location is a different file system,
then you'll need to use a symbolic link:

    ln -s /bin/true /usr2/local/bin/ranlib

==============================
P.08)  Looking for 'setlocale'
------------------------------

P.08)  When compiling, I get the message that 'setlocale' is
       an "undefined symbol"... what's going on?

The 'locale' suite can be found in /lib/libposix.a. To avoid linking to
libposix.a you can do the following to create a separate locale library:

   $ ar xv /lib/libposix.a locale.o
   $ ar rv /usr/lib/liblocale.a locale.o

Now you can simply link to '-llocale' to add it in.

 

:::::::::::::::::::::::::
::::: COMMUNICATION :::::
:::::::::::::::::::::::::

==================================
C.01)  'getty' problems under A/UX
----------------------------------

C.01)  I'm unable to start a getty process on a built-in serial port. When
       I use 'setport' to enable the port, I get a "no such device" error.
       Configuring /etc/inittab to respawn getty on the port has no effect.

AppleTalk is probably enabled for the port. The getty process can be started
temporarily by turning off AppleTalk via A/UX's Finder Chooser and THEN
using the 'setport' command.

You can permanently disable AppleTalk by reconfiguring the kernel with
"newconfig noappletalk". If you wish to keep the drivers installed in the
kernel but still want to "permanently" disable AppleTalk, you can edit
/etc/startup to prevent AppleTalk from initializing and /etc/inittab can be
editted to start getty. (NOTE: /etc/startup is regenerated by newconfig so
you'll have to redo this if you reconfigure the kernel).

If you don't have an EtherTalk card installed, then you can also modify
/etc/appletalkrc to point to "ethertalk0" instead of "localtalk0". Doing
this stops AppleTalk from bothering the serial port because it tries to use
the non-existant card.

========================================
C.02)  sendmail problems with /etc/hosts
----------------------------------------

C.02)  I am using and depending on /etc/hosts to do all my hostname resolving
       (i.e. not using named or /etc/resolv.conf). How come I can't mail
       to other hosts, but I can ping|ftp|etc... them?

Well, the problem is actually with sendmail (in /usr/lib). sendmail (under
A/UX 2.0 and later) assumes the use of a nameserver. Pre-2.0 versions were
"adjusted" to look in /etc/hosts if any nameserver call failed (which it
would if it wasn't running, of course :).

Jim Jagielski (jim@jagubox.gsfc.nasa.gov) has hacked sendmail 5.65 for A/UX
to have it also check /etc/hosts. The source code is available on jagubox.

You may also want to upgrade to smail 3.1.28. smail is a very powerful yet
easy to configure (and maintain) replacement for sendmail. It can both query
the NameServer as well as look in /etc/hosts to "interpret" hostnames. The
required A/UX-related diffs and patches, which were written by Bob Denny
(denny@alisa.com) are available on jagubox.

%%% For more info, contact Jim %%%

=================================================
C.03)  "not a typewriter" error message with mail
-------------------------------------------------

C.03)  When I try to mail something, I get the following error message:
       "Cannot read frozen config file: not a typewriter". What's wrong?

This message is produced by sendmail (/usr/lib/sendmail) when it's frozen
configuration file (/usr/lib/sendmail.fc) is unusable (as it is in the A/UX
distribution which has it as a 0-byte file). To create a "new" frozen file
of your present sendmail.cf file (assuming that it's good), type:

    $ /usr/lib/sendmail -bz

(the sendmail daemon, if it exists, must be killed 1st).

============================
C.04)  Remote logins on tty0
----------------------------

C.04)  How do I set up my Mac and A/UX to enable remote logins via a modem
       on tty0?

First of all, you must edit /etc/inittab to start getty on tty0 using mo_2400:

    00:2:respawn:/etc/getty -u -t 60 tty0 mo_2400

Make sure that your modem is set to be quiet, to not return result codes and
to not echo back. It must also reset on DTR being dropped ("atq1e0&d3" will
achieve this for most Hayes-compatible modems except certain (all) USR
modems). Your modem must also raise DCD on connection ("at&c1") in order to
have Dialup security (i.e. when the line is closed, HangUp the process.  This
means that MODEM flow control must be specified in gettydefs). You then save
these changes using the "at&w" sequence. Finally, to make it autoanswer, be
sure to add "ats0=1&w".

Make sure that the modem cable is correctly configured (NOTE: This is for
Dialup Security!):

    Mac       Modem
    --------------------
    1 (HskO)  20 (DTR)
              4  (RTS)  <- yep... it gets sent to Pin 20 & 4
    2 (HskI)  8  (DCD)
    3 (TxD-)  2  (TxD)
    4 (GDN)   7  (Sgnd)
    5 (RxD-)  3  (RxD)
    6 NO CONNECT
    7 NO CONNECT
    8 (RxD+)  7  (Sgnd)  <- this is right, it gets tied to Mac pin 4 too.

If you mess up pin 8 things can get so flaky that you'll never figure out
what's going on. You see, by grounding pin 8, you make the modem port truly
RS-232 compatible. If not grounded, the port will use the RS-422 standard,
which can cause lots of problems. For more info about pinouts and cable
pinouts, check out "/usr/lib/uucp/README".

Please note that getty is the bidirectional version of getty, which is
sometimes known as uugetty. Thus, you can have dial in and dial out at the
same time on the same port. You should be using at least version 1.16 of HDB
(see above: "known bugs" and Q&A #A.16)

==================================
C.05)  'talk' and other UNIX boxes
----------------------------------

C.05)  How come I can't use 'talk' with some of the other Unix boxes out
       there, and they can't talk to me?

The reason why is because there are two versions of talk (and it's daemon
talkd) out there. A/UX uses the BSD 4.2 version. Others use the 4.3 version.
The two aren't compatible and don't even talk on the same port. If you try
to talk to someone and all you get is a "Checking for invitation..." message
then it's because the machine you're trying to access is using 4.3.

Steve Green (xrsbg@dirac.gsfc.nasa.gov) has ported the 4.3 versions of talk
and talkd (now renamed ntalk and ntalkd for A/UX) to overcome this snag. You
can have both versions available and running with no problems. The port is
available on jagubox.gsfc.nasa.gov.

=====================================================
C.06)  How can I convince A/UX to forward IP packets?
-----------------------------------------------------

You will need to use 'adb' to adjust the A/UX kernel to enable IP forwarding.
This is done by changing the value of the 'ipforwarding' "variable" from
0 (no forwarding) to 1 (enable forwarding).

As root, and in single-user mode, apply this patch:

    # Enable fowarding: just the kernel
    $ adb -w -k /unix /dev/kmem << Foo
    ipforwarding?D
    ipforwarding?W 1
    $w
    $q
    Foo

And reboot.

You'll need to redo this whenever the kernel is rebuilt (like via 'newunix')
unless you apply the patch to /etc/install.d/boot.d/bnet as follows:

    # Enable fowarding: keep it that way
    $ adb -w /etc/install.d/boot.d/bnet << Foo
    ipforwarding?D
    ipforwarding?W 1
    $w
    $q
    Foo

=================================
C.07)  Is PPP available for A/UX?
---------------------------------

Unfortunately, I know of no port of PPP for A/UX :(

================================================
C.08)  How can I change the MTU value for CSlip?
------------------------------------------------

You will need to use 'adb' to adjust either the kernel or the CSlip driver to
change this value (slip_mtu).  As root, and in single-user mode, apply this
patch (please replace $THE_VALUE with the actual HEX value you want MTU to be):

    # Change SLIP MTU value to $THE_VALUE: just the kernel
    $ adb -w -k /unix /dev/kmem << Foo
    slip_mtu?d
    slip_mtu?w $THE_VALUE
    $w
    $q
    Foo

And reboot.

You'll need to redo this whenever the kernel is rebuilt (like via 'newunix')
unless you apply the patch to /etc/install.d/boot.d/cslip as follows:

    # Change SLIP MTU value to $THE_VALUE: keep it that way
    $ adb -w /etc/install.d/boot.d/cslip << Foo
    slip_mtu?d
    slip_mtu?w $THE_VALUE
    $w
    $q
    Foo

Now run 'newconfig -v' and reboot.

 

::::::::::::::::::::::::::::
::::: ERRORS EXPLAINED :::::
::::::::::::::::::::::::::::

=======================================
E.01)  backspace erases prompt problems
---------------------------------------

E.01)  How do I keep command lines that I edit with "backspace" from erasing
       the prompt?

This behavior is due to the tty driver under A/UX. The BSD tty driver (which
A/UX doesn't use) handles this, whereas the SysV driver doesn't. If you are
running 'ksh' then you can "set -o viraw" to prevent this from happening.
As far as I know, there are no work-arounds for 'sh' or 'csh'. ('tcsh' and
'bash' do not suffer from this problem... )


====================================
E.02)  'xinit'|'startx' server error
------------------------------------

E.02)  Whenever I try to run xinit (or startx) from the CommandShell I get
       a fatal server error. Why?

The reason why is because both X and the CommandShell want _complete_ control
over your Mac (display, keyboard and mouse). So, when you try to start one
while running the other, you'll get into trouble. You need to start X either
from the Console Emulator Mode or by choosing it as your "session type" from
the Login screen (This session type will be available only if your installed
Apple's X or have installed John Coolidge's 'sessiontypes' for X11R5).

================================================
E.03)  "fcntl: local lock manager" error message
------------------------------------------------

E.03)  I keep on getting the following error message on the Console:
       "fcntl: local lock manager not registered". What's going on?

This is printed out whenever your kernel is configured for NFS and a file-
lock is attempted (as when sending Email) but the NFS lock daemon (rpc.lockd)
isn't running. This is most probably due to the fact that it wasn't started
in /etc/inittab. The fix is simple: enable rpc.lockd (and it's companion
rpc.statd) in /etc/inittab as follows:

   nfs5:2:wait:/etc/rpc.statd   # set to "wait" for NFS status monitor
   nfs6:2:once:/etc/rpc.lockd   # set to "once" for NFS lock manager

and either Restart A/UX or simply type 'init q'.

===============================================
E.04)  "xterm: no available ptys" error message
-----------------------------------------------

E.04)  When I try to startup 'xterm', I get the following error
       message: "xterm: no available ptys"... What gives?

There are three possible solutions:

    1. Make sure that there are ptys configured into the
       kernel... Use 'kconfig' to check that NPTY is non-0
    2. Switch to X11R5... This seems to happen to some users
       running Apple's X11...
    3. For at least one user, copying the /usr/lib/X11/xterm*.tic files
       to /usr/lib/terminfo/x/xterm(s) worked...
    4. One final possible solution is to start 'xterm' from 'sh'.

==================================
E.05)  ps|pstat only work for root
----------------------------------

E.05)  'ps' and 'pstat' only seem to work for root. If anyone else tries
       these commands, they get a "no mem" error message. What's wrong?

Both these commands require read access to /dev/kmem, which is not allowed
for regular users. Thus, the programs require that they be suid or sgid to
the user or group that can read /dev/kmem. See if this is true and fix if
not.

//////////////////////  END OF PART 4 OF 4  \\\\\\\\\\\\\\\\\\\\\\

=====================================
**** Author's/Editor's Signature ****
-------------------------------------


-- 
#include <std/disclaimer.h>
  |     Jim Jagielski      |  jim@jagubox.gsfc.nasa.gov  |  V: 301 286-5964  |
  | NASA/GSFC, Code 734.4  |     Greenbelt, MD 20771     |  F: 301 286-1719  |
             <<  "Broken like a window, I see my blindness now" >>
                               --   Sam Phillips: Martinis & Bikinis
