|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T o
Length: 2009 (0x7d9) Types: TextFile Names: »osilookup.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« └─⟦d3ac74d73⟧ └─⟦this⟧ »isode-5.0/others/osilookup/osilookup.c«
/* osilookup.c - convert entry in /etc/osi.hosts to isoentities format */ #ifndef lint static char *rcsid = "$Header: /f/osi/others/osilookup/RCS/osilookup.c,v 6.0 89/03/18 23:36:14 mrose Rel $"; #endif /* * $Header: /f/osi/others/osilookup/RCS/osilookup.c,v 6.0 89/03/18 23:36:14 mrose Rel $ * * Contributed by John A. Scott, the MITRE Corporation * * N.B.: I whipped up this code quickly to fill a need I had. I * do not, it any way, shape, or form, warrant its output. * * * $Log: osilookup.c,v $ * Revision 6.0 89/03/18 23:36:14 mrose * Release 5.0 * */ /* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */ #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ieee802.h> #include <netosi/osi.h> #include <netosi/osi_addr.h> #include <sunosi/mapds_user.h> /* \f */ /* ARGSUSED */ main (argc, argv, envp) int argc; char **argv, **envp; { int len, paddr_type; char *prefix, *service, buf[BUFSIZ], buf2[BUFSIZ]; OSI_ADDR p_addr; if (argc < 2) { fprintf (stderr,"usage: %s host [service]\n", argv[0]); exit (0); } service = (argc > 2) ? argv[2] : "FTAM"; /* SUNLink OSI directory lookup */ mds_lookup (argv[1], service, &p_addr); /* SUNLink function to slice out SAP bytes from full address */ paddr_type = 0; if ((len = osi_get_sap (&p_addr, buf, sizeof buf, OSI_NSAP, &paddr_type)) <= 0) { fprintf (stderr, "no entry for %s %s\n", argv[1], service); exit (1); } buf2[explode (buf2, (u_char *) buf, len)]= NULL; switch (paddr_type) { case AF_NBS: prefix = "49"; break; case AF_OSINET: prefix = "470004"; break; default: prefix = ""; break; } printf ("\t\t\t\tNS+%s%s\n\n", prefix, buf2); exit (0); }