1: /*	hexdmp.c	1.5	83/05/13	*/
   2: 
   3: #include <ctype.h>
   4: #include <stdio.h>
   5: #include "cpmio.h"
   6: #include "cpmfio.h"
   7: 
   8: dump(cmdline)
   9:     char cmdline[];
  10: {
  11:     char name[9], ext[4];
  12:     C_FILE *cid;
  13: 
  14:     if (!(namesep(cmdline, name, ext)))
  15:         return;
  16:     if ((cid = c_open(name, ext, READ)) == NULL)
  17:         return;
  18:     hexdump(cid);
  19:     c_close(cid);
  20: }
  21: 
  22: hexdump(fp)
  23:     C_FILE *fp;
  24: {
  25:     int c, nc=0, cbuf[16], blcnt=0;
  26: 
  27:     printf("\n");
  28:     while ((c = c_getc(fp)) != EOF) {
  29:         cbuf[nc%16] = c;
  30:         if (nc%128 == 0)
  31:             printf("\n      Block %04d\n", blcnt++);
  32:         if (nc%16  == 0)
  33:             printf("%04x  ", nc);
  34:         ++nc;
  35:         printf("%02x ", c);
  36:         if (nc%16  == 0)
  37:             printline(cbuf, 16);
  38:     }
  39:     if (nc%16 != 0)
  40:         printline(cbuf, nc%16);
  41:     printf("\n");
  42: }
  43: 
  44: printline(cbuf, nc)
  45:     int cbuf[];
  46: {
  47:     int i1;
  48: 
  49:     for (i1=0; i1< nc; ++i1) {
  50:         if (cbuf[i1] > 31 && cbuf[i1] < 127)
  51:             printf("%c", cbuf[i1]);
  52:         else
  53:             printf(".");
  54:     }
  55:     printf("\n");
  56: }

Defined functions

dump defined in line 8; used 1 times
hexdump defined in line 22; used 1 times
  • in line 18
printline defined in line 44; used 2 times
Last modified: 1983-06-24
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 933
Valid CSS Valid XHTML 1.0 Strict