Imported Upstream version 2.6.4
This commit is contained in:
parent
fad6ced6f6
commit
fefe62b2bd
257 changed files with 6020 additions and 1394 deletions
|
|
@ -130,7 +130,7 @@
|
|||
POD ("Plain Old Documentation") - run through pod2html or perldoc. See
|
||||
perlpod(1) for more information.
|
||||
|
||||
pod2man --name='TRIPPLITE_USB' --section=8 --release='$Rev: 2598 $' --center='Network UPS Tools (NUT)' tripplite_usb.c
|
||||
pod2man --name='TRIPPLITE_USB' --section=8 --release='$Rev: 3555 $' --center='Network UPS Tools (NUT)' tripplite_usb.c
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -504,24 +504,30 @@ static int hex2d(const unsigned char *start, unsigned int len)
|
|||
static const char *hexascdump(unsigned char *msg, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
static unsigned char buf[256], *bufp;
|
||||
static unsigned char buf[256];
|
||||
unsigned char *bufp, *end;
|
||||
|
||||
bufp = buf;
|
||||
end = bufp + sizeof(buf);
|
||||
buf[0] = 0;
|
||||
|
||||
/* Dump each byte in hex: */
|
||||
for(i=0; i<len; i++) {
|
||||
for(i=0; i<len && end-bufp>=3; i++) {
|
||||
bufp += sprintf((char *)bufp, "%02x ", msg[i]);
|
||||
}
|
||||
|
||||
/* Dump single-quoted string with printable version of each byte: */
|
||||
*bufp++ = '\'';
|
||||
for(i=0; i<len; i++) {
|
||||
if (end-bufp > 0) *bufp++ = '\'';
|
||||
|
||||
for(i=0; i<len && end-bufp>0; i++) {
|
||||
*bufp++ = toprint(msg[i]);
|
||||
}
|
||||
*bufp++ = '\'';
|
||||
if (end-bufp > 0) *bufp++ = '\'';
|
||||
|
||||
*bufp++ = '\0';
|
||||
if (end-bufp > 0)
|
||||
*bufp = '\0';
|
||||
else
|
||||
*--end='\0';
|
||||
|
||||
return (char *)buf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue