program to get personal sys/socket.ph

Roy T. Fielding (fielding@avron.ICS.UCI.EDU)
Fri, 16 Sep 1994 04:03:25 -0700


Jack Shirazi writes:

> Another thing which might be of use: the only things required from
> sys/socket.ph as far as I'm aware are the above defines. The following
> routine will print out your own "socket.ph" which will contain
> the required values - this could be included as help in libwww for
> people who experience these problems:

[complicated perl routine deleted]

Great idea, but I think the following C program would be better:
----------------------------------------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>

int main() {

     printf("sub AF_INET { %d; }\n", AF_INET);
     printf("sub PF_INET { %d; }\n", PF_INET);
     printf("sub SOCK_DGRAM { %d; }\n", SOCK_DGRAM);
     printf("sub SOCK_STREAM { %d; }\n", SOCK_STREAM);
     exit(0);
}
----------------------------------------------------------------

Note that this is probably the only time you will ever hear me
say that a C routine is better than a perl one.  ;-)


......Roy Fielding   ICS Grad Student, University of California, Irvine  USA
                                     <fielding@ics.uci.edu>
                     <URL:http://www.ics.uci.edu/dir/grad/Software/fielding>