📄 osptneputil.c
字号:
/**########################################################################*########################################################################*########################################################################* * COPYRIGHT (c) 1998, 1999, 2000 by TransNexus, LLC * * This software contains proprietary and confidential information * of TransNexus, LLC. Except as may be set forth in the license * agreement under which this software is supplied, use, disclosure, * or reproduction is prohibited without the prior, express, written* consent of TransNexus, LLC. * *******#########################################################################*#########################################################################*#########################################################################*/#include "osp.h"#include "ospasn1.h"#include "osperrno.h"#include "osplist.h"#include "osptneputil.h"#include "osptnep.h"/* Given a string of characters, print out their hex and alphanumeric encoding. * * Input: the string to be printed and the length of that string. */void OSPPDumpHex( unsigned char* ospvDumpee, unsigned ospvDumpeeLen){ unsigned lineIndex = 0; int nextLineLen = 0; if ( ( ospvDumpee == NULL ) || ( ospvDumpeeLen <= 0 ) ) { OSPM_DBGMISC(( "Unable to display string - null or empty\n" )); } else { OSPM_DBGMISC(( "length: %d\n", ospvDumpeeLen )); for ( lineIndex = 0; lineIndex < ospvDumpeeLen; lineIndex += OSPC_ENROLL_HEX_CHARS_PER_LINE ) { if ( (ospvDumpeeLen - lineIndex) < OSPC_ENROLL_HEX_CHARS_PER_LINE ) { nextLineLen = ospvDumpeeLen - lineIndex; } else { nextLineLen = OSPC_ENROLL_HEX_CHARS_PER_LINE; } OSPPDumpHexLine( ospvDumpee + lineIndex, nextLineLen ); } }}/* Dump a line of hex characters. Pad the end with spaces if there aren't * enough characters. * * Input: the line to be dumped and the number of characters to be dumped. */void OSPPDumpHexLine ( unsigned char* ospvDumpeeLine, unsigned ospvDumpeeLineLen){ unsigned charIndex = 0; if ( ( ospvDumpeeLine != OSPC_OSNULL ) && ( ospvDumpeeLineLen > 0 ) ) { /* For ( each character in the line ) * o print out a character from the line if the index is within * the length of the string * o print out a space if the index is out of the string's bounds. */ for ( charIndex = 0; charIndex < OSPC_ENROLL_HEX_CHARS_PER_LINE; charIndex++ ) { if ( charIndex < ospvDumpeeLineLen ) { OSPM_DBGMISC(( "%.2X ", ospvDumpeeLine[ charIndex ] )); } else { OSPM_DBGMISC(( " " )); } /* At the end of each octet, print an additional space: */ if ( ( charIndex % 8 ) == 7 ) { OSPM_DBGMISC(( " " )); } } /* For ( every character in the line ) * o print it out at the end of the line if it's alphanumeric * o print out a period to represent a non-alphanumeric character * otherwise */ for ( charIndex = 0; charIndex < ospvDumpeeLineLen; charIndex++ ) { if ( OSPM_ISALNUM( ospvDumpeeLine[ charIndex ] ) ) { OSPM_DBGMISC(( "%c", ospvDumpeeLine[ charIndex ] )); } else { OSPM_DBGMISC(( "." )); } } OSPM_DBGMISC(( "\n" )); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -