summaryrefslogtreecommitdiffstats
path: root/src/isode/psap/pe2text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/isode/psap/pe2text.c')
-rw-r--r--src/isode/psap/pe2text.c122
1 files changed, 122 insertions, 0 deletions
diff --git a/src/isode/psap/pe2text.c b/src/isode/psap/pe2text.c
new file mode 100644
index 000000000..beff7d7bf
--- /dev/null
+++ b/src/isode/psap/pe2text.c
@@ -0,0 +1,122 @@
+/* pe2text.c - write a PE thru a debug filter */
+
+#ifndef lint
+static char *rcsid = "$Header$";
+#endif
+
+/*
+ * $Header$
+ *
+ *
+ * $Log$
+ * Revision 1.1 1994/06/10 03:33:16 eichin
+ * autoconfed isode for kerberos work
+ *
+ * Revision 1.1 1994/06/01 00:37:37 eichin
+ * add psap too
+ *
+ * Revision 8.0 91/07/17 12:46:55 isode
+ * Release 7.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.
+ *
+ */
+
+
+/* LINTLIBRARY */
+
+#include <stdio.h>
+#include "psap.h"
+#include "logger.h"
+
+/* */
+
+/* logfile-backed abstract for PStreams */
+
+/* ARGSUSED */
+
+static int ll_pswrite (ps, data, n, in_line)
+PS ps;
+PElementData data;
+PElementLen n;
+int in_line;
+{
+ register LLog *lp = (LLog *) ps -> ps_addr;
+
+ if (lp -> ll_stat & LLOGTTY) {
+ (void) fflush (stdout);
+
+ (void) fwrite ((char *) data, sizeof *data, (int) n, stderr);
+ (void) fflush (stderr);
+ }
+
+ if (lp -> ll_fd == NOTOK) {
+ if ((lp -> ll_stat & (LLOGERR | LLOGTTY)) == (LLOGERR | LLOGTTY))
+ return ((int) n);
+ if (ll_open (lp) == NOTOK)
+ return NOTOK;
+ }
+ else
+ if (ll_check (lp) == NOTOK)
+ return NOTOK;
+
+ return write (lp -> ll_fd, (char *) data, (int) n);
+}
+
+/* */
+
+static int ll_psopen (ps)
+register PS ps;
+{
+ ps -> ps_writeP = ll_pswrite;
+
+ return OK;
+}
+
+#define ll_psetup(ps, lp) ((ps) -> ps_addr = (caddr_t) (lp), OK)
+
+/* */
+
+void pe2text (lp, pe, rw, cc)
+register LLog *lp;
+register PE pe;
+int rw,
+ cc;
+{
+ register char *bp;
+ char buffer[BUFSIZ];
+ register PS ps;
+
+ bp = buffer;
+ (void) sprintf (bp, "%s PE", rw ? "read" : "wrote");
+ bp += strlen (bp);
+ if (pe -> pe_context != PE_DFLT_CTX) {
+ (void) sprintf (bp, ", context %d", pe -> pe_context);
+ bp += strlen (bp);
+ }
+ if (cc != NOTOK) {
+ (void) sprintf (bp, ", length %d", cc);
+ bp += strlen (bp);
+ }
+ LLOG (lp, LLOG_ALL, ("%s", buffer));
+
+ if ((ps = ps_alloc (ll_psopen)) != NULLPS) {
+ if (ll_psetup (ps, lp) != NOTOK)
+ (void) pe2pl (ps, pe);
+
+ ps_free (ps);
+ }
+
+ (void) ll_printf (lp, "-------\n");
+
+ (void) ll_sync (lp);
+}