DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T o

⟦da3202ca8⟧ TextFile

    Length: 3438 (0xd6e)
    Types: TextFile
    Names: »oiddump.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/others/quipu/tools/oiddump/oiddump.c« 

TextFile

/* oiddump.c - dump OID tables */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/others/quipu/tools/oiddump/RCS/oiddump.c,v 6.0 89/03/18 23:34:24 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/others/quipu/tools/oiddump/RCS/oiddump.c,v 6.0 89/03/18 23:34:24 mrose Rel $
 *
 *
 * $Log:	oiddump.c,v $
 * Revision 6.0  89/03/18  23:34:24  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 <varargs.h>
#include "psap2.h"
#include "logger.h"
#include "tailor.h"
#include "quipu/common.h"
#include "quipu/util.h"
#include "quipu/dua.h"

/* \f

   DATA */

static char *myname = "oiddump";

static int verbose = 0;
char      *pflag = NULLCP;
char	  *defname = "default";


void	adios (), advise ();

/* \f

   MAIN */

/* ARGSUSED */

main (argc, argv, envp)
int	argc;
char  **argv,
      **envp;
{
    PS ps;

    arginit (argv);

    if ((ps = ps_alloc (std_open)) == NULLPS)
	adios (NULLCP, "ps_alloc failed");
    if (std_setup (ps, stdout) == NOTOK)
	adios (NULLCP, "std_setup failed");

    dumpalloid ();

    exit (0);
}

/* \f

   ARGINIT */

static	arginit (vec)
char  **vec;
{
    register char  *ap;

    if (myname = rindex (*vec, '/'))
	myname++;
    if (myname == NULL || *myname == NULL)
	myname = *vec;

    isodetailor (myname, 1);

    for (vec++; ap = *vec; vec++) {
	if (*ap == '-')
	    switch (*++ap) {
		case 'v':
		    verbose++;
		    continue;

		case 'p':
		    vec++;
		    if ((pflag = *vec) == NULL || *pflag == '-')
			goto usage;
		    continue;

		default:
		    adios (NULLCP, "-%s: unknown switch", ap);
	    }

usage: ;
	adios (NULLCP, "usage: %s [switches]", myname);
    }

    if (pflag == NULLCP)
	pflag = PLocalHostName ();

    {
	extern char *oidtable;
	
	if (tai_init (myname) != OK)
	    adios (NULLCP, "Tailoring failed");
	load_oid_table (oidtable);
	get_default_acl ();
    }
}

/* \f

   INTERACTIVE */

static int  getline (prompt, buffer)
char   *prompt,
       *buffer;
{
    register int    i;
    register char  *cp,
                   *ep;
    static int  sticky = 0;

    if (sticky) {
	sticky = 0;
	return NOTOK;
    }

    printf ("%s ", prompt);
    (void) fflush (stdout);

    for (ep = (cp = buffer) + BUFSIZ - 1; (i = getchar ()) != '\n';) {
	if (i == EOF) {
	    printf ("\n");
	    clearerr (stdin);
	    if (cp != buffer) {
		sticky++;
		break;
	    }

	    return NOTOK;
	}

	if (cp < ep)
	    *cp++ = i;
    }
    *cp = NULL;

    return OK;
}

/* \f

   ERRORS */

#ifndef	lint
void	_advise ();


void	adios (va_alist)
va_dcl
{
    va_list ap;

    va_start (ap);

    _advise (ap);

    va_end (ap);

    _exit (1);
}
#else
/* VARARGS */

void	adios (what, fmt)
char   *what,
       *fmt;
{
    adios (what, fmt);
}
#endif


#ifndef	lint
void	advise (va_alist)
va_dcl
{
    va_list ap;

    va_start (ap);

    _advise (ap);

    va_end (ap);
}


static void  _advise (ap)
va_list	ap;
{
    char    buffer[BUFSIZ];

    asprintf (buffer, ap);

    (void) fflush (stdout);

    fprintf (stderr, "%s: ", myname);
    (void) fputs (buffer, stderr);
    (void) fputc ('\n', stderr);

    (void) fflush (stderr);
}
#else
/* VARARGS */

void	advise (what, fmt)
char   *what,
       *fmt;
{
    advise (what, fmt);
}
#endif