Imported Upstream version 2.6.4

This commit is contained in:
Arnaud Quette 2012-06-01 15:55:19 +02:00
parent fad6ced6f6
commit fefe62b2bd
257 changed files with 6020 additions and 1394 deletions

View file

@ -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;
}