KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/highlandlabs/cqi-bin/ALFA_DATA/alfasymlink/root/usr/share/examples/libusb20/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/highlandlabs/cqi-bin/ALFA_DATA/alfasymlink/root/usr/share/examples/libusb20/util.c
/* ----------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp):
 * <[email protected]> wrote this file.  As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return.        Joerg Wunsch
 * ----------------------------------------------------------------------------
 */

/*
 * Helper functions common to all examples
 */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

#include <libusb20.h>
#include <libusb20_desc.h>

#include "util.h"

/*
 * Print "len" bytes from "buf" in hex, followed by an ASCII
 * representation (somewhat resembling the output of hd(1)).
 */
void
print_formatted(uint8_t *buf, uint32_t len)
{
  int i, j;

  for (j = 0; j < len; j += 16)
    {
      printf("%02x: ", j);

      for (i = 0; i < 16 && i + j < len; i++)
	printf("%02x ", buf[i + j]);
      printf("  ");
      for (i = 0; i < 16 && i + j < len; i++)
	{
	  uint8_t c = buf[i + j];
	  if(c >= ' ' && c <= '~')
	    printf("%c", (char)c);
	  else
	    putchar('.');
	}
      putchar('\n');
    }
}

Anon7 - 2021