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 p

⟦bf03dcf21⟧ TextFile

    Length: 2308 (0x904)
    Types: TextFile
    Names: »p88.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Chans/x40088/p88.c« 

TextFile

/* p88 : pretty print an X.400 1988 message */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Chans/x40088/RCS/p88.c,v 5.0 90/09/20 15:57:21 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Chans/x40088/RCS/p88.c,v 5.0 90/09/20 15:57:21 pp Exp Locker: pp $
 *
 * $Log:	p88.c,v $
 * Revision 5.0  90/09/20  15:57:21  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"
#include <isode/psap.h>

char	*myname;
void	adios (), advise ();

main (argc, argv)
int	argc;
char	**argv;
{
	extern char	*optarg;
	extern int	optind;
	int	opt;

	myname = argv[0];
	while((opt = getopt(argc, argv, "")) != EOF)
		switch (opt) {
		    default:
			fprintf (stderr, "Usage: %s\n", myname);
			break;
		}
	argc -= optind;
	argv += optind;

	if (argc > 0) {
		while (argc -- > 0) {
			FILE	*fp;

			if ((fp = fopen (*argv, "r")) == NULL)
				adios (*argv, "Can't open file");
			process (fp);
			(void) fclose (fp);
			argv ++;
		}
	}
	else
		process (stdin);
	exit (0);
}

process (fp)
FILE	*fp;
{
	PS	ps;
	PE	pe;

	if ((ps = ps_alloc (std_open)) == NULLPS)
		adios (NULLCP, "Can't allocate PS stream");

	if (std_setup (ps, fp) == NOTOK)
		adios (NULLCP, "Can't setup stream");

	if ((pe = ps2pe(ps)) == NULLPE)
		adios (NULLCP, "Error reading stream [%s]",
		       ps_error (ps -> ps_errno));

	PY_pepy[0] = NULL;
	print_Transfer_MtsAPDU (pe, 1, 0, NULLCP, NULL);
	if (PY_pepy[0])
		advise (NULLCP, "Error : %s", PY_pepy);

	ps_free (ps);
	pe_free (pe);
}

#include <varargs.h>


#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
static 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 */

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