Annotation of 43BSDReno/pgrm/pascal/pdx/machine/printdata.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  */
        !             6: 
        !             7: #ifndef lint
        !             8: static char sccsid[] = "@(#)printdata.c        5.2 (Berkeley) 4/7/87";
        !             9: #endif not lint
        !            10: /*
        !            11:  * print contents of data addresses in octal
        !            12:  *
        !            13:  * There are two entries:  one is given a range of addresses,
        !            14:  * the other is given a count and a starting address.
        !            15:  */
        !            16: 
        !            17: #include "defs.h"
        !            18: #include "machine.h"
        !            19: #include "process.h"
        !            20: #include "object.h"
        !            21: #include "process/process.rep"
        !            22: #include "process/pxinfo.h"
        !            23: 
        !            24: #define WORDSPERLINE 4
        !            25: 
        !            26: /*
        !            27:  * print words from lowaddr to highaddr
        !            28:  */
        !            29: 
        !            30: printdata(lowaddr, highaddr)
        !            31: ADDRESS lowaddr;
        !            32: ADDRESS highaddr;
        !            33: {
        !            34:        register int count;
        !            35:        register ADDRESS addr;
        !            36:        int val;
        !            37: 
        !            38:        if (lowaddr > highaddr) {
        !            39:                error("first address larger than second");
        !            40:        }
        !            41:        count = 0;
        !            42:        for (addr = lowaddr; addr <= highaddr; addr += sizeof(int)) {
        !            43:                if (count == 0) {
        !            44:                        printf("%8x: ", addr);
        !            45:                }
        !            46:                dread(&val, addr, sizeof(val));
        !            47:                printf("  %8x", val);
        !            48:                if (++count >= WORDSPERLINE) {
        !            49:                        putchar('\n');
        !            50:                        count = 0;
        !            51:                }
        !            52:        }
        !            53:        if (count != 0) {
        !            54:                putchar('\n');
        !            55:        }
        !            56: }

unix.superglobalmegacorp.com

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