library/src/datastructures/BP-BufferUtilities.cc
// prints a buffer.  If the buffer contains non-ascii characters
// they are printed out as \x escaped bytes
prints a buffer.  If the buffer contains non-ascii characters
they are printed out as \x escaped bytes
prints a buffer . If the buffer contains non - ascii characters they are printed out as \ x escaped bytes
int PrintBuffer(char *buffer, int size)
{
	int i;
	for
	(
			i = 0;
			i < size;
			i++
	)
	{
		if(buffer[i] < 0)
		{
			printf("[\\x%.2X]", (unsigned char) buffer[i]);
		}
		else
		{
			switch(buffer[i])
			{
				case 0x00:
					printf("[NUL]");
					break;
				case 0x01:
					printf("[SOH]");
					break;
				case 0x02:
					printf("[STX]");
					break;
				case 0x03:
					printf("[ETX]");
					break;
				case 0x04:
					printf("[EOT]");
					break;
				case 0x05:
					printf("[ENQ]");
					break;
				case 0x06:
					printf("[ACK]");
					break;
				case 0x07:
					printf("[BEL]");
					break;
				case 0x08:
					printf("[BS]");
					break;
				case 0x0b:
					printf("[VT]");
					break;
				case 0x0c:
					printf("[FF]");
					break;
				case 0x0e:
					printf("[SO]");
					break;
				case 0x0f:
					printf("[SI]");
					break;
				case 0x10:
					printf("[DLE]");
					break;
				case 0x11:
					printf("[DC1]");
					break;
				case 0x12:
					printf("[DC2]");
					break;
				case 0x13:
					printf("[DC3]");
					break;
				case 0x14:
					printf("[DC4]");
					break;
				case 0x15:
					printf("[NAK]");
					break;
				case 0x16:
					printf("[SYN]");
					break;
				case 0x17:
					printf("[ETB]");
					break;
				case 0x18:
					printf("[CAN]");
					break;
				case 0x19:
					printf("[EM]");
					break;
				case 0x1a:
					printf("[SUB]");
					break;
				case 0x1b:
					printf("[ESC]");
					break;
				case 0x1c:
					printf("[FS]");
					break;
				case 0x1d:
					printf("[GS]");
					break;
				case 0x1e:
					printf("[RS]");
					break;
				case 0x1f:
					printf("[US]");
					break;
				default:
					printf("%c", buffer[i]);
					break;
			}
		}
	}
	return ERR_SUCCESS;
}
int PrintBuffer ( char * buffer , int size ) { int i ; for ( i = 0 ; i < size ; i ++ ) { if ( buffer [ i ] < 0 ) { printf ( " \\ " , ( unsigned char ) buffer [ i ] ) ; } else { switch ( buffer [ i ] ) { case 0x00 : printf ( " " ) ; break ; case 0x01 : printf ( " " ) ; break ; case 0x02 : printf ( " " ) ; break ; case 0x03 : printf ( " " ) ; break ; case 0x04 : printf ( " " ) ; break ; case 0x05 : printf ( " " ) ; break ; case 0x06 : printf ( " " ) ; break ; case 0x07 : printf ( " " ) ; break ; case 0x08 : printf ( " " ) ; break ; case 0x0b : printf ( " " ) ; break ; case 0x0c : printf ( " " ) ; break ; case 0x0e : printf ( " " ) ; break ; case 0x0f : printf ( " " ) ; break ; case 0x10 : printf ( " " ) ; break ; case 0x11 : printf ( " " ) ; break ; case 0x12 : printf ( " " ) ; break ; case 0x13 : printf ( " " ) ; break ; case 0x14 : printf ( " " ) ; break ; case 0x15 : printf ( " " ) ; break ; case 0x16 : printf ( " " ) ; break ; case 0x17 : printf ( " " ) ; break ; case 0x18 : printf ( " " ) ; break ; case 0x19 : printf ( " " ) ; break ; case 0x1a : printf ( " " ) ; break ; case 0x1b : printf ( " " ) ; break ; case 0x1c : printf ( " " ) ; break ; case 0x1d : printf ( " " ) ; break ; case 0x1e : printf ( " " ) ; break ; case 0x1f : printf ( " " ) ; break ; default : printf ( " " , buffer [ i ] ) ; break ; } } } return ERR_SUCCESS ; }
prints a buffer.
prints a buffer .
// print out non-ascii characters // seperate non-printables from printables			 // if non-printable, print as [character] // Null // Start of Heading // Start of Text // End of Text // End of Transmission // Enquiry // Acknoledge // Bell // Backspace // Horizontal tab //case 0x09: //	printf("[TAB]"); //	break; // NL line feed, new line //case 0x0a: //	printf("[LF]"); //	break; // Vertical tab // NP form feed, new page // Carriage Return //case 0x0d: //	printf("[CR]"); //	break; // Shift Out // Shift In // Data Link Escape // Device Control 1 // Device Control 2 // Device Control 3 // Device Control 4 // Negative Acknoledge // Synchronous Idle // End Transmission Block // Cancel // End of Medium // Substitute // Escape // File Separator // Group Separator // Record Separator // Unit Separator //print out the actual character if printable // return indicating success