Annotation of 43BSDReno/contrib/isode-beta/psap/pe2text.c, revision 1.1

1.1     ! root        1: /* pe2text.c - write a PE thru a debug filter */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/psap/RCS/pe2text.c,v 7.0 89/11/23 22:12:58 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/psap/RCS/pe2text.c,v 7.0 89/11/23 22:12:58 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       pe2text.c,v $
        !            12:  * Revision 7.0  89/11/23  22:12:58  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include <stdio.h>
        !            31: #include "psap.h"
        !            32: #include "logger.h"
        !            33: 
        !            34: /*  */
        !            35: 
        !            36: /* logfile-backed abstract for PStreams */
        !            37: 
        !            38: /* ARGSUSED */
        !            39: 
        !            40: static int  ll_pswrite (ps, data, n, in_line)
        !            41: PS     ps;
        !            42: PElementData data;
        !            43: PElementLen n;
        !            44: int    in_line;
        !            45: {
        !            46:     register LLog    *lp = (LLog *) ps -> ps_addr;
        !            47: 
        !            48:     if (lp -> ll_stat & LLOGTTY) {
        !            49:        (void) fflush (stdout);
        !            50: 
        !            51:        (void) fwrite ((char*) data, sizeof *data, (int) n, stderr);
        !            52:     }
        !            53: 
        !            54:     if (lp -> ll_fd == NOTOK) {
        !            55:        if (lp -> ll_stat & (LLOGERR | LLOGTTY))
        !            56:            return OK;
        !            57:        if (ll_open (lp) == NOTOK)
        !            58:            return NOTOK;
        !            59:     }
        !            60:     else
        !            61:        if (ll_check (lp) == NOTOK)
        !            62:            return NOTOK;
        !            63: 
        !            64:     return write (lp -> ll_fd, (char *) data, (int) n);
        !            65: }
        !            66: 
        !            67: /*  */
        !            68: 
        !            69: static int  ll_psopen (ps)
        !            70: register PS ps;
        !            71: {
        !            72:     ps -> ps_writeP = ll_pswrite;
        !            73: 
        !            74:     return OK;
        !            75: }
        !            76: 
        !            77: #define        ll_psetup(ps, lp)       ((ps) -> ps_addr = (caddr_t) (lp), OK)
        !            78: 
        !            79: /*  */
        !            80: 
        !            81: void   pe2text (lp, pe, rw, cc)
        !            82: register LLog *lp;
        !            83: register PE pe;
        !            84: int    rw,
        !            85:        cc;
        !            86: {
        !            87:     register char   *bp;
        !            88:     char   buffer[BUFSIZ];
        !            89:     register PS ps;
        !            90: 
        !            91:     bp = buffer;
        !            92:     (void) sprintf (bp, "%s PE", rw ? "read" : "wrote");
        !            93:     bp += strlen (bp);
        !            94:     if (pe -> pe_context != PE_DFLT_CTX) {
        !            95:        (void) sprintf (bp, ", context %d", pe -> pe_context);
        !            96:        bp += strlen (bp);
        !            97:     }
        !            98:     if (cc != NOTOK) {
        !            99:        (void) sprintf (bp, ", length %d", cc);
        !           100:        bp += strlen (bp);
        !           101:     }
        !           102:     LLOG (lp, LLOG_ALL, ("%s", buffer));
        !           103: 
        !           104:     if ((ps = ps_alloc (ll_psopen)) != NULLPS) {
        !           105:        if (ll_psetup (ps, lp) != NOTOK)
        !           106:            (void) pe2pl (ps, pe);
        !           107: 
        !           108:        ps_free (ps);
        !           109:     }
        !           110: 
        !           111:     (void) ll_printf (lp, "-------\n");
        !           112: 
        !           113:     (void) ll_sync (lp);
        !           114: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.