Thanks to Nicolas Simonds (nic@bridge.com) for this information.

Irix:

* First, you'll need to define the type for the length arguments in
socket calls in powstatd.c:

  #ifdef SGI
  typdef int socklen_t;
  #endif

* You'll also need to redefine inet_ntoa() for GCC. Apparently, the
native inet_ntoa() always returns 0xFFFFFFFF regardless of the input
address. This alternate won't work for IPv6 or on 64-bit machines, but
is fine for Irix. Here's an alternative version (unremoursefully
copied from "Dave" whoever that is):

  #ifdef SGI
  char *inet_ntoa (struct in_addr rcvd_addr) 
  {
    unsigned int i, quad[4];
    char *ipaddress;

    ipaddress = (char *) malloc(16);

    for ( i=0; i<4; i++ )
      quad[i] = (rcvd_addr.s_addr << (i*8)) >> 24;
    sprintf(ipaddress, "%d.%d.%d.%d", quad[0], quad[1], quad[2], quad[3]);
    return ipaddress;
  }
  #endif

* Don't forget to pass the -DSGI flag to the compiler in the Makefile;
assuming you are adding a new target "sgi" it would look something
like this:

  sgi: $(SRC) $(INC) $(ACRYPT) Makefile libdave.o
	  $(CC) $(CFLGS) -DSGI -DSTATFILE=$(STATUS) -DCONFIG="\"$(CFGDIR)/$(CFG)\"" $(SRC) $(ACRYPT) -o $(BIN) $(LIB) 

* Use GNU make: SGI make is too stupid to cope with the Makefile.

* GCC builds without complaint, MIPSPro CC not tested.

* Irix init issues only powerfail or powerwait on receipt of
SIGPWR. Since you can only associate a single script to this signal,
you'll need a "smarter" script that blends elements of powstatd.fail,
powstatd.ok and powstatd.low into a single script. Check powstatd.dumb
(its the init process that's dumb, not the script) for an example.
