Timothe Litt 66e00b9900 Backlog of work since 2016
Too much to list all, but includes (in no particular order):
 - Cleanup for 64-bit builds, MSVC warnings.
 - Structured help
 - Help file compiler.
 - Supports volsets, writes/create work.
 - Support for I18n in messages, help.
 - Makefiles.
 - Initialize volume/volset
 - Command line editing/history

Builds and works on Linux and Windows (VS).
Not recently built or tested on other platforms, but
not intentinonally broken.
2022-10-10 11:00:20 -04:00

126 lines
3.5 KiB
C

/* Debug routines */
/* Timothe Litt March 2016
* Copyright (C) 2016 Timothe litt
* litt at acm dot org
*
* Free for use with the ODS2 package. All other rights reserved.
*/
/*
* This is distributed as part of ODS2, originally written by
* Paul Nankervis, email address: Paulnank@au1.ibm.com
*
* ODS2 is distributed freely for all members of the
* VMS community to use. However all derived works
* must maintain comments in their source to acknowledge
* the contributions of the original author and
* subsequent contributors. This is free software; no
* warranty is offered, and while we believe it to be useful,
* you use it at your own risk.
*/
#include <stddef.h>
#include <stdio.h>
#include "debug.h"
/*********************************************************** dumpblock() */
void dumpblock( unsigned block, unsigned length, const char *buffer,
const char *more, ... ) {
va_list ap;
va_start( ap, more );
vdumpblockto( stdout, block, length, buffer, more, ap );
va_end( ap );
}
/*********************************************************** vdumpblock() */
void vdumpblock( unsigned block, unsigned length, const char *buffer,
const char *more, va_list ap ) {
vdumpblockto( stdout, block, length, buffer, more, ap );
}
/*********************************************************** dumpblockto() */
void dumpblockto( FILE *fp, unsigned block, unsigned length, const char *buffer,
const char *more, ... ) {
va_list ap;
va_start( ap, more );
vdumpblockto( fp, block, length, buffer, more, ap );
va_end( ap );
}
/*********************************************************** vdumpblockto() */
void vdumpblockto( FILE *fp, unsigned block, unsigned length, const char *buffer,
const char *more, va_list ap ) {
#ifndef DEBUG_DISKIO
(void) fp;
(void) block;
(void) length;
(void) buffer;
(void) more;
(void) ap;
#else
const char *p;
size_t n, wid = 32, off = 0;
fprintf( fp, "\n****************************************\n"
"Block %u Length %u", block, length );
if( more != NULL ) {
fputc( ' ', fp );
vfprintf( fp, more, ap );
}
fputc( '\n', fp );
if( length == 0 )
return;
fprintf( fp, " " );
for( n = 0; n < wid; n++ ) {
if( n % 2 == 0 )
fprintf( fp, " %02x", (int)n );
else
fprintf( fp, " " );
}
fprintf( fp, " " );
for( n = 0; n < wid; n++ ) {
if( n % 4 == 0 )
fprintf( fp, " %02x ", (int)n );
}
fputc( '\n', fp );
while( length ) {
fprintf( fp, "%04x:", (unsigned) off );
p = buffer;
for( n = 0; n < wid; n++ ) {
if( n % 2 == 0 )
fputc( ' ', fp );
if( n < length ) {
fprintf( fp, "%02x", 0xff & (unsigned)*p++ );
} else
fprintf( fp, " " );
}
fprintf( fp, " " );
p = buffer;
for( n = 0; n < wid; n++, p++ ) {
if( n % 4 == 0 )
fputc( ' ', fp );
fprintf( fp, "%c", (n >= length)? ' ': (*p < 040 || *p > 0176)? '.': *p );
}
length -= wid;
buffer += wid;
off += wid;
fputc( '\n', fp );
}
#endif
return;
}